Giter Site home page Giter Site logo

Comments (2)

bhovhannes avatar bhovhannes commented on May 21, 2024 1

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 to prom-client, including prefix.
  • 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.

SkeLLLa avatar SkeLLLa commented on May 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.