Comprehensive guide to observability migration for production observability and monitoring systems.
Observability migration is the process of evolving from a static, fragmented monitoring setup to a unified, dynamic, and context-rich observability platform. It matters when teams transition from reactive, siloed alerts toward proactive, correlated, and self-explanatory system insights—especially when introducing distributed tracing, structured logging, and metrics at scale. Migration is not a one-off task but a continuous transformation that aligns instrumentation, data flow, tooling, and team practices around a shared understanding of system behavior.
Before initiating migration, validate the existing observability posture. Begin by collecting and analyzing the current state across logs, metrics, and traces.
Use curl to query all active monitoring endpoints and gather metadata:
curl -s https://monitoring.example.com/metrics/health \
| jq '.status, .last_updated, .services[]'
Check for gaps in data coverage:
curl -s https://logs.example.com/api/v1/indices \
| jq '.indices[] | select(.name == "app-logs") | .retention_days'
Examine the structure of existing logs. For systems using JSON logs, verify consistency:
{
"timestamp": "2023-10-05T12:34:56.789Z",
"level": "info",
"service": "user-api",
"message": "User created",
"user_id": 12345,
"request_id": "a1b2c3d4e5f6"
}
Identify missing fields that are critical for correlation. A common silent failure is inconsistent request_id propagation: some services emit request_id, others use trace_id, and a third uses txn_id. Migration must unify these under a single correlation context.
Use pg_dump to extract and analyze metric storage schemas:
pg_dump -t metrics.series -t metrics.samples -U observability -h db.prod.example.com observability_db > schema.dump
Then verify if all metrics have a time and value column, and whether tags are stored as a JSONB column or as separate rows.
Migration begins with standardizing instrumentation across services. Every new service must emit logs, metrics, and traces with consistent context.
Define a shared logging schema using a JSON format. Services should emit structured logs with the following keys:
timestamp (ISO 8601, UTC)level (one of debug, info, warn, error, critical)service (canonical service name)trace_id (32-character hexadecimal or UUID)span_id (16-character hexadecimal)request_id (string, often UUID)component (e.g., gateway, auth, db, cache)Use logfmt for high-volume logs when JSON is too heavy:
timestamp=2023-10-05T12:34:56.789Z level=info service=payment-api message="Payment processed" trace_id=7a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d request_id=8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f amount=49.99 currency=USD status=success
Ensure metrics are emitted via OpenMetrics or Prometheus exposition format. Each service should expose a /metrics endpoint with:
# TYPE http_requests_total counter
http_requests_total{method="GET",handler="/health"} 1234
http_requests_total{method="POST",handler="/user"} 567
# HELP service_uptime_seconds Service uptime in seconds
# TYPE service_uptime_seconds gauge
service_uptime_seconds 123456.78
Validate that all services expose a common set of metrics:
service_uptime_secondsservice_errors_totalservice_latency_secondsservice_requests_totalUse curl and jq to verify compliance:
curl -s http://user-api.prod.example.com/metrics \
| grep -E 'service_uptime_seconds|service_errors_total'
Introduce distributed tracing by instrumenting service boundaries with context propagation. Use a standard trace context format via HTTP headers:
X-Trace-ID: 7a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d
X-Span-ID: 1a2b3c4d5e6f
X-Parent-Span-ID: 7a1b2c3d4e5f
Each service must extract the trace context from incoming requests and inject it into outgoing calls.
When a service receives a request:
X-Trace-ID, X-Span-ID, and X-Parent-Span-ID.Span with the trace_id and span_id.X-Trace-ID, X-Span-ID, and X-Parent-Span-ID in outgoing HTTP calls.A common failure is not setting X-Parent-Span-ID when making internal calls. A service calls another service but only sends X-Trace-ID and X-Span-ID, resulting in traces with missing parent-child relationships.
Validate trace propagation with a test request:
POST /user/123 HTTP/1.1
Host: user-api.example.com
X-Trace-ID: 7a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d
X-Span-ID: 1a2b3c4d5e6f
Content-Type: application/json
{"name": "Alice"}
Then verify in the tracing backend that:
user-api creates a span with span_id=1a2b3c4d5e6f and trace_id=7a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d.user-api calls auth-service, sending X-Trace-ID, X-Span-ID, and X-Parent-Span-ID=1a2b3c4d5e6f.auth-service creates a new span with span_id=5e6f7a8b9c0d and trace_id=7a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d.Once instrumentation is consistent, migrate data into a centralized observability platform. Use docker-compose to spin up a minimal stack:
version: '3.8'
services:
prometheus:
image: prom/prometheus:v2.40
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
grafana:
image: grafana/grafana:9.5
volumes:
- ./dashboards:/etc/grafana/provisioning/dashboards
ports:
- "3000:3000"
loki:
image: grafana/loki:2.8
volumes:
- ./loki-config.yaml:/etc/loki/loki-config.yaml
ports:
- "3100:3100"
promtail:
image: grafana/promtail:2.8
volumes:
- /var/log:/var/log
- ./promtail-config.yaml:/etc/promtail/config.yaml
depends_on:
- loki
Configure promtail to ship logs to loki:
server:
http_listen_port: 9080
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: system
static_configs:
- targets: [localhost]
labels:
job: system
__path__: /var/log/*.log
pipeline_stages:
- regex:
expression: '^(?P<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z) (?P<level>\w+) (?P<service>\w+) (?P<message>.*)'
- labels:
service: "{{ .service }}"
job: "{{ .job }}"
level: "{{ .level }}"
Ensure loki is configured to index logs by service, job, and level:
auth_enabled: false
server:
http_listen_port: 3100
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
index_directory: /tmp/loki/index
compactor:
working_directory: /tmp/loki/compactor
ruler:
storage:
filesystem:
directory: /tmp/loki/ruler
ingester:
chunk_idle_period: 10m
chunk_retention_period: 24h
lifecycler:
ring:
kvstore:
store: inmemory
Use curl to verify logs are ingested:
curl -s 'http://loki:3100/loki/api/v1/labels?match[]={job="user-api"}' \
| jq '.data'
Design dashboards that answer common questions: "Why is latency spiking?", "Where is the error rate highest?", "What changed in the last 5 minutes?"
Use Grafana with a standardized dashboard template. Define a base dashboard with:
service_uptime_seconds (gauge)service_latency_seconds (time series, percentiles: 95th, 99th)service_errors_total (stacked area chart)service=user-api, level=error, and trace_id as a filterCreate a dashboard JSON:
{
"title": "User API - Service Health",
"panels": [
{
"title": "Uptime",
"type": "gauge",
"datasource": "prometheus",
"targets": [
{
"expr": "service_uptime_seconds{service=\"user-api\"}",
"legendFormat": "Uptime"
}
]
},
{
"title": "Latency (95th, 99th)",
"type": "graph",
"datasource": "prometheus",
"targets": [
{
"expr": "histogram_quantile(0.95, sum(rate(service_latency_seconds_bucket{service=\"user-api\"}[5m])) by (le))",
"legendFormat": "95th percentile"
},
{
"expr": "histogram_quantile(0.99, sum(rate(service_latency_seconds_bucket{service=\"user-api\"}[5m])) by (le))",
"legendFormat": "99th percentile"
}
]
},
{
"title": "Errors",
"type": "timeseries",
"datasource": "prometheus",
"targets": [
{
"expr": "rate(service_errors_total{service=\"user-api\"}[5m])",
"legendFormat": "Errors/minute"
}
]
},
{
"title": "Recent Errors",
"type": "logs",
"datasource": "loki",
"targets": [
{
"expr": '{job="user-api", level="error"}',
"limit": 100
}
]
}
],
"refresh": "30s"
}
Apply this dashboard to all services using curl:
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d @dashboard.json \
http://grafana:3000/api/dashboards/db
Migration is not complete when data flows. The system must be observable in production.
Establish a health check endpoint: /health that returns:
{
"status": "ok",
"checks": [
{
"name": "trace_context_propagation",
"status": "pass",
"details": {
"received_trace_id": "7a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d",
"expected_trace_id": "7a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d"
}
},
{
"name": "log_schema_compliance",
"status": "pass",
"details": {
"required_keys": ["timestamp", "level", "service", "trace_id"],
"missing_keys": []
}
},
{
"name": "metric_exposure",
"status": "pass",
"details": {
"expected_metrics": [
"service_uptime_seconds",
"service_errors_total",
"service_latency_seconds"
],
"missing_metrics": []
}
}
]
}
Use systemctl to ensure all services are monitored:
systemctl enable --now observability-migration-agent
systemctl status observability-migration-agent
journalctl -u observability-migration-agent -f
Configure alerting on critical metrics:
service_uptime_seconds < 300service_latency_seconds_95th > 500msservice_errors_total > 100 per minuteUse curl and jq to validate alert rules:
curl -s http://alertmanager.example.com/api/v1/rules \
| jq '.groups[].rules[] | select(.name == "Service Health")'
X-Parent-Span-ID. The resulting trace tree has root spans but no children.promtail fails to send logs to loki, but no alert exists. Logs appear 10 minutes late.service_uptime_seconds is a gauge, but the dashboard expects it to be a counter. The uptime graph shows a continuous line instead of a step function.request_id is set in the gateway, but the service does not propagate it to downstream calls. The trace and log correlation are incomplete.trace_id is not present. The system cannot link logs to traces.Migration succeeds when teams can answer: “Why is this service slow?” with a single dashboard, and when a new engineer can understand a failure by reading logs, metrics, and traces together—without needing to ask anyone.
This page was rewritten on 18 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.
We use cookies for analytics (Google Analytics) and advertising (Google AdSense) to improve your experience and support free content. Privacy Policy