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

Only attach instrumentation scope/service labels when non-empty #613

Merged
merged 12 commits into from
Mar 20, 2023

Conversation

damemi
Copy link
Contributor

@damemi damemi commented Mar 14, 2023

Fixes #377

This updates the metrics and traces exporters (for SDK and collector) to only attach instrumentation library labels to GCP if those labels are non-empty as otel attributes. This applies even if the option to include instrumentation library labels is set to true.

This also updates the metrics, traces, and logs exporters to do the same for service labels (also even if the service labels option is set to true).


This PR also makes updates to tests to prevent 2 tests overwriting each others' fixtures.

tl;dr I spent way too much time digging through Go internals, proto marshalling, and gzip libraries before I realized that the gzip test added in #576 overwrote another test's fixture. This prevented me from reproducing the bug's behavior. Now make fixtures will fail if it sees 2 tests writing to the same output fixture.

exporter/collector/metrics.go Outdated Show resolved Hide resolved
droppedMessageEvents: int(span.DroppedEventsCount()),
droppedLinks: int(span.DroppedLinksCount()),
resource: r,
instrumentationLibrary: instrumentationScopeLabels(is),
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider renaming this field to instrumentationScope in a separate PR.

@damemi damemi changed the title (metrics/logs) Only attach instrumentation scope/service labels when non-empty Only attach instrumentation scope/service labels when non-empty Mar 14, 2023
@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Merging #613 (b1f1526) into main (f1aae84) will decrease coverage by 0.02%.
The diff coverage is 64.70%.

@@            Coverage Diff             @@
##             main     #613      +/-   ##
==========================================
- Coverage   63.37%   63.36%   -0.02%     
==========================================
  Files          38       38              
  Lines        4409     4446      +37     
==========================================
+ Hits         2794     2817      +23     
- Misses       1491     1504      +13     
- Partials      124      125       +1     
Impacted Files Coverage Δ
...llector/integrationtest/cmd/recordfixtures/main.go 0.00% <0.00%> (ø)
...lector/integrationtest/testcases/testcases_logs.go 100.00% <ø> (ø)
exporter/collector/spandata.go 87.12% <89.65%> (-1.22%) ⬇️
...tor/integrationtest/testcases/testcases_metrics.go 100.00% <100.00%> (ø)
exporter/collector/metrics.go 67.29% <100.00%> (+0.21%) ⬆️
exporter/collector/monitoredresource.go 100.00% <100.00%> (ø)
exporter/metric/option.go 64.70% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@damemi damemi merged commit e9bb597 into GoogleCloudPlatform:main Mar 20, 2023
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.

Only attach instrumentation scope when it is non-empty
3 participants