Commit 4fc286b
Add OpenTelemetry tracing provider to the container (disabled by default) (#37227)
* Add OpenTelemetry tracing provider to the container (disabled by default)
Introduces the no-op-by-default infrastructure for native OpenTelemetry
(OTel) tracing in the container. No tracing happens until explicitly
enabled via the opentelemetry-sdk feature flag.
- container-opentelemetry: new Felix bundle embedding the OTel SDK + OTLP
HTTP exporter (jdk sender, no okhttp/kotlin); exports the api/context/sdk
packages. Pre-installed into the container.
- OpenTelemetryProvider (container-disc): Provider<OpenTelemetry> registered
in all container types. Hands out OpenTelemetry.noop() when disabled;
builds the real SDK (OTLP/HTTP, batching, parent-based ratio sampling,
W3C propagation) only when enabled. Builds the OTel Resource from the
resource-attribute map.
- telemetry.def: enabled / endpoint / samplingRatio + a resourceAttribute
map. ContainerCluster fills the map with deployment identity available in
the model (application, tenant, cluster.type, cluster.id).
- opentelemetry-sdk JSON feature flag (enabled/endpoint/samplingRatio),
threaded through ModelContext -> ContainerCluster.getConfig. Takes effect
at redeployment.
- dependency-enforcer + abi-spec updated accordingly.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Make OpenTelemetry classes available to in-process container tests; avoid null endpoint
- container-dev: add the OpenTelemetry SDK + OTLP exporter artifacts so the in-process
container test harness (StandaloneContainerApplication) can load OpenTelemetryProvider,
which is now registered in every container. In production these come from the
pre-installed container-opentelemetry bundle via OSGi; container-dev is the flat
test classpath, mirroring vespa-3party-bundles / container-onnxruntime.
- Never hand back a null endpoint when disabled: the telemetry.def endpoint field is
mandatory, so the generated config builder rejects null. OpenTelemetryConfiguration.disabled()
and OpenTelemetrySettings now use an empty string (still no localhost default, so nothing
is mistakenly sent).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Expose only the OpenTelemetry API on the public container classpath
The SDK must not leak onto the 3rd-party container classpath (container-dependencies-enforcer).
Keep the public surface to the OTel API only:
- Split OpenTelemetrySdkBuilder out of OpenTelemetryProvider. The provider now references only the OTel
API; the SDK-building class is loaded lazily, only when tracing is enabled. So the in-process container
test harness needs only the API to instantiate the disabled, no-op provider.
- container-dev: depend on opentelemetry-api only (was sdk + exporter). The SDK is supplied at runtime by
the pre-installed container-opentelemetry bundle.
- container-dependencies-enforcer: whitelist opentelemetry-api/context/common (provided). These are
genuinely provided at runtime by the bundle.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Fix container-opentelemetry OSGi resolution: mark unused imports optional
The bundle failed to resolve in a real container (system tests): bnd had generated mandatory
Import-Package entries for packages the container does not provide (io.grpc, guava, the OTel
incubator/autoconfigure SPI, jspecify, sun.misc). The earlier assumption that bnd marks these
optional automatically was wrong.
Everything the bundle actually uses at runtime is embedded (private) in the jar. Add an explicit
Import-Package keeping only com.fasterxml.jackson.core mandatory (provided by the container) and
marking all other computed imports resolution:=optional, so the bundle resolves without the
unavailable deps it never exercises.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Address review: export ai.vespa.telemetry, keep OTel off the public container classpath
- configdefinitions: export the generated ai.vespa.telemetry package (@ExportPackage package-info)
so container-disc can import TelemetryConfig at runtime in a real container (OSGi).
- container: exclude io.opentelemetry:* from the container-dev dependency so the public 3rd-party
container classpath does not expose OpenTelemetry. It stays internal to the platform (container-disc),
provided at runtime by the container-opentelemetry bundle.
- container-dependencies-enforcer: drop the OpenTelemetry whitelist entries (no longer exposed).
container-dev keeps opentelemetry-api so the in-process container test harness still resolves the
no-op OpenTelemetryProvider.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Remove optional imports
* Fix bundle embedding: declare all OpenTelemetry modules as direct dependencies
The maven-bundle-plugin did not reliably embed deep transitive OTel modules across build
environments (e.g. opentelemetry-common, 4 levels deep via sdk->api->context->common). When a
module was not embedded, bnd emitted a mandatory versioned Import-Package for it, so the bundle
failed OSGi resolution in the real container (system tests), cascading to container-disc and
standalone-container.
Declare all 12 OTel modules directly so Embed-Dependency embeds them as first-level deps instead
of relying on Embed-Transitive. Same workaround pattern as container-apache-http-client-bundle.
Verified: the built bundle imports only com.fasterxml.jackson.core and no io.opentelemetry packages.
Also keep Import-Package limited to com.fasterxml.jackson.core (everything else is embedded).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: strip stray OSGI-INF/MANIFEST.MF from container-opentelemetry fat bundle
Inlined upstream OpenTelemetry MR-JARs carry their own OSGI-INF/MANIFEST.MF
(notably under META-INF/versions/9/OSGI-INF/), which survive into the
assembled fat bundle. OSGi resolvers only read META-INF/MANIFEST.MF, so the
extra files are inert noise that can mislead anyone inspecting the bundle.
Replace the built-in jar-with-dependencies descriptorRef with a custom
descriptor that mirrors the built-in but excludes OSGI-INF/MANIFEST.MF and
META-INF/versions/*/OSGI-INF/MANIFEST.MF when unpacking dependencies.
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Bjørn Christian Seime <bjorn.christian@seime.no>1 parent 8ee4f35 commit 4fc286b
23 files changed
Lines changed: 492 additions & 2 deletions
File tree
- config-model-api
- src/main/java/com/yahoo/config/model/api
- config-model/src/main/java/com/yahoo/vespa/model/container
- config-provisioning/src/main/java/com/yahoo/config/provision
- configdefinitions/src
- main/java/ai/vespa/telemetry
- vespa
- configserver/src/main/java/com/yahoo/vespa/config/server/deploy
- container-dependency-versions
- container-dev
- container-disc
- src/main/java/com/yahoo/container/jdisc/telemetry
- container-opentelemetry
- src/main/assembly
- container
- dependency-versions
- dist
- flags/src/main/java/com/yahoo/vespa/flags
- custom
- vespa-dependencies-enforcer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1415 | 1415 | | |
1416 | 1416 | | |
1417 | 1417 | | |
| 1418 | + | |
1418 | 1419 | | |
1419 | 1420 | | |
1420 | 1421 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
112 | | - | |
| 114 | + | |
| 115 | + | |
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
| |||
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
| 174 | + | |
| 175 | + | |
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| |||
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
182 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
183 | 190 | | |
184 | 191 | | |
185 | 192 | | |
| |||
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
| 209 | + | |
| 210 | + | |
202 | 211 | | |
203 | 212 | | |
204 | 213 | | |
| |||
566 | 575 | | |
567 | 576 | | |
568 | 577 | | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
569 | 604 | | |
570 | 605 | | |
571 | 606 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
| 227 | + | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
190 | 198 | | |
191 | 199 | | |
192 | 200 | | |
| |||
0 commit comments