Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add imports to instrumentations example in browser usage docs #5710

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gilisho
Copy link

@gilisho gilisho commented Dec 1, 2024

Fixes #4951.

This PR adds missing imports in docs example. As a OTEL beginner, the instrumentation libraries that should be installed are not trivial. I've added these imports as a small improvement to the docs.

@gilisho gilisho requested a review from a team as a code owner December 1, 2024 07:03
Copy link

linux-foundation-easycla bot commented Dec 1, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@opentelemetrybot opentelemetrybot requested a review from a team December 1, 2024 07:04
@tiffany76
Copy link
Contributor

Thanks, @gilisho!

@open-telemetry/javascript-approvers, PTAL.

registerInstrumentations({
instrumentations: [
new DocumentLoadInstrumentation(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding this was not agreed on over at #4951, right?

Comment on lines +263 to +270
const provider = new WebTracerProvider({
spanProcessors: [new SimpleSpanProcessor(new ConsoleSpanExporter())],
});

provider.register({
// Changing default contextManager to use ZoneContextManager - supports asynchronous operations - optional
contextManager: new ZoneContextManager(),
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is already explained above, should we duplicate the setup?

Comment on lines +252 to +258
import {
ConsoleSpanExporter,
SimpleSpanProcessor,
} from '@opentelemetry/sdk-trace-base';
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { DocumentLoadInstrumentation } from '@opentelemetry/instrumentation-document-load';
import { ZoneContextManager } from '@opentelemetry/context-zone';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't do the duplicate setup then this can also be removed.

@svrnm
Copy link
Member

svrnm commented Dec 18, 2024

@gilisho can you take a look at the provided feedback? TY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

unclear where UserInteractionInstrumentation and XMLHttpRequestInstrumentation should be imported from.
4 participants