RousselTMLEARNING

Article · Elasticsearch: from discovery to expertise

OpenTelemetry traces and Kibana APM

1. Instrumenting #

OTel or EDOT SDKs.

Automatic instrumentation #

Three instrumented services, EDOT Collector, Elasticsearch, Kibana APM.
# Java : agent EDOT (ou agent OpenTelemetry Java)
export OTEL_SERVICE_NAME=checkout
export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318
export OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod,service.version=1.4.2
java -javaagent:elastic-otel-javaagent.jar -jar checkout.jar
Good to know: EDOT SDKs are distributions of OpenTelemetry SDKs with defaults tuned for Elastic; standard OpenTelemetry SDKs work too.

2. In Kibana #

Services, transactions, map.

APM views #

With the EDOT Collector (Elastic's APM connector and processor), Kibana shows each service's latency, throughput, error rate, dependencies and the service map. A trace opens as a waterfall with its spans.

FROM traces-*.otel-*
| WHERE resource.attributes.service.name == "checkout" AND status.code == "Error"
| KEEP @timestamp, trace_id, name, duration
| SORT @timestamp DESC | LIMIT 20

3. Sampling and correlating #

Keeping what matters.

Tail sampling #

processors:
  tail_sampling:
    decision_wait: 10s
    policies:
      - { name: erreurs, type: status_code, status_code: { status_codes: [ERROR] } }
      - { name: lentes, type: latency, latency: { threshold_ms: 800 } }
      - { name: echantillon, type: probabilistic, probabilistic: { sampling_percentage: 10 } }
Common mistake: Sampling in the SDKs AND in the Collector unknowingly: you keep 10% of 10%, and APM metrics computed on the remaining spans become wrong. Compute APM metrics before sampling.

Linking logs and traces #

When the SDK injects trace_id and span_id into logs (OTel appenders for log4j, logback, Python logging), Kibana jumps from a trace to its logs and back.

📄 OpenTelemetry traces in Elasticsearch and Kibana APM →

My progress

  • ⏱ Estimated time : ≈ 4 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Course Glossary

RBAC (Role-Based Access Control)

An access control method where permissions are assigned to specific roles (e.g., admin, reader) rather than directly to individual users.

Authentication

The process of verifying the identity of a user or system (e.g., login/password, tokens, biometrics).

Authorization

The process that occurs after authentication to determine if the entity has the necessary rights and privileges to access a resource.

API Key

A unique alphanumeric code used to identify, authenticate, and authorize access to an Application Programming Interface (API).

Architecture

The overall structural design of an IT system, defining its various components, their relationships, and the principles guiding its evolution.

Repository

A centralized storage location. This can refer to a source code repository (e.g., Git) or an artifact and binary repository (e.g., Harbor, Nexus, Arti...

Elasticsearch

A distributed, RESTful search and analytics engine capable of addressing a growing number of use cases, built on Apache Lucene.

Recommended Articles

OpenTelemetry and Elasticsearch: compatibility and architecture

Send OpenTelemetry to Elasticsearch: Collector and elasticsearch exporter, managed OTLP endpoint,...

Ingesting OpenTelemetry logs into Elasticsearch

Collect and structure logs with the OpenTelemetry Collector (filelog receiver, operators, transfo...

OpenTelemetry metrics in Elasticsearch

Collect host, Kubernetes and application metrics with OpenTelemetry, understand temporality and t...

Elastic Observability: logs, infrastructure, APM and synthetics

Elastic Observability features: log exploration, infrastructure inventory with Elastic Agent and ...

Standalone Elastic Agent, Logstash and Kafka outputs, and OpenTelemetry (EDOT)

Write a standalone configuration, ship to Logstash or Kafka, and use Elastic Agent as an OpenTele...

Datadog APM and OpenTelemetry: traces, services and correlation with logs

Instrument applications for Datadog APM (dd-trace, single step instrumentation, OpenTelemetry), u...

Sending traces to Tempo: OpenTelemetry instrumentation and Alloy

Produce and route traces to Tempo: Python/Java/Node auto-instrumentation, the manual SDK, OTEL en...

New Relic APM: agents, OpenTelemetry and distributed traces

Instrumenting applications with New Relic: language agents, configuration, transactions and Apdex...

Sending telemetry to ClickStack: OpenTelemetry SDKs, collectors, logs, Kubernetes and browser sessions

Feeding ClickStack: ingestion key, OpenTelemetry SDK variables, forwarding through an existing co...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!