LabHub

Blog

Observability Complete Guide — Metric, Log, Trace, OpenTelemetry, eBPF, SLO (Season 2 Ep 9, 2025)

한국어English日本語

Intro — Observability vs Monitoring

Monitoring: detecting known problems. "Alert if CPU > 80%." Observability: investigating unknown problems. "Why did P99 suddenly triple?"

The nine black boxes

In 2025, every operator needs to:

This post covers four layers: fundamentals, practice, cost, organization.


Part 1 — Three Pillars + Profile = Four Pillars

1.1 Metric

Numeric time series — easy to aggregate, retain long term, and alert on.

1.2 Log

Event stream — detailed but large.

1.3 Trace

Causal chain of a request — core for distributed debugging.

1.4 Profile (fourth pillar, 2023+)

Continuous in-process CPU and memory profiles.

1.5 Four-pillar correlation scenario

Alert: P99 latency spike
[Metric] which service? → checkout-service
[Trace] which span? → payment-gateway call, 3s
[Log] logs for that trace_id → timeout error
[Profile] CPU during that window → 90% in TLS handshake
Root cause: expiring cert causes handshake surge

Correlation is the point. All four pillars must be stitched by trace_id.


Part 2 — OpenTelemetry: the observation standard

2.1 What OTEL solved

Before: every vendor shipped its own SDK (Prometheus, Datadog, New Relic...). Switching vendor meant rewriting instrumentation.

OTEL: instrument once, export anywhere.

2.2 OTEL components

Application
  ↓ (OTEL SDK)
OTLP Protocol
[OTEL Collector]
  ├─ Receivers (OTLP, Prometheus, Jaeger...)
  ├─ Processors (batch, filter, sample, enrich)
  └─ Exporters (Tempo, Loki, Prometheus, Datadog, ...)
Backend (where you want)

2.3 Signals — three, plus profile

2.4 Context Propagation

When a request flows A → B → C, the same trace_id must propagate:

HTTP Headers:
  traceparent: 00-TRACEID-SPANID-01
  tracestate: ...

W3C Trace Context standard. OTEL handles it automatically.

2.5 Auto-Instrumentation

2.6 OTEL evolution (2024–2025)


Part 3 — Prometheus and Grafana Stack

3.1 Grafana Stack (2025 OSS default)

ComponentRole
Prometheus / MimirMetric
LokiLog
TempoTrace
PyroscopeProfile
GrafanaDashboards
AlertmanagerAlerts
BeylaeBPF auto-instrumentation

3.2 Prometheus metric types

  1. Counter: monotonic (request count)
  2. Gauge: current value (memory use)
  3. Histogram: bucketed (latency distribution)
  4. Summary: pre-computed quantiles

3.3 PromQL basics

# requests per second
rate(http_requests_total[1m])

# P99 per service
histogram_quantile(0.99,
  sum(rate(http_request_duration_seconds_bucket[5m])) by (le, service)
)

# error rate
sum(rate(http_requests_total{status=~"5.."}[5m])) /
sum(rate(http_requests_total[5m]))

3.4 Cardinality management

Problem: {user_id, path, status, method} with 1M users × 10 paths × 5 statuses × 4 methods = 200M series. Prometheus collapses.

Fix:


Part 4 — Log management: cost vs quality

4.1 Why log cost explodes

4.2 Log level strategy

LevelUseRetention
ERRORalert-worthy30–90 days
WARNcaution30 days
INFOkey events7–30 days
DEBUGdev onlydrop or 1 day
TRACEdeep debugdrop

4.3 Structured logging (mandatory)

# bad
logger.info(f"User {user_id} logged in from {ip}")

# good
logger.info("user_login", extra={
    "user_id": user_id,
    "ip": ip,
    "trace_id": trace_id,
})

Search, filter, and aggregate all become possible.

4.4 Log solutions (2025)

ToolModelNotes
Lokilow-cost, minimal indexGrafana Stack default
Elasticsearchfull-textexpensive
OpenSearchElastic forkAWS-friendly
QuickwitRust, log-specializednew contender
ClickHousecolumnar DBstrong on analytics
Vector.dev (Datadog)ingest pipelinerouting and filtering

Part 5 — Distributed Tracing in practice

5.1 Four sampling strategies

  1. Head-based (probabilistic): decide at request start with N%. Simple. Root-leaf consistent.
  2. Rate-limited: X per second
  3. Tail-based: accept all, store only errors and slow. Best cost/signal balance
  4. Dynamic: auto-increase on anomaly

5.2 Tail-based Sampling (the 2024–2025 default)

# OTEL Collector config
processors:
  tail_sampling:
    policies:
      - name: errors
        type: status_code
        status_code: {status_codes: [ERROR]}
      - name: slow
        type: latency
        latency: {threshold_ms: 1000}
      - name: random
        type: probabilistic
        probabilistic: {sampling_percentage: 1}

100% of errors and slow, 1% of the rest.

5.3 Span naming and attributes

5.4 Debugging example

Gateway (20ms)
├─ auth-service (5ms)
├─ user-service (50ms)
│  └─ postgres.query (45ms)  ← slow here
└─ product-service (10ms)

