โ† All PCA Flashcard Decks

Querying & Visualization Flashcards

7 cards from real PCA practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Querying & Visualization flashcards as text
  1. What is the correct PromQL syntax for a subquery that evaluates `rate(http_requests_total[5m])` over the last 1 hour at 1-minute resolution?

    Answer: `rate(http_requests_total[5m])[1h:1m]`

    Subquery syntax appends `[range:resolution]` to a range expression, so `[1h:1m]` evaluates the inner expression over 1 hour at 1-minute steps.

  2. How does the `offset` modifier affect a PromQL query like `http_requests_total offset 1h`?

    Answer: It retrieves the metric value as it was 1 hour ago

    The `offset` modifier shifts the query's evaluation point backward in time, so `offset 1h` returns the value the metric had 1 hour ago.

  3. What is the recommended naming convention for a recording rule that pre-computes `sum(rate(http_requests_total[5m])) by (job)`?

    Answer: `job:http_requests_total:rate5m`

    Prometheus recommends the naming pattern `level:metric:operations` for recording rules, where level is the aggregation label, metric is the base metric, and operations describe the transformations applied.

  4. What does Prometheus do when it encounters a 'stale marker' for a time series?

    Answer: It marks the series as stale and stops returning it in queries after the staleness window

    Prometheus sends stale markers when a target disappears, causing the series to be marked stale and excluded from query results after the staleness period (default 5 minutes).

  5. What is the purpose of the `resets()` function in PromQL?

    Answer: Returns the number of counter resets (value drops) within the range window

    `resets(v range-vector)` returns the number of times the counter reset (decreased) within the specified range, useful for detecting service restarts.

  6. When visualizing metrics in Grafana, what does 'legend format' allow you to customize?

    Answer: The display name of each series in the legend using label values

    Legend format lets you define a template using label names (e.g., `{{instance}} - {{job}}`) to create meaningful legend labels for each time series.

  7. Which PromQL expression correctly computes the error rate as a percentage of total HTTP requests?

    Answer: `rate(http_requests_total{status=~"5.."}[5m])` / `rate(http_requests_total[5m])` * 100

    Using `rate()` on both numerator and denominator normalizes for time, and multiplying by 100 converts the ratio to a percentage; raw counters should not be divided directly.