Python + OpenTelemetry = ❤
Where Python meets observability
and open standards
PyCon Greece, 2025
Christos Markou | Software Engineer @ Elastic
- Principal Software Engineer I @ Elastic
- OpenTelemetry contributor
- Approver and/or code-owner for various
OpenTelemetry projects
- CNCF Ambassador
> whoami
An open-source observability framework
A set of specifications and
implementations for observability
OTel
OpenCensus
Signals
● Traces
● Metrics
● Logs
● Profiles
API
SDK
Agent / Auto Inst.
SDK
Semantic
Conventions
Collector
Receivers
Exporters
Processors
OTLP
…
Observability Backends
Collector
Receivers
Exporters
Processors
ResourceLogs
OTLP - Signals - Semantic Conventions
Resource
LogRecord
severity_text
body
Attributes
host.name: my-host.xyz
service.name: my-service
Attributes
http.request.method: GET
http.route: /users/:userID
client.address: 11.12.13.14
OTLP data format
Semantic Conventions
(simplified)
OpenTelemetry Protocol Specification
● Protocol Buffers schema that is used for the payloads
● implemented over gRPC and HTTP
OpenTelemetry for Python
OpenTelemetry for Python
API: provides an interface to generate
telemetry data
SDK: implements the API, replacing
no-ops with actual implementation
OpenTelemetry for Python
Signal Stability Level
Traces ✅ Stable
Metrics ✅ Stable
Logs Experimental
https://opentelemetry.io/docs/specs/otel/versioning-and-stability/#signal-lifecycle
- Manual instrumentation
- Traces, Metrics, Logs
- Auto-instrumentation
- Auto-instrumentation on K8s
- Resilience for log collection at scale
- OpenTelemetry Demo application
- Live Demo
Agenda
Tracing instrumentation
Tracing instrumentation
initialize provider with
resource attrs
add processor+exporter
create trace and span
Tracing instrumentation
(output)
Logs instrumentation
trace provider
log provider
set OTLP exporter
log+trace
set logging handler
https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples/logs
Logs instrumentation (output)
Metrics instrumentation
initialize provider
create+increase counter
create+handle updowncounter
Metrics instrumentation
(output)
Auto-instrumentation
utilizes monkey-patching to modify library
functions at runtime, allowing for the capture of
telemetry data from many popular libraries and
frameworks.
Auto-instrumentation
https://opentelemetry.io/docs/zero-code/python/
Auto-instrumentation on K8s
https://opentelemetry.io/docs/platforms/kubernetes/operator/automatic/#python
Auto-instrumentation on K8s
Resilience for Logs
API
SDK OTLP
…
Observability Backends
● Logs can contain crucial information and hence
SHOULD always be captured
● Sending Logs through OTLP over the network might not
provide the best reliability
● Writing OTLP Logs into local files (i.e. through stdout)
and then collecting them independently can enhance
resilience.
Resilience for Logs
https://opentelemetry.io/blog/2024/collecting-otel-compliant-java-logs-from-files/
Resilience for Logs
● https://github.com/open-telemetry/opentelemetry-python/issues/4661
● https://gist.github.com/ChrsMark/dc36896f0e5755e7bbaab7c49b5aa5a8
The above output can be parsed back into OTLP by the following
Opentelemetry Collector components:
● otlpjsonfilereceiver
● filelogreceiver+otlpjsonconnector
OpenTelemetry Demo
https://opentelemetry.io/docs/demo/
https://opentelemetry.io/docs/demo/
services/recommendation/
OpenTelemetry Demo
https://opentelemetry.io/docs/demo/
Otel Helm Charts
Sending to Prometheus and Jaeger
OpenTelemetry Demo
API
SDK Collector
Receivers
Exporters
Processors
…
OTLP
Sending to Prometheus and Jaeger
OpenTelemetry Demo
Sending to ElasticSearch
Demo
Questions / Keep in touch
CNCF Slack
#otel-python
#opentelemetry
#otel-collector
OTel Python SIG Meetings
Thursday at 19:00 pm (Eastern European Time)
@ChrsMark

Python + OpenTelemetry = ❤️ Where Python meets observability and open standards.pdf