Add public constructors to metrics data types and make SdkLogRecord::…#3457
Add public constructors to metrics data types and make SdkLogRecord::…#3457mdecimus wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3457 +/- ##
=======================================
- Coverage 83.2% 82.9% -0.4%
=======================================
Files 128 128
Lines 25048 25147 +99
=======================================
Hits 20860 20860
- Misses 4188 4287 +99 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hey @mdecimus !
I think the first point could be raised easily as a standalone PR if you are still interested in this! To the second two points to provide some more context for you, we are very cautious of expanding public API; it would be great to work through the reasoning for this on the linked issue. Depending on where that lands we'd probably also ask to break out the |
|
Thanks for the review @scottgerring! To give some context: Stalwart Mail Server has its own telemetry collector that aggregates spans, logs, and metrics from across the codebase using a custom event system. We don't use
This means we're a downstream consumer of the SDK types without using the SDK's processors, which is why we hit these construction limitations. Regarding Regarding the metrics constructors: since 0.30 made Regarding the error handler: this isn't included in this PR. Adding it back cleanly would mean threading a global callback through the Happy to split this into two PRs (one for |
Fixes #2992
Changes
Stalwart Mail Server uses its own metrics collector and export pipeline rather than the SDK's periodic reader. Since 0.30 made all fields on metrics data types
pub(crate), it's no longer possible to constructMetric,Sum,Gauge,Histogram,ResourceMetrics,ScopeMetrics, or their data points from outside the crate. This addsnew()constructors to each type so that custom exporters can buildResourceMetricsto pass toPushMetricExporter::export().Similarly,
SdkLogRecord::new()is made public andDefaultis implemented, so consumers with custom logging backends can create log records directly without having to instantiate aSdkLoggerProvider.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changesSdkLogRecord::newpublic again #2992 comments)