Observability — OpenTelemetry & Distributed Tracing
Instrumentation moderne avec OpenTelemetry pour métriques, traces et logs structurés.
Piliers de l'Observabilité
| Pilier |
Technologies |
Métriques clés |
| Metrics |
Prometheus, Grafana, Datadog |
RED (Rate, Errors, Duration), USE (Utilization, Saturation, Errors) |
| Traces |
OpenTelemetry, Jaeger, Tempo |
P95 latency, span duration, error rate |
| Logs |
Loki, ElasticSearch, Datadog |
Structured JSON, correlation IDs |
OpenTelemetry (OTel) Stack
// Node.js — Auto-instrumentation
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const sdk = new NodeSDK({
traceExporter: new OTLPTraceExporter(),
instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();
Golden Signals (Google SRE)
| Signal |
Description |
Seuil typique |
| Latency |
P50, P95, P99 response time |
P95 < 200ms |
| Traffic |
Requests per second |
Baseline + alerting |
| Errors |
Error rate (5xx, exceptions) |
< 0.1% |
| Saturation |
CPU, Memory, Disk |
< 80% sustained |
Structured Logging (JSON)
{
"timestamp": "2026-04-17T10:30:00Z",
"level": "error",
"message": "Payment processing failed",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"span_id": "00f067aa0ba902b7",
"service.name": "payment-api",
"error.type": "PaymentGatewayTimeout"
}
SLI / SLO / SLA
| Concept |
Exemple |
| SLI (Indicator) |
99.5% requests < 200ms |
| SLO (Objective) |
99.9% uptime mensuel |
| SLA (Agreement) |
99.95% uptime + pénalités |
Pour instrumentation détaillée par stack : invoquer @observability-engineer
1---2name: observability3description: Observability — OpenTelemetry & Distributed Tracing4---56# Observability — OpenTelemetry & Distributed Tracing78Instrumentation moderne avec OpenTelemetry pour métriques, traces et logs structurés.910## Piliers de l'Observabilité1112| Pilier | Technologies | Métriques clés |13|--------|--------------|----------------|14| **Metrics** | Prometheus, Grafana, Datadog | RED (Rate, Errors, Duration), USE (Utilization, Saturation, Errors) |15| **Traces** | OpenTelemetry, Jaeger, Tempo | P95 latency, span duration, error rate |16| **Logs** | Loki, ElasticSearch, Datadog | Structured JSON, correlation IDs |1718## OpenTelemetry (OTel) Stack1920```javascript21// Node.js — Auto-instrumentation22const { NodeSDK } = require('@opentelemetry/sdk-node');23const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');2425const sdk = new NodeSDK({26 traceExporter: new OTLPTraceExporter(),27 instrumentations: [getNodeAutoInstrumentations()],28});2930sdk.start();31```3233## Golden Signals (Google SRE)3435| Signal | Description | Seuil typique |36|--------|-------------|---------------|37| **Latency** | P50, P95, P99 response time | P95 < 200ms |38| **Traffic** | Requests per second | Baseline + alerting |39| **Errors** | Error rate (5xx, exceptions) | < 0.1% |40| **Saturation** | CPU, Memory, Disk | < 80% sustained |4142## Structured Logging (JSON)4344```json45{46 "timestamp": "2026-04-17T10:30:00Z",47 "level": "error",48 "message": "Payment processing failed",49 "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",50 "span_id": "00f067aa0ba902b7",51 "service.name": "payment-api",52 "error.type": "PaymentGatewayTimeout"53}54```5556## SLI / SLO / SLA5758| Concept | Exemple |59|---------|---------|60| **SLI** (Indicator) | 99.5% requests < 200ms |61| **SLO** (Objective) | 99.9% uptime mensuel |62| **SLA** (Agreement) | 99.95% uptime + pénalités |6364---6566Pour instrumentation détaillée par stack : invoquer `@observability-engineer`