-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delay for pulling measurable methods #576
Comments
@oxaoo , I think you're basically looking for function like this - https://metrics.dropwizard.io/3.1.0/apidocs/com/codahale/metrics/CachedGauge.html , correct? |
Hi @donbourne, |
True... but when we created the original MP Metrics it was based on dropwizard metrics... we just removed a lot of the non-core function from dwm to provide something simpler. Your proposed solution looks pretty good -- but I realize it's not as convenient as a gauge that just handles the caching for you would be. |
Does it follow that it's not intended to introduce such functionality into MP Metrics? |
Not necessarily. Just don't want to introduce it unless there's good need for it.
That use case actually seems more like a usecase for MP Health, no? Can you say a bit more about why you want to do that with metrics? |
@oxaoo as an aside, not directly related to what you're asking for in this issue, were you thinking you'd like to have metrics for health statuses? ie. so that you could use Prometheus and alertmanager, for example, to tap into application health? If so, we might want another issue to pursue that idea. |
@donbourne, yes, the main idea is collecting metrics for health status and configure the alert rules in Prometheus. |
@oxaoo , I think that's a pretty good use case -- would you be interested in opening an issue over in https://github.com/eclipse/microprofile-health/issues for adding MP metrics for health checks? |
It also suggests that the thing that you may want to cache, for that particular use case, is the result of the health check, rather than the result from the Gauge. Keep in mind that Kubernetes will call your probes for liveness / readiness with a configurable delay between calls of periodSeconds (default 10 seconds). I'm not saying there aren't other cases for cached gauges -- just that gauges representing the result from health checks might be better cached by the health check if you don't want the health check to do its work too often. |
@oxaoo , something I've seen recently is that sometimes we have more than one Prometheus instance scraping from the same runtime. I'm wondering if it's better to have a caching Gauge, or a caching exporter? Benefit of a caching exporter would be that I could cache my entire response (ie. to /metrics) for a configurable period of time (eg. 10 seconds). WDYT? |
Hi,
There is a necessity to collect the gauge metric for the result of remote invocation, for instance:
This operation costs a lot and should be triggered every 5 minutes (not more often). Based on logs produced by
totalEntries()
method, found out that it triggered every second.I tried to find specification about pulling measurable resources (annotated with appropriate metric types) but it was unsuccessful.
As a workaround I can use following approach:
But nonetheless I would like to have a solution out of the box.
Please, answer my following questions:
Additional information:
Payara AS version is 5.194.
The fish.payara.extras.payara-embedded-all version is 5.194 (if I'm correct it includes the microprofile-metrics v2.0)
Best Regards,
Alex
The text was updated successfully, but these errors were encountered: