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

Fix stackdriver resources #149

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

valkum
Copy link
Contributor

@valkum valkum commented Jan 10, 2025

Fixes #
Design discussion issue (if applicable) #

Changes

While preparing for a new opentelemtry-stackdriver release and updating the dependencies it seems a bug was introduced.
The new API stores resource attributes directly in the exporter. By adding this two instances of RwLock<Resource> were introduced, making it impossible to set the resource (using set_resource) as the ExporterContext uses a different pointer.

This fixes the issue and also updates resource attribute key mappings to the latest version (added k8s mappings and removed outdated service.name mapping).

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Adds newly added k8s related resource mappings
The key was removed from https://cloud.google.com/trace/docs/trace-labels and the UI says
the service name is not derived from service.name which is also the semconv key.
The new API requires one to use set_resource for each exporter.
The added set_resource for the stackdriver exporter used a different Arc
than used inside each ExporterContext.
The resource stored in ExporterContext is used during the request creation,
and thus there was no way to pass along the correct resource attributes.
@valkum valkum requested a review from a team as a code owner January 10, 2025 19:07
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.

Project coverage is 54.1%. Comparing base (0b253eb) to head (b950e35).

Files with missing lines Patch % Lines
opentelemetry-stackdriver/src/lib.rs 57.1% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #149     +/-   ##
=======================================
- Coverage   54.2%   54.1%   -0.1%     
=======================================
  Files         42      42             
  Lines       6276    6271      -5     
=======================================
- Hits        3402    3397      -5     
  Misses      2874    2874             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant