What is a scrape target, and how does service discovery find them? [Basic]
Answer
A scrape target is an endpoint Prometheus will scrape for metrics, typically host:port plus a metrics path. Service discovery finds targets automatically and attaches labels that can be relabeled before storage.
Technical explanation
In Kubernetes, targets can come from pods, services, endpoints, EndpointSlices, or custom resources through the Prometheus Operator.
Relabeling controls which targets are kept and how discovery metadata becomes Prometheus labels.
Good target labels should identify job, instance, namespace, service, pod, and environment without adding unbounded values.
Hands-on example
Hands-on: open Prometheus UI -> Status -> Targets. Verify the checkout target is UP, check last scrape duration and error, then query up{namespace='prod', service='checkout'}. If the target is missing, inspect ServiceMonitor labels and endpoint port names.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Observability interview questions
- How does Prometheus collect metrics — what is the pull model and scraping? [Basic]
- What is the difference between an exporter and instrumenting your app directly? [Basic]
- What is the difference between a counter and a gauge? [Basic]
- What is the Pushgateway, and why is it discouraged for most cases? [Basic]
- What are the Prometheus metric types (counter, gauge, histogram, summary)? [Basic]
- What is PromQL, and what is an instant vector versus a range vector? [Basic]
- What is a time series in Prometheus, and how is it identified (metric name plus labels)? [Basic]
- What is the difference between rate() and irate()? [Basic]