-
[NA] [BE] refactor: replace opik-telemetry-extension with OTel YAML view config (#6510)
发布于
2026-04-28 10:05:50 +00:00 - [NA] [BE] refactor: replace opik-telemetry-extension with OTel YAML view config
The opik-telemetry-extension registered a metric View with
setAttributeFilter(value -> true) so captured request headers (e.g.
Comet-Workspace) would land on http.server.* metric attributes. Per
upstream OTel maintainers that filter is too broad — it also leaks
high-cardinality span attributes like http.request.body.size onto every
metric. Replace it with declarative per-instrument Views via
otel.experimental.metrics.view-config (incubator extension shaded into
the agent), so each HTTP server metric carries the canonical
HttpMetricsAdvice attribute set plus the captured workspace and
SDK-version headers — and nothing else.Changes:
- Delete apps/opik-backend/opik-telemetry-extension/ Maven module.
- Add apps/opik-backend/opik-otel-views.yaml with three Views
(http.server.request.duration, http.server.request.body.size,
http.server.active_requests). - Dockerfile: drop extension build/copy steps, ship the YAML.
- entrypoint.sh: swap -Dotel.javaagent.extensions=... for
-Dotel.experimental.metrics.view-config=/opt/opik/opik-otel-views.yaml
and remove the OTEL_BUCKET_HISTOGRAM_BOUNDARIES ms->s logic
(helm uses BASE2_EXPONENTIAL_BUCKET_HISTOGRAM, so it was a no-op there;
custom bucket users can move the aggregation block into the YAML view). - docker-compose.yaml: make OPIK_OTEL_SDK_ENABLED,
OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS,
OTEL_INSTRUMENTATION_HTTP_SERVER_EMIT_EXPERIMENTAL_TELEMETRY overridable
via shell env, and add OTEL_EXPORTER_OTLP_PROTOCOL=grpc default to
match the existing 4317 endpoint (fixes a pre-existing mismatch
warning at boot).
- fix(otel): default capture-headers and emit-experimental, add response.body.size view
Address PR #6510 review:
- Default OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS to
Comet-Workspace,x-opik-debug-sdk-version so the view attribute_keys
populate out-of-the-box once OPIK_OTEL_SDK_ENABLED is flipped. - Default OTEL_INSTRUMENTATION_HTTP_SERVER_EMIT_EXPERIMENTAL_TELEMETRY to
true so error.type and network.* attributes are filled once telemetry
is enabled. - Add http.server.response.body.size view mirroring request.body.size to
cover response sizes for fetch endpoints.
下载附件