-
Notifications
You must be signed in to change notification settings - Fork 477
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
[instrumentation-document-load] option to ignore resource spans #2284
Comments
We are working on a new set of instrumentations using the new Events API, one of which is to emit ResourceTiming events for the resources loaded (#2152), and another to emit PageView event (open-telemetry/opentelemetry-sandbox-web-js#81). As part of this effort, I envision an instrumentation to emit a standalone documentFetch span. We have not created an issue yet to track this as this hasn't been discussed much in the Client SIG. For your use-case does it work if you configure a custom sampler to drop these spans? |
@scheler thanks for the status update and a workaround! I think that could be sufficient. Do you know of a sampler that could be a good starting point? I have not done one of those before. |
@longility something like this - const provider = new WebTracerProvider({
resource,
sampler: {
shouldSample: (context, traceId, spanName, spanKind, attributes, links) => {
return spanName == 'resourceFetch' ? SamplingDecision.NOT_RECORD : SamplingDecision.RECORD_AND_SAMPLED;
}
}
}); |
@longility can you close this issue if the workaround works for you? |
If this is acceptable, I can do a PR to expedite our needs and contribute for others to leverage as well.
Is your feature request related to a problem? Please describe
I would like to minimize the number of spans created that may not be important to us, specifically resource spans.
Describe the solution you'd like to see
For this line,
opentelemetry-js-contrib/plugins/web/opentelemetry-instrumentation-document-load/src/instrumentation.ts
Line 138 in 2dc2f72
to be similar to this:
https://github.com/open-telemetry/opentelemetry-js-contrib/blob/2dc2f72e5a86aa9e1220a26f78878070acde8424/plugins/web/opentelemetry-instrumentation-document-load/src/instrumentation.ts#L160C7-L162C8
to where the end result may look something like this:
Describe alternatives you've considered
None.
Additional context
None.
The text was updated successfully, but these errors were encountered: