-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Can't Add Collectors During Setup #11
Comments
Hmm, maybe I was too fast. I didn't fully understand the meaning of the options.CollectorRegistryInstance
??= (ICollectorRegistry)app.ApplicationServices.GetService(typeof(ICollectorRegistry))
?? Metrics.DefaultCollectorRegistry; |
Ah, I found the real issue. I guess I was partially correct. We use DI to inject a app.UsePrometheusServer(prometheusOptions =>
{
prometheusOptions.CollectorRegistryInstance = app.ApplicationServices.GetService<ICollectorRegistry>();
prometheusOptions.CollectorRegistryInstance.Add(new MySystemMetricCollector());
}); However it is a bit stupid. It would be better, if we got the |
Hi @Spinkelben! Sorry for the late response. If you are using DI integration library - the answer is simple: just remove the Currently we are using the following order:
So returning to the original issue: if you trying to register additional collectors - it would be better to resolve the However you probably right - it will be better try to resolve the actual collector registry before calling configuration method. |
With the change to use DI for injecting the ICollectorRegistry the
CollectorRegistryInstance
property ofPrometheusOptions
becomes useless. We used to configure our metrics like this.This no longer works. The property is null. If I create a new CollectorRegistry in this method it is ignored. So I would suggest you set it before invoking the setup function.
The text was updated successfully, but these errors were encountered: