← 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 difference between `sum by (job)` and `sum without (instance)` when other labels are `job` and `instance`?

    Answer: `sum by (job)` keeps only the `job` label; `sum without (instance)` also keeps `job` but drops `instance` — same result here

    When only `job` and `instance` labels exist, both expressions yield the same result — `by (job)` keeps job, and `without (instance)` keeps everything except instance (i.e., job).

  2. What does the `topk(3, http_requests_total)` expression return?

    Answer: The 3 time series with the highest values at the current moment

    `topk(k, expr)` returns the k time series with the largest values at the current evaluation timestamp.

  3. What does the binary operator `unless` do in PromQL?

    Answer: Returns elements from the left-hand side that have NO matching elements on the right-hand side

    `unless` returns all elements of the left-hand vector for which there are no matching elements in the right-hand vector.

  4. When using `group_left` in a binary operation, what does it signify?

    Answer: The left-hand side has fewer unique label sets (many-to-one matching)

    `group_left` indicates a many-to-one match where multiple left-side series can match a single right-side series, and optionally copies labels from the right side.

  5. What does `count_values("status", http_requests_total)` produce?

    Answer: A new metric with a `status` label containing each unique value and a count of how many series have that value

    `count_values` groups all time series by their current value, creating a new series per unique value with a label named by the first argument containing that value.

  6. In PromQL binary operations, what is the default matching behavior when no `on()` or `ignoring()` clause is specified?

    Answer: All labels must match exactly (one-to-one matching on all labels)

    By default, PromQL performs one-to-one matching requiring all labels to be identical between the left and right operands.

  7. Which aggregation operator would you use to calculate the number of time series that currently have a value greater than 0?

    Answer: `count(metric > 0)`

    `count()` aggregates by counting the number of elements in the resulting vector, so `count(metric > 0)` counts series where the condition is true.