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 tracing suppresing for Metrics Export #3332

Merged
merged 20 commits into from
Oct 21, 2022

Conversation

hectorhdzg
Copy link
Member

Fixes #3331

@hectorhdzg hectorhdzg requested a review from a team October 13, 2022 22:35
@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

Merging #3332 (30a1dca) into main (bbc1811) will increase coverage by 0.14%.
The diff coverage is 84.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3332      +/-   ##
==========================================
+ Coverage   93.47%   93.61%   +0.14%     
==========================================
  Files         243      223      -20     
  Lines        7321     5828    -1493     
  Branches     1517     1171     -346     
==========================================
- Hits         6843     5456    -1387     
+ Misses        478      372     -106     
Impacted Files Coverage Δ
...y-sdk-trace-base/src/export/SimpleSpanProcessor.ts 83.33% <66.66%> (-7.98%) ⬇️
...etrics/src/export/PeriodicExportingMetricReader.ts 97.61% <100.00%> (+1.96%) ⬆️
...ckages/opentelemetry-core/src/internal/exporter.ts 100.00% <100.00%> (ø)
...ry-instrumentation-grpc/src/grpc-js/clientUtils.ts
...es/opentelemetry-instrumentation-http/src/utils.ts
...orter-metrics-otlp-proto/src/OTLPMetricExporter.ts
...grpc-exporter-base/src/OTLPGRPCExporterNodeBase.ts
...ental/packages/otlp-grpc-exporter-base/src/util.ts
...emetry-instrumentation-grpc/src/instrumentation.ts
...etry-sdk-node/src/TracerProviderWithEnvExporter.ts
... and 14 more

export(arg: T, resultCallback: (result: ExportResult) => void): void;
}

export function coreExport<T>(exporter: Exporter<T>, arg: T, resultCallback: (result: ExportResult) => void): void {
Copy link
Member

Choose a reason for hiding this comment

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

coreExport is sort of an odd name for a function in core I think. Also can you please add tsdocs since it is very non-obvious what this does to an outsider.

Copy link
Member

Choose a reason for hiding this comment

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

I worry a little bit about adding yet more API surface to the core module. I was hoping to eventually phase out the core module completely since it seems to just be a dumping ground for things. There also are other considerations beyond just suppressing tracing on export. We may for example want to suppress other signals like metrics.

Copy link
Member

Choose a reason for hiding this comment

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

We should have a dedicated module to share common snippets across SDK packages. I find the problem with the @opentelemetry/core is that the APIs that are supposed to be internal are exposed as public interfaces. Would it make sense to you to explicitly document this method as an internal interface so that we don't provide any API stability guarantees? Or should we create a new internal util package?

Copy link
Member

Choose a reason for hiding this comment

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

Seems like a reasonable compromise to document this as internal/unstable. IMO all of core should have been internal but it's too late for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added internal tsdoc, under score is usually added at the beginning of the name of the function, I'm not sure if you are using this pattern in this repo but let me know if that is a problem https://tsdoc.org/pages/tags/internal/
@dyladan is Metrics signal suppression already defined or implemented somewhere in OpenTelemetry?, trace suppression should make the generated Spans to be "not recording" ones, those should not be considered for metrics, Ex. HTTP duration metrics.

Copy link
Member

@legendecas legendecas Oct 17, 2022

Choose a reason for hiding this comment

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

Seems like a reasonable compromise to document this as internal/unstable. IMO all of core should have been internal but it's too late for that.

I don't think "all" of them are internal. I suppose APIs like CompositePropagator are public -- as there is no good place to export them.

@hectorhdzg
Copy link
Member Author

@dyladan @legendecas looks like this one is ready to merge, let me know if there is any concern. Thanks

@legendecas legendecas merged commit 292a53d into open-telemetry:main Oct 21, 2022
@legendecas
Copy link
Member

legendecas commented Oct 21, 2022

No, it's ready to go. Thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suppress tracing for Metrics Export
3 participants