Polyaxon v3 is coming →

OpenTelemetry zero-code instrumentation

Use OpenTelemetry automatic instrumentation as a safe baseline, then add domain spans, stable attributes, sampling, and rollout controls for ML services.

August 25, 2025by Polyaxon
OpenTelemetry zero-code instrumentation

OpenTelemetry zero-code instrumentation adds telemetry without requiring changes to application source. Depending on the language and runtime, it may use an agent, launcher, package injection, environment configuration, or eBPF-based observation.

It is a fast way to establish coverage for common frameworks and libraries. It is not literally zero work: teams still own compatibility, configuration, security, overhead, semantic quality, sampling, and operation of the telemetry path.

Understand what automatic instrumentation sees

The official OpenTelemetry zero-code documentation provides language- and platform-specific options. Typical integrations create spans or metrics for supported HTTP servers and clients, RPC frameworks, databases, messaging systems, and runtime behavior.

This gives a useful service map and latency baseline, but it observes library calls—not business meaning. It may show a database query and an outbound model request while missing that the enclosing operation was a dataset validation, training checkpoint, retrieval step, or safety evaluation.

Inventory supported libraries and versions before rollout. Coverage differs by language, runtime, instrumentation package, and stability level.

Start with a controlled baseline

Choose one representative service and define success before enabling instrumentation:

  • expected services and dependencies appear;
  • trace context crosses supported boundaries;
  • span names and resource attributes are stable;
  • error status is meaningful;
  • sensitive values are excluded or redacted;
  • CPU, memory, latency, and network overhead stay within limits;
  • export failure does not break the application.

Deploy gradually and compare the same workload with and without instrumentation. Include startup and shutdown behavior, because agents and injected packages can affect initialization or delay termination while flushing telemetry.

Version the instrumentation distribution and configuration. An automatic upgrade can change span names, attributes, or default coverage and break dashboards or sampling rules.

Establish resource identity

Every signal should identify the service, environment, version, and deployment context consistently. In Kubernetes, add cluster, namespace, workload, and Pod metadata through a controlled enrichment layer rather than trusting each application to emit it differently.

Keep attributes bounded. Route templates are better than raw URLs, and model families are safer metric dimensions than unique model or run IDs. Put precise identifiers into trace attributes or Polyaxon metadata where the backend can handle the cardinality.

Do not copy all Kubernetes labels and annotations into every span. They may contain user input, sensitive references, or dimensions that grow without limit.

Add manual instrumentation for ML meaning

Automatic and manual instrumentation complement each other. Add domain spans for work that generic libraries cannot recognize:

  • resolving a run or deployment specification;
  • waiting for queue admission;
  • loading datasets, checkpoints, or model artifacts;
  • preprocessing, training, evaluation, and publishing;
  • retrieval, reranking, model generation, tool calls, and handoffs;
  • policy and output validation.

Use the OpenTelemetry API so custom spans join the automatically created context. Avoid duplicate instrumentation when both a framework agent and application code wrap the same call.

Record outcomes as structured attributes or events, but keep large payloads out of the trace. Link to durable experiment, artifact, or evaluation records instead.

Protect sensitive data

Automatic instrumentation can capture URLs, query parameters, database statements, headers, messaging destinations, exceptions, and other values the application team did not deliberately select.

Review default attributes for every enabled integration. Use allowlists, route normalization, header controls, and Collector processors to remove credentials, personal data, prompts, source paths, or customer content before export.

Apply least-privilege access to the telemetry backend. Traces that reveal service topology or query text are operational data with security consequences.

Manage sampling and overhead

Measure application overhead under representative concurrency. High span volume can increase CPU, allocation, network traffic, and backend cost even when each individual span looks inexpensive.

Use head sampling for simple early control or tail sampling when the collection tier must retain errors, slow requests, or rare workload classes. Document the effect on analysis. A sampled trace set cannot automatically support unbiased traffic or failure-rate calculations.

Monitor the instrumentation and export path: queue growth, dropped spans, export errors, context-propagation failures, and Collector health. Telemetry must degrade safely when the backend is unavailable.

Roll out through the platform

For Kubernetes, central injection can improve consistency but expands the blast radius. Scope it by namespace or workload, pin compatible versions, support opt-out for incompatible services, and document ownership. Test admission-webhook availability if injection depends on one.

Polyaxon scheduling presets can standardize environment configuration for eligible workloads, while platform observability connects telemetry to the services managing runs. The OpenTelemetry Collector guide covers the receiving, processing, and exporting layer.

Zero-code instrumentation is the beginning of coverage, not the end of observability. Use it to capture common technical boundaries, add deliberate ML semantics, and validate every rollout against privacy, overhead, and the questions operators actually need to answer.