Logging, Metrics, Tracing & Alerting Interview Questions Hindi mein

Logging, Metrics, Tracing & Alerting कोर्स के 35 सवाल, हर सवाल के सही जवाब और explanation के साथ। जवाब देखने से पहले ख़ुद सोचें।

Prerequisites and the Observability Mental Model

1. Which statement best describes observability?

  1. A dashboard that shows CPU and memory for every server
  2. The ability to answer new questions about a system's internal state from the telemetry it already emits
  3. A paging system that wakes engineers when a threshold is crossed
  4. Running a debugger against production processes
जवाब देखें

जवाब: The ability to answer new questions about a system's internal state from the telemetry it already emits

Observability is about answering questions you did not anticipate, using existing telemetry. Dashboards and paging are parts of monitoring that build on it.

पाठ: Monitoring vs Observability

2. An alert fires because the 5xx error rate doubled. Which signal is the best next step to find which downstream service is slow for the failing requests?

  1. Another metric with a higher scrape interval
  2. Raw CPU usage of the load balancer
  3. Distributed traces of the failing requests
  4. The application's startup logs
जवाब देखें

जवाब: Distributed traces of the failing requests

Traces show each hop of a request with timings and error status, so they quickly point to the slow or failing downstream service.

पाठ: Logs, Metrics and Traces

3. Why do telemetry SDKs use bounded in-memory queues that drop data when full?

  1. To keep the application responsive even if the telemetry backend is slow or down
  2. Because backends reject batches larger than one item
  3. To guarantee every span is stored exactly once
  4. Because dropping data improves query accuracy
जवाब देखें

जवाब: To keep the application responsive even if the telemetry backend is slow or down

A bounded queue protects the application: when the backend cannot keep up, telemetry is dropped instead of blocking requests or exhausting memory.

पाठ: The Telemetry Pipeline

Logging Foundations

4. A payment gateway call failed, the code retried once and the retry succeeded. What level fits the first failure best?

  1. CRITICAL
  2. ERROR
  3. DEBUG
  4. WARNING
जवाब देखें

जवाब: WARNING

The system handled the problem and the user was not affected, which is exactly what WARNING is for. ERROR should be reserved for failures that affected an operation.

पाठ: Log Levels and What to Log

5. What is the main advantage of a constant message plus fields, such as msg="payment ok" with duration_ms=812, over a sentence with values embedded?

  1. It makes each log line shorter on disk in all cases
  2. Backends can filter and aggregate on fields without fragile text parsing
  3. It removes the need for log levels
  4. It encrypts the values automatically
जवाब देखें

जवाब: Backends can filter and aggregate on fields without fragile text parsing

Named fields let the backend query `duration_ms > 500` or group by a field directly. JSON is not always shorter and it does not encrypt anything.

पाठ: Structured Logging

6. Why is a correlation ID stored in request-scoped context rather than a global variable?

  1. Global variables cannot hold strings in Python
  2. Context variables are faster to read than globals
  3. Concurrent requests would overwrite one global value and their logs would be mislabelled
  4. Logging libraries refuse to read global variables
जवाब देखें

जवाब: Concurrent requests would overwrite one global value and their logs would be mislabelled

Many requests run at the same time. A single global would be overwritten by whichever request set it last; request-scoped context keeps one value per request.

पाठ: Correlation IDs and Log Context

Log Pipelines at Scale

7. Why do container platforms prefer applications to log to stdout instead of writing their own log files?

  1. stdout is encrypted by default
  2. Files inside a container can disappear when it is replaced, and the platform can collect stdout uniformly
  3. Writing files is not possible inside containers
  4. stdout automatically converts logs to JSON
जवाब देखें

जवाब: Files inside a container can disappear when it is replaced, and the platform can collect stdout uniformly

Container filesystems are ephemeral. Logging to stdout lets the runtime and a node-level agent collect every container's logs the same way.

पाठ: Shipping Logs off the Machine

8. In Loki, why should `request_id` be a field inside the log line rather than a label?

  1. Labels can only hold numbers
  2. LogQL cannot filter on labels
  3. Request IDs are never needed in queries
  4. Each unique label value creates a new stream, so high-cardinality labels explode the index
जवाब देखें

जवाब: Each unique label value creates a new stream, so high-cardinality labels explode the index

Loki indexes label combinations as streams. Unbounded values such as request IDs create huge numbers of streams; keep them in the line and filter at query time.

पाठ: Storing and Querying Logs

