SkeLLLa / fastify-metrics

Prometheus metrics exporter for Fastify
https://savelife.in.ua/en/donate-en/
MIT License
96 stars 33 forks source link

feat: add way to inject custom prom-client instance #100

Closed wiktor-obrebski closed 8 months ago

wiktor-obrebski commented 8 months ago

As fastify-metrics use internal, specific version of prom-client, it sometimes provide situations, where it need to share the promClient instance with external code. Often there much more other sources of metrics that need to be collection, other than fastify requests.

Currently, it possible to get internally used promClient instance by fastifyApp.metrics.client, but its not very convinient to use.

This PR introduce a way to provide external promClient instance to use with fastify-metrics.

-- Additional advantage of this solution is to decrease risk of unintentional usage of 2 different promClient instances. It is possible when the project use different version of prom-client than the fastify-metrics use internally.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (fabf6d7) 98.85% compared to head (7e1537e) 98.85%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #100 +/- ## ======================================= Coverage 98.85% 98.85% ======================================= Files 2 2 Lines 174 175 +1 Branches 73 74 +1 ======================================= + Hits 172 173 +1 Misses 1 1 Partials 1 1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 8 months ago

:tada: This PR is included in version 10.6.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: