Comments (2)
After looking into sources of both fastify-metrics
and prom-client
I figured out how to configure what I want. Posting it here in case someone will face the same problems as me during upgrade.
So, if with v8 we wrote:
app.register(require(fastify-metrics), {
prefix: 'app_',
blacklist: [
`/internal/metrics`,
`/internal/health/readiness`
],
enableDefaultMetrics: true,
enableRouteMetrics: true
})
in v9 this should be written as:
app.register(require("fastify-metrics"), {
defaultMetrics: {
enabled: true, // this is the default value and can be omitted
prefix: 'app_'
},
routeMetrics: {
enabled: true, // this is the default value and can be omitted
routeBlacklist: [
`/internal/metrics`,
`/internal/health/readiness`
],
overrides: {
histogram: {
name: `app_http_request_duration_seconds`
},
summary: {
name: `app_http_request_summary_seconds`
}
},
}
})
- Essentially, all options under
defaultMetrics
key are being passed toprom-client
, includingprefix
. - To add prefix to request histogram and summary, one should use
overrides
key and provide a prefixed name. v9 does not use prefix passed for default metrics for request histogram and summary.
from fastify-metrics.
Configuration object in v9 changed and there's no compatibility between v8 and v9. See https://github.com/SkeLLLa/fastify-metrics/blob/master/docs/fastify-metrics.idefaultmetricsconfig.md, it extends DefaultMetricsCollectorConfiguration
from prom-client where prefix is configured.
from fastify-metrics.
Related Issues (20)
- expose metrics via another port HOT 3
- Support for fastify 4 HOT 1
- Recommended dashboards? HOT 1
- Broken ESM export in v9 HOT 3
- Default labels missing on custom metrics HOT 5
- Include Event Loop Utilization HOT 1
- auth support HOT 3
- [bug] Only metrics router can be exposed HOT 1
- [bug] new routeConfig types break route config for other plugins HOT 2
- Add new http default metrics HOT 5
- warning message HOT 6
- Performance optimizations HOT 3
- Route pattern for monitoring HOT 2
- Custom labels HOT 5
- opentelemetry HOT 1
- Use of deprecated routeConfig in fastify HOT 6
- Use of deprecated routerMethod in fastify HOT 1
- Plugin type mismatch when using fastify-metrics in an ESM project HOT 3
- High cardinality of labels in prometheus metrics - fastify-metrics v6.x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify-metrics.