Skip to content

Commit cc0b183

Browse files
feat(config): upgrade OTel configuration schema to v1.0.0 (#4965)
* upgrade OTel configuration schema from v1.0.0-rc.3 to v1.0.0 - Replace vendored schema.json with upstream v1.0.0 - Regenerate models.py via tox -e generate-config-from-jsonschema - Update file_format version strings in tests and docs - Add README with instructions for future schema upgrades Assisted-by: Claude Sonnet 4.6 * add changelog entry for schema v1.0.0 upgrade Assisted-by: Claude Sonnet 4.6 * apply ruff formatting to test_loader.py Assisted-by: Claude Sonnet 4.6 * fix link
1 parent abd27fb commit cc0b183

File tree

10 files changed

+281
-126
lines changed

10 files changed

+281
-126
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
([#4958](https://github.com/open-telemetry/opentelemetry-python/pull/4958))
1919
- `opentelemetry-sdk`: fix type annotations on `MetricReader` and related types
2020
([#4938](https://github.com/open-telemetry/opentelemetry-python/pull/4938/))
21+
- `opentelemetry-sdk`: upgrade vendored OTel configuration schema from v1.0.0-rc.3 to v1.0.0
22+
([#4965](https://github.com/open-telemetry/opentelemetry-python/pull/4965))
2123

2224
## Version 1.40.0/0.61b0 (2026-03-04)
2325

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SDK File Configuration
2+
3+
This package implements [OpenTelemetry file-based configuration](https://opentelemetry.io/docs/specs/otel/configuration).
4+
5+
## Files
6+
7+
- `schema.json` — vendored copy of the [OpenTelemetry configuration JSON schema](https://github.com/open-telemetry/opentelemetry-configuration)
8+
- `models.py` — Python dataclasses generated from `schema.json` by [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator)
9+
10+
## Updating the schema
11+
12+
1. Download the new schema from the [opentelemetry-configuration releases](https://github.com/open-telemetry/opentelemetry-configuration/releases):
13+
14+
```sh
15+
curl -o opentelemetry-sdk/src/opentelemetry/sdk/_configuration/schema.json \
16+
https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/refs/tags/vX.Y.Z/opentelemetry_configuration.json
17+
```
18+
19+
2. Regenerate `models.py`:
20+
21+
```sh
22+
tox -e generate-config-from-jsonschema
23+
```
24+
25+
3. Update any version string references in tests and source:
26+
27+
```sh
28+
grep -r "OLD_VERSION" opentelemetry-sdk/
29+
```

opentelemetry-sdk/src/opentelemetry/sdk/_configuration/file/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
>>> from opentelemetry.sdk._configuration.file import load_config_file
2222
>>> config = load_config_file("otel-config.yaml")
2323
>>> print(config.file_format)
24-
'1.0-rc.3'
24+
'1.0'
2525
"""
2626

2727
from opentelemetry.sdk._configuration.file._env_substitution import (

opentelemetry-sdk/src/opentelemetry/sdk/_configuration/models.py

Lines changed: 64 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
2-
# filename: https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/refs/tags/v1.0.0-rc.3/opentelemetry_configuration.json
3-
# timestamp: 2026-02-19T11:35:13+00:00
2+
# filename: schema.json
3+
# timestamp: 2026-03-11T13:56:48+00:00
44

55
from __future__ import annotations
66

@@ -122,12 +122,14 @@ class ExperimentalComposableRuleBasedSamplerRuleAttributeValues:
122122
class ExperimentalHttpClientInstrumentation:
123123
request_captured_headers: Optional[list[str]] = None
124124
response_captured_headers: Optional[list[str]] = None
125+
known_methods: Optional[list[str]] = None
125126

126127

127128
@dataclass
128129
class ExperimentalHttpServerInstrumentation:
129130
request_captured_headers: Optional[list[str]] = None
130131
response_captured_headers: Optional[list[str]] = None
132+
known_methods: Optional[list[str]] = None
131133

132134

133135
ExperimentalLanguageSpecificInstrumentation: TypeAlias = dict[
@@ -137,7 +139,7 @@ class ExperimentalHttpServerInstrumentation:
137139

138140
@dataclass
139141
class ExperimentalMeterConfig:
140-
disabled: Optional[bool] = None
142+
enabled: Optional[bool] = None
141143

142144

143145
@dataclass
@@ -151,12 +153,6 @@ class ExperimentalOtlpFileExporter:
151153
output_stream: Optional[str] = None
152154

153155

154-
@dataclass
155-
class ExperimentalPeerServiceMapping:
156-
peer: str
157-
service: str
158-
159-
160156
@dataclass
161157
class ExperimentalProbabilitySampler:
162158
ratio: Optional[float] = None
@@ -167,11 +163,20 @@ class ExperimentalProbabilitySampler:
167163

168164
class ExperimentalPrometheusTranslationStrategy(Enum):
169165
underscore_escaping_with_suffixes = "underscore_escaping_with_suffixes"
170-
underscore_escaping_without_suffixes = (
171-
"underscore_escaping_without_suffixes"
166+
underscore_escaping_without_suffixes_development = (
167+
"underscore_escaping_without_suffixes/development"
168+
)
169+
no_utf8_escaping_with_suffixes_development = (
170+
"no_utf8_escaping_with_suffixes/development"
172171
)
173-
no_utf8_escaping_with_suffixes = "no_utf8_escaping_with_suffixes"
174-
no_translation = "no_translation"
172+
no_translation_development = "no_translation/development"
173+
174+
175+
@dataclass
176+
class ExperimentalSemconvConfig:
177+
version: Optional[int] = None
178+
experimental: Optional[bool] = None
179+
dual_emit: Optional[bool] = None
175180

176181

177182
ExperimentalServiceResourceDetector: TypeAlias = Optional[dict[str, Any]]
@@ -185,7 +190,7 @@ class ExperimentalSpanParent(Enum):
185190

186191
@dataclass
187192
class ExperimentalTracerConfig:
188-
disabled: Optional[bool] = None
193+
enabled: Optional[bool] = None
189194

190195

191196
@dataclass
@@ -194,6 +199,11 @@ class ExperimentalTracerMatcherAndConfig:
194199
config: ExperimentalTracerConfig
195200

196201

202+
@dataclass
203+
class ExperimentalUrlSanitization:
204+
sensitive_query_parameters: Optional[list[str]] = None
205+
206+
197207
@dataclass
198208
class ExplicitBucketHistogramAggregation:
199209
boundaries: Optional[list[float]] = None
@@ -242,9 +252,6 @@ class InstrumentType(Enum):
242252
up_down_counter = "up_down_counter"
243253

244254

245-
JaegerPropagator: TypeAlias = Optional[dict[str, Any]]
246-
247-
248255
LastValueAggregation: TypeAlias = Optional[dict[str, Any]]
249256

250257

@@ -263,9 +270,6 @@ class NameStringValuePair:
263270
OpenCensusMetricProducer: TypeAlias = Optional[dict[str, Any]]
264271

265272

266-
OpenTracingPropagator: TypeAlias = Optional[dict[str, Any]]
267-
268-
269273
@dataclass
270274
class OtlpGrpcExporter:
271275
endpoint: Optional[str] = None
@@ -433,15 +437,31 @@ class ConsoleMetricExporter:
433437
] = None
434438

435439

440+
@dataclass
441+
class ExperimentalCodeInstrumentation:
442+
semconv: Optional[ExperimentalSemconvConfig] = None
443+
444+
445+
@dataclass
446+
class ExperimentalDbInstrumentation:
447+
semconv: Optional[ExperimentalSemconvConfig] = None
448+
449+
450+
@dataclass
451+
class ExperimentalGenAiInstrumentation:
452+
semconv: Optional[ExperimentalSemconvConfig] = None
453+
454+
436455
@dataclass
437456
class ExperimentalHttpInstrumentation:
457+
semconv: Optional[ExperimentalSemconvConfig] = None
438458
client: Optional[ExperimentalHttpClientInstrumentation] = None
439459
server: Optional[ExperimentalHttpServerInstrumentation] = None
440460

441461

442462
@dataclass
443463
class ExperimentalLoggerConfig:
444-
disabled: Optional[bool] = None
464+
enabled: Optional[bool] = None
445465
minimum_severity: Optional[SeverityNumber] = None
446466
trace_based: Optional[bool] = None
447467

@@ -452,6 +472,11 @@ class ExperimentalLoggerMatcherAndConfig:
452472
config: ExperimentalLoggerConfig
453473

454474

475+
@dataclass
476+
class ExperimentalMessagingInstrumentation:
477+
semconv: Optional[ExperimentalSemconvConfig] = None
478+
479+
455480
@dataclass
456481
class ExperimentalMeterConfigurator:
457482
default_config: Optional[ExperimentalMeterConfig] = None
@@ -467,17 +492,12 @@ class ExperimentalOtlpFileMetricExporter:
467492
] = None
468493

469494

470-
@dataclass
471-
class ExperimentalPeerInstrumentation:
472-
service_mapping: Optional[list[ExperimentalPeerServiceMapping]] = None
473-
474-
475495
@dataclass
476496
class ExperimentalPrometheusMetricExporter:
477497
host: Optional[str] = None
478498
port: Optional[int] = None
479499
without_scope_info: Optional[bool] = None
480-
without_target_info: Optional[bool] = None
500+
without_target_info_development: Optional[bool] = None
481501
with_resource_constant_labels: Optional[IncludeExclude] = None
482502
translation_strategy: Optional[
483503
ExperimentalPrometheusTranslationStrategy
@@ -492,6 +512,16 @@ class ExperimentalResourceDetector:
492512
service: Optional[ExperimentalServiceResourceDetector] = None
493513

494514

515+
@dataclass
516+
class ExperimentalRpcInstrumentation:
517+
semconv: Optional[ExperimentalSemconvConfig] = None
518+
519+
520+
@dataclass
521+
class ExperimentalSanitization:
522+
url: Optional[ExperimentalUrlSanitization] = None
523+
524+
495525
@dataclass
496526
class ExperimentalTracerConfigurator:
497527
default_config: Optional[ExperimentalTracerConfig] = None
@@ -555,8 +585,6 @@ class TextMapPropagator:
555585
baggage: Optional[BaggagePropagator] = None
556586
b3: Optional[B3Propagator] = None
557587
b3multi: Optional[B3MultiPropagator] = None
558-
jaeger: Optional[JaegerPropagator] = None
559-
ottrace: Optional[OpenTracingPropagator] = None
560588

561589

562590
@dataclass
@@ -579,8 +607,14 @@ class BatchLogRecordProcessor:
579607

580608
@dataclass
581609
class ExperimentalGeneralInstrumentation:
582-
peer: Optional[ExperimentalPeerInstrumentation] = None
583610
http: Optional[ExperimentalHttpInstrumentation] = None
611+
code: Optional[ExperimentalCodeInstrumentation] = None
612+
db: Optional[ExperimentalDbInstrumentation] = None
613+
gen_ai: Optional[ExperimentalGenAiInstrumentation] = None
614+
messaging: Optional[ExperimentalMessagingInstrumentation] = None
615+
rpc: Optional[ExperimentalRpcInstrumentation] = None
616+
sanitization: Optional[ExperimentalSanitization] = None
617+
stability_opt_in_list: Optional[str] = None
584618

585619

586620
@dataclass

0 commit comments

Comments
 (0)