GithubHelp home page GithubHelp logo

Comments (3)

trallnag avatar trallnag commented on May 26, 2024 1

Hey @codyflynnNC, I'd prefer not to include a metric_namespace attribute in the instrumentation module. The idea is to separate the actual definition of the metrics (here) and the instrumentation (here)that gets data from FastAPI. If we add metric_namespace a user would assume that it will be respected by all functions you can find in the metrics module which is not the case.

If you want to set the namespace go for:

instrumentator.add(metrics.default(metric_namespace="name_space"))

Or add your own function instead which gives you more control. If you have other questions I'm happy to help

from prometheus-fastapi-instrumentator.

cmflynn avatar cmflynn commented on May 26, 2024

So after looking through the source code, it seems the default instrument function:

if len(self.instrumentations) == 0: self.instrumentations.append(metrics.default())

while the instantiation of the class does not take in instrumentation args. I'd propose a change to the instantation of the class to take in the namepsace arg, then pass that into if len(self.instrumentations) == 0: self.instrumentations.append(metrics.default(metric_namespace=self.metric_namespace))

if this makes sense im happy to create a PR

from prometheus-fastapi-instrumentator.

cmflynn avatar cmflynn commented on May 26, 2024

Thanks for the quick response. that works perfectly. I'll close this issue.

from prometheus-fastapi-instrumentator.

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.