Book Consultation Submit Ticket

Practical Prometheus, Grafana, and OpenTelemetry: Building Observability for Kubernetes

This article walks through a real-world scenario to demonstrate how to build an end-to-end observability stack using Prometheus, Grafana, and OpenTelemetry, covering metrics, traces, and dashboards. Ideal for SREs and DevOps engineers.

Practical Prometheus, Grafana, and OpenTelemetry: Building Observability for Kubernetes
Observability 6min 41 views 2026-07-14
PrometheusGrafanaOpenTelemetryKubernetesObservability

Scenario

A microservices application experiences intermittent high latency after deployment, burning through error budget quickly. The team already has Prometheus and Grafana but lacks distributed tracing, making root cause analysis difficult.

Symptoms

  • Users report slow page loads (>5 seconds)
  • Grafana shows p99 latency spiking from 200ms to 2s
  • Error rate rises from 0.5% to 3%, nearing error budget exhaustion

Diagnosis

  1. Check Prometheus metrics: Determine if high latency is global or local. Run query: histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le, service)). Find that frontend service p99 is normal, but payments service p99 is 4s.
  2. Deploy OpenTelemetry Collector: Auto-inject traces to locate slow call chains.

Commands and Configuration

Install OpenTelemetry Collector (Helm)

helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm upgrade --install otel-collector open-telemetry/opentelemetry-collector \
  --set mode=deployment \
  --set config.receivers.otlp.protocols.grpc.endpoint=0.0.0.0:4317 \
  --set config.exporters.prometheus.endpoint=0.0.0.0:8889 \
  --set-file config.pipelines.traces=traces.yaml

Prometheus Configuration (add scrape target)

scrape_configs:
  - job_name: 'otel-collector'
    scrape_interval: 10s
    static_configs:
      - targets: ['otel-collector:8889']

Grafana Dashboard (import JSON)

Create a trace dashboard using tempo or other compatible data source.

Risk Controls

  • Namespace isolation: Deploy collector in a separate namespace to avoid affecting production.
  • Sampling rate control: Default 10% sampling to prevent storage explosion.
  • Configuration backup: Backup Prometheus and Grafana configs.

Rollback

helm rollback otel-collector 0  # Rollback to previous version
kubectl delete -f prometheus-config.yaml  # Remove scrape config

Verification

  • Query: rate(traces_sampled_total[5m]) to confirm trace data inflow.
  • In Grafana, check latency dashboard; p99 should return to normal (<500ms).
  • Run end-to-end tests; error rate drops to 0.5%.

When to Submit an OpsGlobal Ticket

  • Cannot identify root cause; expert analysis of call chains required.
  • No metric changes after configuration; collector or exporter may be misconfigured.
  • Need optimization of sampling strategy or storage solution.

Use cases

Useful for teams handling Observability issues and needing a clear troubleshooting and delivery workflow.

Problem background

This article walks through a real-world scenario to demonstrate how to build an end-to-end observability stack using Prometheus, Grafana, and OpenTelemetry, covering metrics, traces, and dashboards. Ideal for SREs and DevOps engineers.

Troubleshooting steps

Confirm impact and recent changes, collect logs, configuration and metrics, then apply fixes from low to high risk.

Command examples

Replace sample resource names with real values and store passwords, tokens and keys in environment variables.

Risks

Before production changes, confirm backups, access boundaries, change windows and rollback paths.

Rollback plan

Keep original configuration and release versions; roll back config, images or database changes if metrics degrade.

Deliverables

Root-cause notes, key commands, remediation steps, verification results and follow-up recommendations.

!

Need help with a similar technical issue?

If your servers, Kubernetes, Docker, CI/CD, databases or monitoring systems have similar issues, submit logs and config files for remote diagnosis.

Ticket Contact on WhatsApp Consult