Skip to content

Conversation

JonasKunz
Copy link
Contributor

Implements the new semantic conventions SDK health metrics for span processors:

  • otel.sdk.processor.span.processed for both the SimpleSpanProcessor and BatchingSpanProcessor
  • otel.sdk.processor.span.queue.size for BatchingSpanProcessor
  • otel.sdk.processor.span.queue.capacity for BatchingSpanProcessor

The metrics are opt-in at the moment and can be enabled via the builders of the processors.
Support for the legacy metrics exposed by the BatchingSpanProcessor is kept. Those are disabled by default too (default MeterProvider is noop) and can be enabled using the same API usage as before (= by providing a MeterProvider).

Copy link

codecov bot commented Jun 24, 2025

Codecov Report

Attention: Patch coverage is 89.26554% with 19 lines in your changes missing coverage. Please review.

Project coverage is 89.76%. Comparing base (0ca502b) to head (4b6cf93).

Files with missing lines Patch % Lines
...ernal/metrics/LegacyBatchSpanProcessorMetrics.java 89.09% 3 Missing and 3 partials ⚠️
.../internal/metrics/SemConvSpanProcessorMetrics.java 90.62% 2 Missing and 4 partials ⚠️
...k/trace/internal/metrics/SpanProcessorMetrics.java 63.63% 2 Missing and 2 partials ⚠️
...ace/internal/metrics/NoopSpanProcessorMetrics.java 50.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7441      +/-   ##
============================================
- Coverage     89.77%   89.76%   -0.02%     
- Complexity     6994     7032      +38     
============================================
  Files           798      802       +4     
  Lines         21200    21335     +135     
  Branches       2058     2070      +12     
============================================
+ Hits          19033    19152     +119     
- Misses         1503     1511       +8     
- Partials        664      672       +8     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JonasKunz JonasKunz marked this pull request as ready for review June 24, 2025 12:09
@JonasKunz JonasKunz requested a review from a team as a code owner June 24, 2025 12:09
Copy link
Member

@zeitlinger zeitlinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good - there are merge conflicts though

@JonasKunz
Copy link
Contributor Author

I'd like to wait with this one until #7430 is approved. Pretty sure there will be review remarks which also apply to this one.

* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public enum ExporterType implements StandardType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I implement my own exporters? What should I use here?... The same enum values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First thing you need to decide is if you want your exporter to support the semantic conventions health metrics, e.g. otel.sdk.exporter.span.exported.

If yes, then if you are okay with breaking changes across SDK versions you could use the SemConvExporterMetrics abstraction to record the metrics. Otherwise you'd have to provide your own implementation.

You certainly shouldn't use ExporterType, which are like reserved names for the built-in OTLP exporters.
SemConvExporterMetrics requires a ComponentId, which you can create with a component name of your liking. See the semantic conventions definitions.

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.

3 participants