0.51.1 • Published 16 hours ago
@opentelemetry/opentelemetry-browser-detector v0.51.1
OpenTelemetry Browser Detector
Note: This is an experimental package under active development. New releases may include breaking changes.
This module provides detector for browser environments
Installation
npm install --save @opentelemetry/opentelemetry-browser-detector
Usage
import { Resource, detectResources } from '@opentelemetry/resources';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { browserDetector } from '@opentelemetry/opentelemetry-browser-detector';
async function start(){
let resource= new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'Test App Name',
});
let detectedResources= await detectResources({detectors:[browserDetector]});
resource=resource.merge(detectedResources);
const provider = new WebTracerProvider({
resource
});
provider.addSpanProcessor(new BatchSpanProcessor(new OTLPTraceExporter( {url:CONF.url ,headers:{}}),{exportTimeoutMillis:CONF.timeOutMillis,scheduledDelayMillis:CONF.delayMillis}));
provider.register({
// Changing default contextManager to use ZoneContextManager - supports asynchronous operations - optional
contextManager: new ZoneContextManager(),
});
// Registering instrumentations
registerInstrumentations({
instrumentations: [
new DocumentLoadInstrumentation(),
new XMLHttpRequestInstrumentation(),
new FetchInstrumentation(),
],
});
}
start().then(()=> console.log("Instrumentation started"));
The browser identification attributes will be added to the resource spans when traces are created. These attributes include platform, brands, mobile, language if the browser supports the userAgentData api, otherwise it will contain only the user_agent information
0.51.1
16 hours ago
0.51.0
14 days ago
0.50.0
1 month ago
0.49.1
2 months ago
0.49.0
2 months ago
0.48.0
3 months ago
0.47.0
4 months ago
0.46.0
5 months ago
0.42.0
8 months ago
0.41.1
10 months ago
0.43.0
8 months ago
0.41.2
9 months ago
0.41.0
10 months ago
0.45.1
6 months ago
0.44.0
7 months ago
0.45.0
6 months ago
0.39.1
12 months ago
0.39.0
12 months ago
0.40.0
11 months ago
0.38.0
1 year ago
0.37.0
1 year ago
0.36.1
1 year ago
0.36.0
1 year ago
0.35.1
1 year ago
0.35.0
1 year ago
0.34.0
1 year ago