-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating the browser example to use the tracetest sdk
- Loading branch information
Showing
4 changed files
with
23 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,8 @@ | ||
import { CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator } from "@opentelemetry/core"; | ||
import { WebTracerProvider } from "@opentelemetry/sdk-trace-web"; | ||
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base"; | ||
import { registerInstrumentations } from "@opentelemetry/instrumentation"; | ||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; | ||
import { ZoneContextManager } from "@opentelemetry/context-zone"; | ||
import { UserInteractionInstrumentation } from "@tracetest/instrumentation-user-interaction"; | ||
import { getWebAutoInstrumentations } from "@opentelemetry/auto-instrumentations-web"; | ||
import { Resource } from "@opentelemetry/resources"; | ||
import TracetestWebSDK from "@tracetest/opentelemetry-web"; | ||
|
||
const provider = new WebTracerProvider({ | ||
resource: new Resource({ | ||
"service.name": "browser-app", | ||
}), | ||
const sdk = new TracetestWebSDK({ | ||
serviceName: "browser-app", | ||
endpoint: "http://localhost:4318/v1/traces", | ||
}); | ||
|
||
provider.addSpanProcessor( | ||
new BatchSpanProcessor(new OTLPTraceExporter({ url: "http://localhost:4318/v1/traces" }), { | ||
maxQueueSize: 10000, | ||
scheduledDelayMillis: 200, | ||
}) | ||
); | ||
|
||
provider.register({ | ||
contextManager: new ZoneContextManager(), | ||
propagator: new CompositePropagator({ | ||
propagators: [new W3CBaggagePropagator(), new W3CTraceContextPropagator()], | ||
}), | ||
}); | ||
|
||
registerInstrumentations({ | ||
tracerProvider: provider, | ||
instrumentations: [ | ||
new UserInteractionInstrumentation(), | ||
getWebAutoInstrumentations({ | ||
"@opentelemetry/instrumentation-fetch": { | ||
propagateTraceHeaderCorsUrls: /.*/, | ||
clearTimingResources: true, | ||
}, | ||
"@opentelemetry/instrumentation-user-interaction": { | ||
enabled: false, | ||
}, | ||
}), | ||
], | ||
}); | ||
sdk.start(); |