9. A service logs every successful health check, producing most of its log volume. What is the best fix?

  1. Delete the health-check endpoint
  2. Raise the whole service's log level to ERROR
  3. Drop or sample successful health-check lines and keep logging failures
  4. Move the logs to a bigger disk
जवाब देखें

जवाब: Drop or sample successful health-check lines and keep logging failures

Sampling or dropping the repetitive success lines cuts volume while failures stay fully visible. Raising the level to ERROR would also hide useful INFO events.

पाठ: Log Hygiene: Volume, Privacy and Sampling

Metrics Foundations

10. Which metric type fits "number of messages currently waiting in a queue"?

  1. Gauge
  2. Counter
  3. Histogram
  4. Summary
जवाब देखें

जवाब: Gauge

Queue depth rises and falls, so it is a gauge. A counter would only fit "total messages ever enqueued".

पाठ: Counters, Gauges, Histograms and Summaries

11. Which label is most likely to cause a cardinality explosion on an HTTP request counter?

  1. status="200"
  2. method="POST"
  3. region="ap-south-1"
  4. customer_email="a@b.com"
जवाब देखें

जवाब: customer_email="a@b.com"

Email addresses are effectively unbounded: every new customer creates new series. Status, method and region each have a small, fixed set of values.

पाठ: Labels and Cardinality

12. In the USE method, which measurement describes saturation of a database connection pool?

  1. The number of queries that returned an error
  2. The number of requests waiting to obtain a connection
  3. The total queries executed since startup
  4. The size of the database on disk
जवाब देखें

जवाब: The number of requests waiting to obtain a connection

Saturation is queued or waiting work. Requests waiting for a free connection show the pool cannot keep up, even before errors appear.

पाठ: RED, USE and the Four Golden Signals

Prometheus and PromQL

13. What does the automatically generated `up` metric tell you?

  1. Whether the last scrape of a target succeeded
  2. The uptime of the host in seconds
  3. How many users are currently online
  4. The number of alerts currently firing
जवाब देखें

जवाब: Whether the last scrape of a target succeeded

Prometheus sets up to 1 when a scrape succeeds and 0 when it fails, which makes it the simplest way to detect a dead or unreachable target.

पाठ: How Prometheus Works

14. Why is `rate()` applied to counters instead of graphing the raw counter value?

  1. Raw counters are encrypted
  2. The raw value only grows and resets on restart; rate turns it into a per-second speed that handles resets
  3. Counters cannot be stored without rate
  4. rate() converts a counter into a histogram
जवाब देखें

जवाब: The raw value only grows and resets on restart; rate turns it into a per-second speed that handles resets

A counter's absolute value depends on when the process started. Its rate of increase is what you care about, and rate() also corrects for resets.

पाठ: PromQL Essentials

15. Three pods report p99 latencies of 100 ms, 120 ms and 900 ms. What is the correct way to get the fleet p99?

  1. Average them: about 373 ms
  2. Take the maximum: 900 ms
  3. Sum the histogram buckets of all pods by le, then apply histogram_quantile
  4. Take the median: 120 ms
जवाब देखें

जवाब: Sum the histogram buckets of all pods by le, then apply histogram_quantile

Percentiles cannot be averaged or combined directly. Summing the underlying bucket counts and computing the quantile from the merged distribution is the correct approach.

पाठ: Percentiles and Histogram Queries

Distributed Tracing

16. What links a child span to the operation that caused it?

  1. Its parent span ID, within the same trace ID
  2. The hostname of the server it ran on
  3. Its start timestamp being later than the parent's
  4. A shared log level
जवाब देखें

जवाब: Its parent span ID, within the same trace ID

Each span stores the ID of its parent span, and all spans of a request share the trace ID. Timestamps alone cannot reliably reconstruct the tree.

पाठ: Anatomy of a Distributed Trace

17. In the header 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01, what does the final 01 mean?

  1. The protocol version
  2. The request is the first retry
  3. The span has finished successfully
  4. The trace-flags field with the sampled bit set
जवाब देखें

जवाब: The trace-flags field with the sampled bit set

The last field holds trace flags; the lowest bit set means the caller sampled this trace, so downstream services should usually record their spans too. The version is the leading 00.

पाठ: Context Propagation and traceparent

18. What is the main advantage of tail-based sampling over head-based sampling?

  1. It needs no memory in the collector
  2. It can keep traces based on their outcome, such as errors or high latency
  3. It works without propagating context
  4. It reduces the number of spans created by the application
जवाब देखें

जवाब: It can keep traces based on their outcome, such as errors or high latency

