nic-6443 commented on code in PR #14034:
URL: https://github.com/apache/apisix/pull/14034#discussion_r4278880540
##########
apisix/plugins/prometheus/exporter.lua:
##########
@@ -1186,6 +1203,9 @@ end
local function collect(yieldable)
+ -- the other processes report their own values on a timer
+ process_metrics.refresh()
+
Review Comment:
In APISIX this does not run per scrape. `collect()` is only called by the
privileged agent's `exporter_timer`, once per `refresh_interval`; a scrape just
returns the text cached in `prometheus-cache`. So it is already throttled to
exactly what you suggest. The call itself is cheap anyway: two timer counters,
one `collectgarbage("count")`, a cached `local_conf()` lookup, one shdict get,
two plain FFI field reads, and about seven gauge sets into the metric dict.
That is noise next to the rest of `collect()`, which walks every shared dict,
the health checkers and etcd and renders the whole exposition. I'd rather not
add a second throttle on top of the one the cache already gives us.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]