A legacy app has no `/metrics` endpoint and cannot be changed. How do you get metrics out of it?
IntermediateScenarioPrometheus and PromQL at Scale
Answer
Situation read → Without code access you must observe the app from outside or translate its existing outputs.
What I'd do →
- If it writes logs with useful lines, use mtail or grok_exporter to derive counters and histograms from the log stream.
- If it emits StatsD or JMX, use statsd_exporter or the JMX exporter as a Java agent.
- If it has a management API or DB, write a small exporter or use the matching community exporter.
- Otherwise monitor from outside with blackbox probes and process metrics from
node_exporterorprocess-exporter. - Document the gap and plan native instrumentation.
Why → Translating existing signals is faster than modifying legacy code and gives metrics right away.
Interview tip → Prefer the lowest-effort source of truth, and record the tech debt.
More on Prometheus and PromQL at Scale
Prometheus memory has grown to 60 GB and keeps climbing. How do you find the cause?IntermediateA developer added `user_id` as a metric label. What is the problem and what do you advise?BeginnerYour dashboard shows the average of per-pod p99 latencies. Why is it wrong, and how do you compute a correct fleet-wide p99?IntermediateChoose histogram bucket boundaries for a service with a 300 ms latency SLO.AdvancedYou have 500 short-lived batch jobs that finish before Prometheus can scrape them. How do you capture their metrics?IntermediateYour EC2 fleet autoscales constantly. How do you keep Prometheus targets up to date?Intermediate