Tail sampling decides after the trace completes, so it can keep all errors and slow traces. The cost is buffering spans in the collector until the decision is made.

पाठ: Head and Tail Sampling

OpenTelemetry in Practice

19. Why can a third-party library depend on the OpenTelemetry API without forcing a backend on its users?

  1. The API automatically chooses the cheapest backend
  2. The API sends data directly to a fixed vendor
  3. The API stores telemetry in local files
  4. The API is a no-op until the application installs and configures an SDK
जवाब देखें

जवाब: The API is a no-op until the application installs and configures an SDK

The API only defines calls. Without an SDK it does nothing, so library authors can instrument their code and the application owner decides where, or whether, data goes.

पाठ: OpenTelemetry: The Big Picture

20. Which span name follows OpenTelemetry guidance best?

  1. charge order A17 for 499 rupees
  2. payments.charge, with the order ID stored as an attribute
  3. span-1
  4. a new random UUID per request
जवाब देखें

जवाब: payments.charge, with the order ID stored as an attribute

Span names should be low-cardinality so spans can be grouped. Variable details like the order ID belong in attributes.

पाठ: Instrumenting a Python Service

21. A processor is defined under `processors:` but not listed in any pipeline. What happens?

  1. It runs on every signal by default
  2. The Collector refuses to start
  3. It is not used, because only components referenced in a pipeline are active
  4. It runs only on traces
जवाब देखें

जवाब: It is not used, because only components referenced in a pipeline are active

Defining a component only configures it. It is enabled only when a pipeline under `service.pipelines` references it.

पाठ: The OpenTelemetry Collector

22. What is an exemplar?

  1. A trace ID attached to a metric sample, linking an aggregate to a concrete request
  2. A dashboard template
  3. A log line that has been sampled
  4. A synthetic test request
जवाब देखें

जवाब: A trace ID attached to a metric sample, linking an aggregate to a concrete request

Exemplars bridge metrics and traces: a metric observation carries the ID of a trace that contributed to it, so you can open an example request from a graph.

पाठ: Connecting Logs, Metrics and Traces

SLIs, SLOs and Dashboards

23. An API has a 99.5% availability SLO over 30 days and receives 2,000,000 requests in that window. How many failed requests does the error budget allow?

  1. 1,000
  2. 5,000
  3. 99,500
  4. 10,000
जवाब देखें

जवाब: 10,000

The budget is 0.5% of 2,000,000 requests, which is 10,000. 1,000 would be a 99.95% target.

पाठ: SLIs, SLOs, SLAs and Error Budgets

24. Why do burn-rate alerts combine a long window (1 h) with a short window (5 min)?

  1. The long window shows the problem is significant; the short window confirms it is still happening, so the alert resolves quickly
  2. Prometheus requires two windows in every rule
  3. The short window doubles the sampling rate
  4. It halves the storage needed for the metrics
जवाब देखें

जवाब: The long window shows the problem is significant; the short window confirms it is still happening, so the alert resolves quickly

Requiring both conditions avoids paging on brief spikes (the long window) and avoids alerts that keep firing long after recovery (the short window).

पाठ: Burn-Rate Alerting

25. What belongs at the top of a service overview dashboard?

  1. A pie chart of HTTP methods
  2. Per-pod garbage collection pauses
  3. SLO status and the RED signals for the service
  4. The raw log stream
जवाब देखें

जवाब: SLO status and the RED signals for the service

An overview should answer "are users OK?" at a glance: SLO and error budget, request rate, errors and latency. Detailed breakdowns belong on drill-down dashboards.

पाठ: Dashboards That Answer Questions

Alerting and On-Call

26. Which of these is the best candidate for a page?

  1. CPU usage on one node is at 85%
  2. A single pod restarted once and is healthy
  3. Disk usage reached 60%
  4. Checkout's error budget is burning 14x faster than planned over the last hour
जवाब देखें

जवाब: Checkout's error budget is burning 14x faster than planned over the last hour

The burn-rate alert is a user-facing symptom that needs action now. The others are causes that are often harmless and belong on dashboards or in tickets.

पाठ: Designing Alerts Worth Waking Up For

27. A shared database fails and 30 dependent services all fire error alerts within a minute. Which Alertmanager feature most directly turns this into a single notification?

  1. Silences
  2. Grouping
  3. repeat_interval
  4. Recording rules
जवाब देखें

जवाब: Grouping

Grouping bundles alerts that share the `group_by` labels and arrive close together into one notification. Inhibition could also help if a database-down alert exists, but grouping is the direct mechanism.

