Bird
0
0

You configured Prometheus to scrape localhost:9090 but no metrics appear. Which fix is correct?

medium📝 Troubleshoot Q14 of 15
Microservices - Monitoring and Observability
You configured Prometheus to scrape localhost:9090 but no metrics appear. Which fix is correct?
AChange target to <code>localhost:9090/metrics</code> in YAML
BRemove <code>job_name</code> from config
CRestart Prometheus to reload config
DAdd <code>metrics_path: '/metrics'</code> under the scrape job
Step-by-Step Solution
Solution:
  1. Step 1: Understand default metrics path

    Prometheus scrapes /metrics path by default, but if the service uses a different path, you must specify it.
  2. Step 2: Fix missing metrics path

    Adding metrics_path: '/metrics' explicitly tells Prometheus where to get metrics if not default or to confirm path.
  3. Final Answer:

    Add metrics_path: '/metrics' under the scrape job -> Option D
  4. Quick Check:

    metrics_path fixes scrape URL [OK]
Quick Trick: Use metrics_path to set correct scrape URL path [OK]
Common Mistakes:
MISTAKES
  • Adding path in targets instead of metrics_path
  • Restarting without config fix
  • Removing job_name breaks config

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes