chore: decouple opentelemetry-proto from opentelemetry-sdk#3512
chore: decouple opentelemetry-proto from opentelemetry-sdk#3512scottgerring wants to merge 7 commits into
Conversation
|
@lalitb I know you've worked on this before; it would be great to get your high-level opinions on this so I can push it in the right direction. I'm not sure if i've missed some important nuance given this has come up a few times but never landed! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3512 +/- ##
=======================================
+ Coverage 82.8% 83.0% +0.1%
=======================================
Files 130 129 -1
Lines 27289 27229 -60
=======================================
- Hits 22622 22614 -8
+ Misses 4667 4615 -52 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
803374d to
4985d5c
Compare
4985d5c to
ec5443d
Compare
|
|
||
| fn set_resource(&mut self, resource: &opentelemetry_sdk::Resource) { | ||
| self.resource = resource.into(); | ||
| self.resource = |
There was a problem hiding this comment.
More of a style suggestion. But I wonder if it would be better to package this as a extension trait against SDK resource, instead of resource_to_attributes_with_schema function
There was a problem hiding this comment.
@TommyCpp thanks for taking a look, and good point!
I think this conversion is one of the few places where a method-style API could be reasonable, since it’s a high-level boundary used directly by the exporters.
That said, I’m a bit hesitant to make it look like an operation that inherently belongs on Resource: this is really an OTLP/proto-specific projection of a Resource, including how we carry the schema URL alongside attributes. Since we already have a local target type here, From<&Resource> gives us a short call site without adding an extension trait or implying this is a general Resource capability; maybe something like this? -->
| self.resource = | |
| self.resource = resource.into(); |
For the broader transform module I’d probably keep the explicit *_to_proto functions, since most are lower-level implementation details or external-to-external mappings where From isn’t available due to orphan rules.
|
Thank you for your contribution! This PR has been automatically marked as stale because it has not had activity in the last 14 days. This may be due to a delay in review on our side or awaiting a response from you; either is fine, and we appreciate your patience. It will be closed in 14 days if no further activity occurs. Pushing a new commit or leaving a comment will remove the stale label and keep the PR open. |
|
This isn't stale, it just needs a review :D |
|
@lalitb Can you review this one? |
|
Thank you for your contribution! This PR has been automatically marked as stale because it has not had activity in the last 14 days. This may be due to a delay in review on our side or awaiting a response from you; either is fine, and we appreciate your patience. It will be closed in 14 days if no further activity occurs. Pushing a new commit or leaving a comment will remove the stale label and keep the PR open. |
|
@lalitb do you have time to look at this? |
Summary
This refactors
opentelemetry-protoso it only contains generated OTLP protobuf types. The diff is substantial because of the orphan rules - opentelemetry-otlp cannot implement the conversion traits for foreign types into foreign types. My feeling is that we just need to pull off the bandaid here!The SDK/api-aware transform helpers have been moved into
opentelemetry-otlp, where they are used by the exporters. This removes the directopentelemetry/opentelemetry_sdkdependency fromopentelemetry-protoand makes the crate usable by consumers that only need OTLP wire-format types. This will also provide other options to structure changes like #3460 , where we could benefit from having the dependency the other way around (although this is by no means a done deal).Changes
opentelemetry_proto::transformmodule.opentelemetry-otlp::transformmodule.opentelemetry-protodocs and changelog to describe the crate as generated protobuf types only.Prior art / related work
This implements the SDK-decoupling part of:
prostfrom OTLP/JSON #3419 / feat: Decouple prost from otlp json #3451 - adjacent work to reduce unnecessary proto/exporter dependencies for OTLP JSON/prost usage