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: flatten ValueTypeSlice to ValueTypeString #831

Merged

Conversation

crossk3
Copy link
Contributor

@crossk3 crossk3 commented Apr 12, 2024

👋

While working with the OpenTelemetry stack for Python as well as an OpenTelemetry Collector (Cloud Run Sidecar, per docs here), I noticed a discrepancy in behavior.

GCP Cloud Trace doesn't support Slice/Array data types for Trace Attributes, which Python's CloudTraceSpanExporter handles by flattening Slices to Strings. However, the golang Collector Exporter currently silently drops any Slice[T] attribute. This results in some oddities when choosing how to send traces to GCP Cloud Trace, where any time a collector exports to GCP Cloud Trace you silently lose attributes you would otherwise receive in Cloud Trace.

This PR attempts to unify this behavior, so that the same behavior is observed whether using the in-process exporter or the googlecloud Collector exporter.

@crossk3 crossk3 requested a review from a team as a code owner April 12, 2024 15:55
@dashpole
Copy link
Contributor

Thanks for finding this @crossk3!

@crossk3
Copy link
Contributor Author

crossk3 commented Apr 22, 2024

@dashpole updated to use json.Marshal 🙂

@dashpole
Copy link
Contributor

/gcbrun

exporter/collector/spandata_test.go Outdated Show resolved Hide resolved
exporter/collector/spandata_test.go Outdated Show resolved Hide resolved
Co-authored-by: David Ashpole <dashpole@google.com>
Signed-off-by: Keaton Cross <keatoncross6@gmail.com>
@dashpole
Copy link
Contributor

/gcbrun

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.30%. Comparing base (4caace7) to head (542da19).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #831      +/-   ##
==========================================
+ Coverage   61.03%   62.30%   +1.26%     
==========================================
  Files          56       56              
  Lines        5903     4892    -1011     
==========================================
- Hits         3603     3048     -555     
+ Misses       2143     1687     -456     
  Partials      157      157              

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

@dashpole
Copy link
Contributor

Ah, you will need to run make fixtures to regenerate the test files.

@crossk3
Copy link
Contributor Author

crossk3 commented Apr 23, 2024

Ah, you will need to run make fixtures to regenerate the test files.

@dashpole done!

@dashpole
Copy link
Contributor

/gcbrun

@dashpole dashpole merged commit fd38e34 into GoogleCloudPlatform:main Apr 23, 2024
32 checks passed
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

2 participants