-
Notifications
You must be signed in to change notification settings - Fork 515
feat(otlp): Re-export tonic crate #2898
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
base: main
Are you sure you want to change the base?
feat(otlp): Re-export tonic crate #2898
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2898 +/- ##
=====================================
Coverage 81.3% 81.3%
=====================================
Files 126 126
Lines 24254 24254
=====================================
+ Hits 19736 19737 +1
+ Misses 4518 4517 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@MathieuTricoire Re-exporting the whole tonic crate works, but it exposes all of tonic’s API as part of our public API. If we only need a few types (like |
@lalitb Thanks for the answer! That makes sense, and I'm totally good with cherry-picking. I actually thought about that, but I didn't want to overthink it right away if not necessary. Going cherry-picking route, I see two options: Flat re-export: #[cfg(feature = "grpc-tonic")]
pub mod tonic_types {
#[doc(no_inline)]
pub use tonic::metadata::MetadataMap;
#[doc(no_inline)]
#[cfg(feature = "tls")]
pub use tonic::transport::{Certificate, ClientTlsConfig, Identity};
} Grouped by module: #[cfg(feature = "grpc-tonic")]
pub mod tonic_types {
pub mod metadata {
#[doc(no_inline)]
pub use tonic::metadata::MetadataMap;
}
#[cfg(feature = "tls")]
pub mod transport {
#[doc(no_inline)]
pub use tonic::transport::{Certificate, ClientTlsConfig, Identity};
}
} I kind of like the module-based one, feels cleaner and easier to extend later to me, but maybe over-engineered? Happy to go with whichever makes more sense for you. Also wondering what you think about the naming, would Also are you ok with the current re-export scope? Let me know what direction you'd prefer and I'll adjust the PR 👍 |
I pushed the grouped by module proposal, let me know your thoughts. |
thanks @MathieuTricoire - I agree - the module-based structure feels cleaner and more future-proof, especially if we add more exports later. So let's go with that. |
Fixes #882
Design discussion issue
I chose to re-export the entire
tonic
crate instead of cherry-picking types to avoid maintenance overhead. The re-export is gated behind thegrpc-tonic
feature.Let me know your thoughts if re-exporting the whole
tonic
crate is too much and how we should tackle this in this situation.Changes
Re-exports the entire
tonic
crate from theopentelemetry-otlp
crate, to allows downstream crates to usetonic
types (such asMetadataMap
) compatible withopentelemetry-otlp
without needing to manually match the internaltonic
version.Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes