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

[Otlp] Make sure Otlp trace and metric exporters have dedicated options instances #4200

Merged
merged 2 commits into from
Feb 16, 2023

Conversation

CodeBlanch
Copy link
Member

@CodeBlanch CodeBlanch commented Feb 16, 2023

Relates to #4043
Relates to #4058

Changes

  • This is a little deeper fix than what I did on [OtlpExporter] Registration extension configuration delegate fix #4058. Previously we still modified a single instance. For things like endpoint which are being set each time it isn't a problem. But considering a property like PersistentBlobProvider being added on [metrics branch] Add configuration of persistent storage to OTLP Exporter #4121 if it is set for traces, metrics would inherit it unless it was cleared or set to something else. We could run into hard to detect and subtle bugs. To make it work nicely without needing some mechanism to "reset" options back to default, I decided to just make sure we new up a new instance when building the processor/exporter. The best fix would be to have dedicated classes (eg OtlpTraceExporterOptions & OtlpMetricExporterOptions) but hard to do without breaking things. @alanwest had the idea to introduce those and clean this up when we split up the projects.

Example which works fine without this change:

.WithTraces({
  endpoint = traceEndpoint
})
.WithMetrics({
  endpoint = metricEndpoint
})

Example which will be bugged without this change:

.WithTraces({
  endpoint = traceEndpoint
})
.WithMetrics({
  headers = metricHeaders
})

That second example depending on whether TracerProvider or MeterProvider is started first, either trace will have metricHeaders or metrics will have traceEndpoint.

@CodeBlanch CodeBlanch requested a review from a team as a code owner February 16, 2023 20:42
@codecov
Copy link

codecov bot commented Feb 16, 2023

Codecov Report

Merging #4200 (7d271bf) into main (d0829ff) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4200      +/-   ##
==========================================
+ Coverage   85.51%   85.53%   +0.01%     
==========================================
  Files         291      291              
  Lines       11380    11398      +18     
==========================================
+ Hits         9732     9749      +17     
- Misses       1648     1649       +1     
Impacted Files Coverage Δ
...nTelemetryProtocol/OtlpMetricExporterExtensions.cs 96.96% <100.00%> (+0.47%) ⬆️
...metryProtocol/OtlpTraceExporterHelperExtensions.cs 96.66% <100.00%> (+0.58%) ⬆️
...ter.ZPages/Implementation/ZPagesActivityTracker.cs 97.14% <0.00%> (-2.86%) ⬇️

Copy link
Member

@alanwest alanwest left a comment

Choose a reason for hiding this comment

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

good catch

@CodeBlanch CodeBlanch merged commit 7139c7a into open-telemetry:main Feb 16, 2023
@CodeBlanch CodeBlanch deleted the otlp-options-fix branch February 16, 2023 22:04
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.

None yet

3 participants