Open Telemetry
Introduction
This is a quick page about open telemetry which I came across doing the Effect_TS.
Four things
Four things must ye know about Open Telemetry
- Traces - Spans
- Metrics - Performances, counts etc
- Logs - No Explanation required
- Baggage - contextual information we want to pass from span to span
This is an example of a trace with spans.
Trace: "User logs in" ├── Span: "Frontend sends login request" ├── Span: "API receives request" │ ├── Span: "Validate credentials" │ └── Span: "Query user DB"
Other Terms
- OTLP - Open Telemetry Protocol Sent over gRPC or HTTP.
- Collector - Own Service to accept data and push it out
- Instrumentation - How you make the data. Some frameworks like expressJS, effectTS have automatic but you can use a OpenTelemetry SDK
Configuring Collector
There are six things you configure in a collector
- Receivers - How is how you collector takes in data
- Processors - Cleansing, Transform
- Extensions - Extra things, e.g. health monitor
- Exporters - Push data out, e.g Loki, Prometheus
- Pipelines - The path that telemetry data—traces, metrics, or logs—follows from ingestion to export
- Connectors - Can export data from one pipeline and feed it into another
connectors:
spanmetrics:
service:
pipelines:
traces:
receivers: [otlp]
exporters: [spanmetrics]
metrics:
receivers: [spanmetrics]
exporters: [prometheus]
Example with Node
npm install @opentelemetry/sdk-node \
@opentelemetry/api \
@opentelemetry/auto-instrumentations-node \
@opentelemetry/sdk-metrics \
@opentelemetry/sdk-trace-node