Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ release.

### SDK Configuration

- Declarative configuration: allow language-specific prefixes in environment
variable substitution.
([#4891](https://github.com/open-telemetry/opentelemetry-specification/pull/4891))

### Supplementary Guidelines

### OTEPs
Expand Down
16 changes: 13 additions & 3 deletions specification/configuration/data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ defined using
the [Augmented Backus-Naur Form](https://datatracker.ietf.org/doc/html/rfc5234):

```abnf
SUBSTITUTION-REF = "${" ["env:"] ENV-NAME [":-" DEFAULT-VALUE] "}"; valid substitution reference
SUBSTITUTION-REF = "${" [PREFIX ":"] ENV-NAME [":-" DEFAULT-VALUE] "}"; valid substitution reference
Comment thread
MikeGoldsmith marked this conversation as resolved.
Outdated
INVALID-SUBSTITUTION-REF = "${" *(VCHAR-WSP-NO-RBRACE) "}"; invalid substitution reference

PREFIX = ALPHA *(ALPHA / DIGIT / "_"); substitution prefix, e.g. "env" (universal) or language-specific
ENV-NAME = (ALPHA / "_") *(ALPHA / DIGIT / "_"); the name of the variable to be substituted
DEFAULT-VALUE = *(VCHAR-WSP-NO-RBRACE); any number of VCHAR-WSP-NO-RBRACE
VCHAR-WSP-NO-RBRACE = %x21-7C / "~" / WSP; printable chars and whitespace, except }
Expand All @@ -77,7 +78,7 @@ DIGIT = %x30-39 ; 0-9
`SUBSTITUTION-REF` defines a valid environment variable substitution reference:

* Must start with `${`
* Optionally followed by `env:`
* Optionally followed by `PREFIX:`, where `PREFIX` is `env` (universal) or a language-specific identifier
* Must follow with `REF-NAME`, the name of the environment variable to be
substituted
* Must start with alphabetic or `_` character
Expand All @@ -88,6 +89,15 @@ DIGIT = %x30-39 ; 0-9
whitespace except `}`
* Must follow with `}`

Language implementations MAY support additional prefixes beyond `env:` to access
Comment thread
jack-berg marked this conversation as resolved.
language-specific configuration sources (e.g., Java system properties). Such
prefixes MUST follow the same syntactic structure as `env:` (prefix followed by
colon). For example, Java implementations may support `sys:` to access system
properties: `${sys:otel.service.name}`. Language-specific prefixes enable
idiomatic configuration patterns while maintaining the universal `env:` prefix
for cross-language compatibility. Language implementations SHOULD document any
additional prefixes they support.

`INVALID-SUBSTITUTION-REF` defines an invalid environment variable substitution
reference:

Expand All @@ -101,7 +111,7 @@ non-normative.

```regexp
// SUBSTITUTION-REF
\$\{(?:env:)?(?<ENV-NAME>[a-zA-Z_][a-zA-Z0-9_]*)(:-(?<DEFAULT-VALUE>[^\n]*))?\}
\$\{(?:(?<PREFIX>[a-zA-Z][a-zA-Z0-9_]*):)?(?<ENV-NAME>[a-zA-Z_][a-zA-Z0-9_]*)(:-(?<DEFAULT-VALUE>[^\n]*))?\}

// INVALID-SUBSTITUTION-REF
\$\{(?<INVALID_IDENTIFIER>[^}]+)\}
Expand Down
Loading