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

Browser tracing without Metrics #3016

Closed
jjhuff opened this issue Jun 2, 2022 · 5 comments
Closed

Browser tracing without Metrics #3016

jjhuff opened this issue Jun 2, 2022 · 5 comments
Labels
priority:p4 Bugs and spec inconsistencies which do not fall into a higher prioritization

Comments

@jjhuff
Copy link

jjhuff commented Jun 2, 2022

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

1.3.0/0.29.1

Please provide the code you used to setup the OpenTelemetry SDK

  const exporter = new OTLPTraceExporter({url: endpoint, });
  const provider = new WebTracerProvider({
    resource: new Resource({
      [SemanticResourceAttributes.SERVICE_NAME]: 'browser',
    }),
  });
  processor = new SpanAttributesProcessor();
  provider.addSpanProcessor(new BatchSpanProcessor(exporter));
  provider.register({
    contextManager: new ZoneContextManager(),
  });

What did you expect to see?/What did you see instead?

OTLPTraceExporter ends up pulling sdk-metrics-base into the bundle -- even though I'm not using metrics.
Ends up adding an extra 50KB in my bundle.

@jjhuff jjhuff added the bug Something isn't working label Jun 2, 2022
@legendecas
Copy link
Member

The problem here is that @opentelemetry/otlp-transformer depends on @opentelemetry/sdk-metrics-base. We have efforts on this, like #2973. However, with tree-shaking, it is supposed to add no additional bundle size if the metrics part is not used at all.

@jjhuff
Copy link
Author

jjhuff commented Jun 8, 2022

However, with tree-shaking, it is supposed to add no additional bundle size if the metrics part is not used at all.

I think the problem comes when otlp-transformer does this:

export { createExportTraceServiceRequest } from './trace';
export { createExportMetricsServiceRequest } from './metrics';

without sideEffects being set, bundlers like WebPack will be forced to include the import from ./metrics. Alternatively, I suppose, consumers of this package could import directly from /trace or /metrics as needed.

@pichlermarc
Copy link
Member

pichlermarc commented Jun 13, 2022

This is related to #2855 it seems. We agreed in the last SIG meeting to correctly set sideEffects to resolve this. However, we currently do not have anyone who is actively working on this, so help would be greatly appreciated. 🙂

@dyladan dyladan added priority:p4 Bugs and spec inconsistencies which do not fall into a higher prioritization and removed bug Something isn't working labels Jun 28, 2022
@dyladan
Copy link
Member

dyladan commented Jun 28, 2022

Removing the bug label since this is not really a bug, but a requested enhancement.

@dyladan
Copy link
Member

dyladan commented Jun 28, 2022

I am going to close this as it is covered by #2855. Please put your +1 there

@dyladan dyladan closed this as completed Jun 28, 2022
Repository owner moved this from Icebox to Done in Spec: Client SDK and Instrumentation Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p4 Bugs and spec inconsistencies which do not fall into a higher prioritization
Development

No branches or pull requests

4 participants