問題文
A code path in the logistics pipeline is called more than a hundred thousand times per second. What does the instrumentation guidance say about adding metrics there?
選択肢
- Increase the scrape interval for that target, because the cost of instrumentation is dominated by the scrape rather than by the recording of each call.
- Move the metric updates into a background thread, because the guidance recommends decoupling recording from the hot path entirely.
- Limit the number of metrics updated in the inner loop and avoid labels or cache the label lookup, and benchmark to determine the actual impact.
- Do not instrument such code paths at all, because the overhead of any metric update is prohibitive at that call rate.