nerdexam
Linux_Foundation

KCNA · Question #70

Which of the following is a valid PromQL query?

The correct answer is D. http_requests_total(job="apiserver"). PromQL (Prometheus Query Language) uses a specific syntax for metric selection and filtering, where filters are enclosed in curly braces.

Submitted by hans_de· May 4, 2026Cloud Native Observability

Question

Which of the following is a valid PromQL query?

Options

  • ASELECT * from http_requests_total WHERE job=apiserver
  • Bhttp_requests_total WHERE (job="apiserver")
  • CSELECT * from http_requests_total
  • Dhttp_requests_total(job="apiserver")

How the community answered

(38 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    8% (3)
  • D
    87% (33)

Why each option

PromQL (Prometheus Query Language) uses a specific syntax for metric selection and filtering, where filters are enclosed in curly braces.

ASELECT * from http_requests_total WHERE job=apiserver

PromQL does not use SQL-like keywords such as `SELECT * from` or `WHERE` for querying metrics.

Bhttp_requests_total WHERE (job="apiserver")

This syntax mixes the metric name with a `WHERE` clause, which is not valid PromQL; label selectors are enclosed in curly braces.

CSELECT * from http_requests_total

PromQL does not use `SELECT * from`; a metric name alone like `http_requests_total` is a valid basic query, but `SELECT * from` is incorrect syntax.

Dhttp_requests_total(job="apiserver")Correct

In PromQL, metric selectors use curly braces `{}` to specify label matchers. `http_requests_total` selects the metric, and `{job="apiserver"}` filters the results to only include those where the `job` label has the value `apiserver`, which is the correct syntax for a metric selector.

Concept tested: PromQL query syntax

Source: https://prometheus.io/docs/prometheus/latest/querying/basics/#metric-selectors

Topics

#PromQL#Prometheus#Query Language#Observability

Community Discussion

No community discussion yet for this question.

Full KCNA Practice