पाठ: Routing, Grouping and Silencing Alerts

28. During an outage caused by a bad deployment, what should the on-call engineer usually do first?

  1. Mitigate impact, for example by rolling back the release
  2. Write the postmortem document
  3. Find the engineer who wrote the bad code
  4. Add more dashboards
जवाब देखें

जवाब: Mitigate impact, for example by rolling back the release

Restore service first; investigation and the postmortem follow once users are no longer affected.

पाठ: On-Call, Runbooks and Postmortems

Performance, Cost, Security and Pitfalls

29. A team's metrics bill doubled after a release that added a `session_id` label to a request counter. What is the most effective fix?

  1. Increase the scrape interval
  2. Shorten log retention
  3. Switch dashboards to dark mode
  4. Remove the session_id label and keep session details in logs or traces
जवाब देखें

जवाब: Remove the session_id label and keep session details in logs or traces

The cost came from cardinality: every session created new series. Removing the unbounded label fixes the cause; scrape interval changes only reduce samples, not series.

पाठ: Cost and Performance Overhead

30. Why is exposing a service's `/metrics` endpoint on the public internet a risk?

  1. It disables scraping by Prometheus
  2. It can reveal internal details such as versions, hostnames and traffic patterns to attackers
  3. It encrypts the metrics so they become unreadable
  4. It makes counters reset more often
जवाब देखें

जवाब: It can reveal internal details such as versions, hostnames and traffic patterns to attackers

Metrics describe internals. Public exposure gives attackers reconnaissance information and can also be abused to load the service; keep such endpoints internal.

पाठ: Security and Privacy of Telemetry

31. A service's error-rate alert never fired during an outage because Prometheus could not scrape the service at all. Which addition would have caught it?

  1. A lower error-rate threshold
  2. A longer `for:` duration
  3. Alerts on `up == 0` and `absent()` for the job
  4. A dashboard with more panels
जवाब देखें

जवाब: Alerts on `up == 0` and `absent()` for the job

With no scraped data, the error-rate expression returns nothing. `up == 0` catches failed scrapes and `absent()` catches series that disappear entirely.

पाठ: Common Observability Pitfalls

Revision and Interview Prep

32. Which pairing is correct?

  1. Gauge: total requests since startup
  2. Summary: percentiles that can be aggregated across many pods
  3. Counter with rate(): requests per second
  4. Head sampling: keeps all error traces by design
जवाब देखें

जवाब: Counter with rate(): requests per second

A counter with rate() gives a per-second rate. Totals since startup are counters, summaries cannot be aggregated across pods, and head sampling decides before errors are known.

पाठ: Cheat Sheet

33. An interviewer asks how you would avoid paging for a 30-second error spike while still catching a real outage quickly. What is the strongest answer?

  1. Remove error alerts and rely on user complaints
  2. Alert when any single request fails
  3. Use a multi-window burn-rate alert: a long window for significance plus a short window to confirm it is ongoing
  4. Average the error rate over 30 days and alert monthly
जवाब देखें

जवाब: Use a multi-window burn-rate alert: a long window for significance plus a short window to confirm it is ongoing

Multi-window burn-rate alerts ignore brief spikes yet page quickly for serious, ongoing budget consumption.

पाठ: Common Interview Questions

34. In the walk-through, p50 latency was unchanged while p99 rose tenfold. What does that suggest?

  1. Every request became ten times slower
  2. The metrics pipeline is broken
  3. The load balancer is dropping half the traffic
  4. A subset of requests is very slow while the majority is unaffected
जवाब देखें

जवाब: A subset of requests is very slow while the majority is unaffected

An unchanged median with a much larger tail means most requests are normal and a minority, here those hitting the UPI gateway timeout, are very slow.

पाठ: Self-Check: Debugging a Slow Checkout

35. Which combination gives the most reliable fleet-wide picture of checkout latency and error rate?

  1. Counters and histograms aggregated with PromQL, because metrics are unsampled and cheap to aggregate
  2. Counting ERROR lines in sampled logs
  3. Averaging p99 values reported by each pod's summary
  4. Reading a few traces chosen at random
जवाब देखें

जवाब: Counters and histograms aggregated with PromQL, because metrics are unsampled and cheap to aggregate

Metrics cover all traffic without sampling and aggregate correctly when you use counters with rate() and histogram buckets. Logs may be sampled, summaries cannot be averaged, and a handful of traces is anecdotal.

पाठ: Self-Check: Mixed Revision

← कोर्स पर वापस जाएँ