Skip to content

Add support for OTEL_SEMCONV_STABILITY_OPT_IN (#492)#519

Merged
jack-berg merged 21 commits intoopen-telemetry:mainfrom
zeitlinger:semconv-opt-in
Feb 27, 2026
Merged

Add support for OTEL_SEMCONV_STABILITY_OPT_IN (#492)#519
jack-berg merged 21 commits intoopen-telemetry:mainfrom
zeitlinger:semconv-opt-in

Conversation

@zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Jan 28, 2026

Adds declarative configuration for semantic convention version selection, aligned with semantic-conventions#3424.

Configuration

Per-domain semconv config (semconv object)

Under .instrumentation/development.general.<domain>.semconv, supports:

  • version (integer) — target semconv version (e.g., 1)
  • experimental (boolean) — use experimental conventions
  • dual_emit (boolean) — also emit the previous stable major version

Domains: code, db, gen_ai, http, k8s, messaging, rpc

Env var compatibility (stability_opt_in_list)

A comma-separated string at .instrumentation/development.general.stability_opt_in_list follows the format of OTEL_SEMCONV_STABILITY_OPT_IN. Domain-specific semconv properties take precedence.

Fixes #492

@zeitlinger zeitlinger requested a review from a team as a code owner January 28, 2026 12:13
Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Couple of minor comments, but I like it!

cc @open-telemetry/specs-semconv-approvers please take a look and confirm this makes sense.

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

could also make sense to scope somehow under

instrumentation/development:
  general:
    http:
    database:
    rpc:

@jack-berg
Copy link
Member

could also make sense to scope somehow under

Yeah, adopt a convention to nest a standard stability level property under each instrumentation domain type, like:

instrumetnation/development:
  general:
    http:
      stability_opt_in:
    database:
      stability_opt_in:
    rpc:
      stability_opt_in:

@jack-berg
Copy link
Member

Actually, neither of these approaches is compatible with env var substitution of the equivalent OTEL_SEMCONV_STABILITY_OPT_IN:

instrumentation/development:
  general:
    # this doesn't work because on primitive types are candidates for substitution and this property is an array
    semconv_stability_opt_in: ${OTEL_SEMCONV_STABILITY_OPT_IN} 
---
instrumentation/development:
  general:
    http:
      # this doesn't work because the property would expect a single value while the env var is a comma separated list
      stability_opt_in: ${OTEL_SEMCONV_STABILITY_OPT_IN} 

We have schema modeling guidance that allows us to have alternative versions to accommodate env var compatibility:

In instances where there is a type mismatch between the JSON schema and equivalent standard env var, an alternative version of the property may be provided to resolve the mismatch.

Applied here, I think that would look something like:

instrumentation/development:
  general:
    # comma separated list string following format and semantics of OTEL_SEMCONV_STABILITY_OPT_IN
    stability_opt_in_list: ${OTEL_SEMCONV_STABILITY_OPT_IN}
    http:
      stability_opt_in: stable

With some well defined merge mechanic between .instrumentation/development.general.stability_opt_in_list and .instrumentation/development.general.http.stability_opt_in.

@zeitlinger
Copy link
Member Author

@jack-berg please check again

@lmolkova
Copy link
Member

lmolkova commented Feb 5, 2026

JFYI similar config in collector - https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/semconv-feature-gates.md

  • receiver.hostmetrics.EmitV1ProcessConventions
  • receiver.hostmetrics.DontEmitV0ProcessConventions

/cc @mx-psi

Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Mostly nits at this point.

This is exciting - I think we're accidentally (or maybe not) making progress towards stable by default since according to this schema, by default only stable instrumentation is produced.

Adds semconv_stability_opt_in configuration to instrumentation.general
to control semantic convention stability migration. Supports http,
database, and rpc signals with optional /dup mode for phased migration.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
- Replace array-based semconv_stability_opt_in with string-based
  stability_opt_in_list for env var substitution compatibility
- Add domain-specific stability_opt_in properties under http, database,
  rpc, and messaging instrumentation sections
- Add ExperimentalDatabaseInstrumentation, ExperimentalRpcInstrumentation,
  and ExperimentalMessagingInstrumentation types
- Update snippet examples with explanatory comments
- Fix grammar: "no opt-in is configured and instrumentations continue"
- Document merge semantics: domain-specific settings take precedence

Addresses feedback from jack-berg about environment variable
substitution compatibility per the project's data modeling guidance.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Use enum values (stable, stable/dup) for domain-specific stability
opt-in properties in http, database, rpc, and messaging instrumentation
types. This provides better validation and IDE support compared to
free-form strings.

The general stability_opt_in_list remains a string type since it
accepts comma-separated lists for env var substitution.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
- Extract ExperimentalSemconvStabilityOptIn as a common enum type
- Update all stability_opt_in properties to reference the shared type
- Use full property paths in descriptions (.instrumentation/development.general.*)
- Fix migration config example to use instrumentation/development
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Replace the per-domain ExperimentalSemconvStabilityOptIn enum (stable/dup)
with a structured ExperimentalSemconvConfig object supporting experimental,
version, and dup properties for more expressive semconv configuration.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Rename `dup` to `dual_emit` and change `version` type from string to
integer to match the declarative configuration spec defined in
semantic-conventions#3424.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Align domain names with semantic-conventions#3424 which defines the
canonical list: code, db, gen_ai, http, k8s, messaging, rpc.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The semconv PR (semantic-conventions#3424) specifies the property order as
version (required), experimental, dual_emit. Reorder schema and snippet
to match.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…redundant descriptions, add kitchen sink comment, remove k8s domain

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The page https://opentelemetry.io/docs/specs/semconv/code/ no longer exists.
Updated to the correct URL: https://opentelemetry.io/docs/specs/semconv/registry/attributes/code/

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…rsion=1, rebase on main

- Remove "(e.g., messaging)" from future signal types note since messaging is already supported
- Clarify dual_emit behavior for version=1 (pre-stable conventions)
- Rebase on main to resolve conflict with known_methods PR (open-telemetry#527)

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

Looks great to me. I left a comment about GenAI - I think there is some ambiguity there.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
Copy link
Member Author

all addressed now

…y experimental description

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
Copy link
Member Author

All review comments addressed.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

re-approving, thanks @zeitlinger!

@jack-berg jack-berg merged commit 780410a into open-telemetry:main Feb 27, 2026
12 checks passed
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.

support OTEL_SEMCONV_STABILITY_OPT_IN

5 participants