The 45ms query span attribute db.statement = "SELECT * FROM users WHERE ..." points to a missing index.


Part 6 — eBPF: observation without code changes

6.1 What is eBPF

Safe bytecode injected into the Linux kernel to trace network, syscalls, and function calls.

Pros:

6.2 eBPF observability tools (2025)

6.3 eBPF's real value

"Language-agnostic auto-instrument" — Java, Go, Python, Rust, or Node, any HTTP/gRPC/DB call gets traced automatically.

Cons: kernel >= 5.x required, Windows still in progress, debugging is still hard.


Part 7 — SLO, SLI, Error Budget

7.1 Definitions (Google SRE)

7.2 Error Budget

100% - SLO = Error Budget.

7.3 Good SLI criteria

  1. User-centric: what users feel, not internal metrics
  2. Simple: easy to compute and understand
  3. Predictable: 100% in normal operation
  4. Tamper-proof: cannot be raised by redefinition

Examples:

7.4 Burn Rate

How fast the Error Budget is burning.

Burn Rate = current error rate / allowed error rate

14x burn for 1 hour = 5% of budget
6x burn for 6 hours = 5% of budget

Multi-window alerts: short-window high burn plus long-window moderate burn — cuts false positives.

7.5 Error Budget Policy

100–50% left: normal release cadence
50–10%: more release testing, prepare feature freeze
< 10%: feature freeze, stability sprint
Burned: postmortem, process review

Part 8 — Choosing an observability platform (2025)

8.1 Commercial vs OSS

CommercialOSS Stack
Datadog, New Relic, Dynatrace, Splunk, HoneycombGrafana Stack, Signoz, Kibana
Fast ROI, support, advanced AIFlexible, cheap, no lock-in
Cost can explodeNeeds operators

8.2 Situational recommendations

SituationRecommendation
Startup under 20 peopleDatadog or Signoz SaaS
Growth-stageGrafana Cloud or Honeycomb
Mid-sizeGrafana Stack self-host + Prometheus
EnterpriseHybrid (Datadog + OSS + in-house)
Cost-obsessedClickHouse + Grafana

8.3 Datadog cost traps

8.4 Honeycomb's differentiation


Part 9 — Organizational observability

9.1 Observability-driven development

9.3 Observability cost model

total cost = sum(signal size × retention × cost/GB)

levers:
1. Sample (trace 1%, log 10%)
2. Aggregate (rollups, not raw metrics)
3. Tiered retention (ERROR 90d, INFO 7d)
4. Pre-filter (OTEL Collector)
5. Cold/hot tier (archive to S3)

Target: observability cost stays at 5–15% of infra cost.


Part 10 — LLM observability (new in 2024–2025)

10.1 What to measure

10.2 Tools

10.3 LLM trace structure

user_query (root span)
├─ retrieval (vector search)
│   ├─ embedding (token count)
│   └─ qdrant.search (query vector)
├─ llm.openai.chat (tokens, cost)
│   └─ tool_call: get_weather
│       └─ api.weather
└─ response_generation

Part 11 — Six-month observability roadmap

Month 1: foundations

Month 2: logging

Month 3: tracing

Month 4: SLO

Month 5: eBPF and profile

Month 6: cost and org


Part 12 — Observability checklist (12)

  1. Know the strength of each of the 3 pillars + Profile
  2. Can explain OpenTelemetry Collector architecture
  3. Know the four Prometheus metric types
  4. Know what cardinality explosion is and how to prevent it
  5. Know the difference between Head and Tail-based sampling
  6. Know how W3C Trace Context connects services
  7. Know why eBPF is great for auto-instrumentation
  8. Clearly distinguish SLI, SLO, SLA
  9. Can compute Error Budget and Burn Rate
  10. Know 5 ways to cut log cost
  11. Know 3 Datadog cost traps
  12. Know 5 LLM observability metrics

Part 13 — Ten anti-patterns

  1. Unstructured logs: printf style. No search, no aggregation
  2. Ignoring cardinality: user_id as a label, explosion
  3. 100% trace retention: blows cost. Tail sampling is mandatory
  4. Log-to-metric abuse: expensive. Use Counter and Gauge
  5. Alert fatigue: hundreds a day. Keep only what matters
  6. No SLOs: no shared definition of "problem"
  7. Dashboard jungle: 50 dashboards, 10 used
  8. No trace_id plumbing: logs without trace_id = debugging hell
  9. Uniform retention: ERROR and DEBUG kept the same time = waste
  10. Observability as afterthought: "we'll add it post-launch" = never

Closing — Observability is the system's sense of self

Just as a human who feels no pain cannot care for their body, a system that cannot perceive its own state cannot be operated.

In 2025, observability comes down to:

Tools churn every year. Grafana Stack goes Prometheus → Mimir → Grafana Cloud, Elastic becomes OpenSearch, Datadog embraces eBPF. But the principles hold.

Remember: "If you cannot observe it, you cannot operate it."


Next up — "Security Complete Guide: Zero Trust, Secrets, OAuth, OIDC, Supply Chain, AI Security"

Season 2 Episode 10 is the other operational must: security engineering. Next time:

Crypto is easy, security is hard. Continues next.

Comments

No comments yet.

Sign in to leave a comment