Interview questions

Observability interview questions

13 questions, 13 with model answers. Every member practises all of them free.

Samples

3 of 13 questions.

How do logs, metrics, and traces work together in observability?

Show the answer

The three pillars of observability serve complementary roles:

  • Metrics: numeric measurements aggregated over time (counters, gauges, histograms). Efficient for alerting and dashboards. Example: request rate, CPU utilization, error rate. Tools: Prometheus, CloudWatch, Datadog.
  • Logs: timestamped, structured or unstructured text records of discrete events. Rich in context for debugging a specific error. Tools: Loki, Elasticsearch (ELK), CloudWatch Logs.
  • Traces: end-to-end records of a request as it flows through multiple services. Each trace is composed of spans; each span records the operation, duration, and parent-child relationships. Tools: Jaeger, Zipkin, AWS X-Ray, Tempo.

How they work together:

  1. A Prometheus alert fires on high error rate (metric).
  2. You drill into Grafana → link to Loki logs for that time window → find a specific error log with a trace ID.
  3. You open Tempo with that trace ID to see which microservice in the chain is slow or failing.

OpenTelemetry provides a unified SDK/collector to instrument all three signals and ship them to any backend.

You've been asked to move from centralized logging to a service-mesh-based observability model. What are your tradeoffs?

Show the answer

Centralized logging (current):

  • Simple mental model: all logs flow to one place (ELK, Loki).
  • Application teams own what they log.
  • Easy to query across services.
  • High cardinality logs can be expensive to store.

Service-mesh-based observability (Istio/Linkerd):

  • Pros: automatic L7 metrics (request rate, error rate, latency) per service pair without code changes; automatic mTLS; distributed tracing headers injected by Envoy sidecar; consistent golden signals for all services.
  • Cons: sidecar overhead (CPU/memory per pod); control plane complexity; traces only cover inter-service calls (not internal app behavior); application-level business logic still needs custom logging; observability blind spots for non-HTTP protocols.

My recommendation: complement, not replace. Use the service mesh for infrastructure-level telemetry (L7 metrics, traces, mTLS audit) and keep centralized logging for application-level events and business logic. Use the OpenTelemetry Collector as the unifying agent.

How do you set up custom metrics for Kubernetes pods?

Show the answer
  1. Instrument the application: expose a /metrics endpoint in Prometheus format (using the Prometheus client library for your language).
  2. Configure Prometheus scraping: add a ServiceMonitor (if using the Prometheus Operator) or add a scrape config in prometheus.yml:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: myapp
  namespace: monitoring
spec:
  selector:
    matchLabels:
      app: myapp
  endpoints:
    - port: metrics
      interval: 30s
  1. HPA on custom metrics: deploy the Prometheus Adapter; configure it to expose your metric via the custom.metrics.k8s.io API:
rules:
  - seriesQuery: 'http_requests_total{namespace!="",pod!=""}'
    resources:
      overrides:
        namespace: {resource: "namespace"}
        pod: {resource: "pod"}
    metricsQuery: 'rate(http_requests_total[2m])'
  1. Create an HPA referencing the custom metric.

10 more in the member app, with practice sets and your own marks. Join free

More topics

Other interview topics.