Skip to content

Reserve already_shutdown as error.type value for SDK processor processed metrics#3710

Merged
lmolkova merged 8 commits into
open-telemetry:mainfrom
cijothomas:clarify-sdk-processor-error-type
Jun 1, 2026
Merged

Reserve already_shutdown as error.type value for SDK processor processed metrics#3710
lmolkova merged 8 commits into
open-telemetry:mainfrom
cijothomas:clarify-sdk-processor-error-type

Conversation

@cijothomas

@cijothomas cijothomas commented May 11, 2026

Copy link
Copy Markdown
Member

Reserves already_shutdown as an error.type value on otel.sdk.processor.span.processed and otel.sdk.processor.log.processed, used when a processor drops items because it has already been shut down. Applies to any SDK processor (not just batching).

Why the processor is the right place

TracerProvider.Shutdown only requires new GetTracer(...) calls to return a no-op; it doesn't invalidate pre-existing Tracers or affect in-flight Spans (span.End() calls SpanProcessor.OnEnd directly). SpanProcessor.Shutdown explicitly anticipates this: "subsequent calls to OnStart/OnEnd/ForceFlush are not allowed. SDKs SHOULD ignore these calls gracefully." So the drop is observed at the processor and recorded as error.type=already_shutdown.

Note: GetTracer(...) after shutdown returns a no-op Tracer — spans never enter the SDK, so no metric fires. Tracked as a follow-up.

Related:

@github-actions github-actions Bot added enhancement New feature or request area:otel labels May 11, 2026
@cijothomas cijothomas changed the title Clarify closed-set semantics of error.type for SDK processor metrics Reserve queue_full and already_shutdown as error.type values for SDK processor processed metrics May 11, 2026
@github-actions

Copy link
Copy Markdown

This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 7 days.

@github-actions github-actions Bot added the Stale label May 26, 2026
@cijothomas
cijothomas marked this pull request as ready for review May 26, 2026 19:03
@cijothomas
cijothomas requested review from a team as code owners May 26, 2026 19:03
@cijothomas cijothomas changed the title Reserve queue_full and already_shutdown as error.type values for SDK processor processed metrics Reserve already_shutdown as error.type value for SDK processor processed metrics May 26, 2026
@github-actions github-actions Bot removed the Stale label May 27, 2026
@pellared

Copy link
Copy Markdown
Member

CC @dashpole

@pellared

Copy link
Copy Markdown
Member

It would be nice to have a PR with a prototype. Wouldn't the SDK itself also need such metric as some spans/logs may not even start being processed given the SDK was shutdown?

@cijothomas

Copy link
Copy Markdown
Member Author

It would be nice to have a PR with a prototype. Wouldn't the SDK itself also need such metric as some spans/logs may not even start being processed given the SDK was shutdown?

open-telemetry/opentelemetry-rust#3514

Is there a concept of shutting down an SDK? We have shutdown on each providers (which bubble it through to processors and exporters..), but there is nothing called sdk.shutdown. Can you clarify what is meant by SDK shutdown?

@pellared

Copy link
Copy Markdown
Member

We have shutdown on each providers (which bubble it through to processors and exporters..), but there is nothing called sdk.shutdown. Can you clarify what is meant by SDK shutdown?

I meant provider shutdown.

@cijothomas

Copy link
Copy Markdown
Member Author

We have shutdown on each providers (which bubble it through to processors and exporters..), but there is nothing called sdk.shutdown. Can you clarify what is meant by SDK shutdown?

I meant provider shutdown.

Got it. This part is already covered by spec. If a provider is shutdown, then new getTracer() returns noop, but existing tracers would pass the spans/logs to the processor. And processor spec says it should gracefully ignore these calls. So processor would be the most apt component to emit this metric.

@cijothomas

Copy link
Copy Markdown
Member Author

We have shutdown on each providers (which bubble it through to processors and exporters..), but there is nothing called sdk.shutdown. Can you clarify what is meant by SDK shutdown?

I meant provider shutdown.

Got it. This part is already covered by spec. If a provider is shutdown, then new getTracer() returns noop, but existing tracers would pass the spans/logs to the processor. And processor spec says it should gracefully ignore these calls. So processor would be the most apt component to emit this metric.

There is another gap you helped me realize! if provider.GetTracer(...) is called after shutdown — spec says return a no-op Tracer, so spans never enter the SDK and no existing metric fires. A good fix to bring visibility into that is probably a separate, small follow-up: a counter on the provider (e.g., otel.sdk.tracer.created with error.type=already_shutdown) so users get a signal when GetTracer returns no-op post-shutdown. Its good to be followed up, I'll open a tracking issue.

@dashpole dashpole left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall, this error type seems reasonable. I'm a bit concerned that our description for the error.type field in sdk telemetry will be really long if we enumerate all of the errors. But we can cross that bridge when we get there.

Comment thread model/otel/metrics.yaml Outdated
@lmolkova lmolkova moved this from Untriaged to Needs More Approval in Semantic Conventions Triage May 28, 2026
@lmolkova lmolkova moved this from Needs More Approval to Ready to be Merged in Semantic Conventions Triage May 28, 2026
@cijothomas

Copy link
Copy Markdown
Member Author

@JonasKunz Could you review?

@github-project-automation github-project-automation Bot moved this from Ready to be Merged to Needs More Approval in Semantic Conventions Triage Jun 1, 2026
@trask trask moved this from Needs More Approval to Ready to be Merged in Semantic Conventions Triage Jun 1, 2026
@lmolkova
lmolkova added this pull request to the merge queue Jun 1, 2026
Merged via the queue into open-telemetry:main with commit b517903 Jun 1, 2026
18 checks passed
pull Bot pushed a commit to MC-MAGA/opentelemetry-specification that referenced this pull request Jun 2, 2026
…en-telemetry#5087)

Adds an in-development Self-Observability.md document and SDK-level
Self-observability sections in the Tracing and Logs SDK specs that point
to it. The Self-Observability document defers to the OpenTelemetry
semantic conventions for SDK self-observability metric names,
attributes, and values.

This is step 1 of defining self-observability as part of the spec
itself; follow-ups can extend it (e.g., exporter metrics, reader
metrics, self-logs, self-events) under the same umbrella.

Companion PR in semantic-conventions reserving the `error.type` values
(`queue_full`, `already_shutdown`):
open-telemetry/semantic-conventions#3710.

Resolves open-telemetry#5086.

---------

Co-authored-by: David Ashpole <dashpole@google.com>
dashpole added a commit to dashpole/opentelemetry-specification that referenced this pull request Jun 8, 2026
…en-telemetry#5087)

Adds an in-development Self-Observability.md document and SDK-level
Self-observability sections in the Tracing and Logs SDK specs that point
to it. The Self-Observability document defers to the OpenTelemetry
semantic conventions for SDK self-observability metric names,
attributes, and values.

This is step 1 of defining self-observability as part of the spec
itself; follow-ups can extend it (e.g., exporter metrics, reader
metrics, self-logs, self-events) under the same umbrella.

Companion PR in semantic-conventions reserving the `error.type` values
(`queue_full`, `already_shutdown`):
open-telemetry/semantic-conventions#3710.

Resolves open-telemetry#5086.

---------

Co-authored-by: David Ashpole <dashpole@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:otel enhancement New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants