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

Use the same prometheus registry for both oc and otel exporters #6297

Merged

Conversation

paivagustavo
Copy link
Member

@paivagustavo paivagustavo commented Oct 13, 2022

Description: Use the same prometheus.Registry for both OC and OTel SDK exporters.

Link to tracking Issue: #5687

Testing: Added unit test and did some manual tests with and without the featuregate to ensure that nothing is broken.

Documentation: The observed difference between both exporters is how they export Resource Attributes. OpenCensus appends resource attributes to all metrics while OpenTelemetry advocates for the use of an additional target_info metric which contains all resource attributes and other metrics are only appended with job and instance which can be derived from the service.name, service.namespace, and service.instance.id attributes.

OTel-Go doesn't implement the target_info yet, but I've added some notes and TODOs to track those.

service/telemetry.go Outdated Show resolved Hide resolved
@paivagustavo paivagustavo force-pushed the gustavo/share-prometheus-registry branch from 3cb6c6e to d70fae4 Compare October 13, 2022 02:07
@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

Base: 92.03% // Head: 91.97% // Decreases project coverage by -0.05% ⚠️

Coverage data is based on head (cc3c299) compared to base (a9f41a2).
Patch coverage: 75.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6297      +/-   ##
==========================================
- Coverage   92.03%   91.97%   -0.06%     
==========================================
  Files         218      219       +1     
  Lines       13203    13242      +39     
==========================================
+ Hits        12151    12179      +28     
- Misses        832      840       +8     
- Partials      220      223       +3     
Impacted Files Coverage Δ
service/telemetry.go 87.57% <75.00%> (-1.46%) ⬇️
service/service.go 69.44% <0.00%> (-1.99%) ⬇️
pdata/plog/logs.go 96.00% <0.00%> (ø)
confmap/resolver.go 98.13% <0.00%> (ø)
pdata/pmetric/metrics.go 100.00% <0.00%> (ø)
pdata/plog/plogotlp/logs.go 51.06% <0.00%> (ø)
pdata/pcommon/trace_state.go 100.00% <0.00%> (ø)
pdata/ptrace/ptraceotlp/traces.go 51.06% <0.00%> (ø)
pdata/pmetric/pmetricotlp/metrics.go 55.81% <0.00%> (ø)
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bogdandrutu
Copy link
Member

Please update descriptions, and add some unit tests

@paivagustavo paivagustavo marked this pull request as ready for review October 13, 2022 16:45
@paivagustavo paivagustavo requested review from a team and jpkrohling October 13, 2022 16:45
@paivagustavo
Copy link
Member Author

@bogdandrutu I've added some unit tests, not sure if that was the best place, open for suggestions if you have any.

Also documented on the tests the differences between how both SDK exports Resource attributes. I'm not sure what is the best way for us to document this public-wise, since it can be considered as a breaking change for some.

@paivagustavo paivagustavo changed the title draft: share prometheus registry between oc and otel exporters Use the same prometheus registry for both oc and otel exporters Oct 13, 2022
@bogdandrutu
Copy link
Member

I would prefer proper unittests, I know we have some kind of "integration" tests there, but they are actually complicated and hard to follow. I would rather remove them and have proper unit-tests.

service/telemetry_test.go Outdated Show resolved Hide resolved
service/telemetry_test.go Outdated Show resolved Hide resolved
service/telemetry_test.go Show resolved Hide resolved
Co-authored-by: Bogdan Drutu <lazy@splunk.com>
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.

2 participants