GithubHelp home page GithubHelp logo

Comments (4)

trallnag avatar trallnag commented on June 16, 2024

Hi Bohdan, when you say custom metrics, do you mean additional "instrumentation functions" or just any Prometheus metric like a counter unrelated to PFI?

In any case both is possible.

For 1., the default set of instrumention metrics for PFI is in a dedicated function. So you can add both, the default set and additional functions, with add().

For 2., it should just work. PFI uses the official prometheus library under the hood.

from prometheus-fastapi-instrumentator.

BohdanKaminskyi avatar BohdanKaminskyi commented on June 16, 2024

@trallnag Thx for the answer, would you mind answering one more question?:)
I need to increase counter value basically in one of my endpoints. But I'm not sure how to register that counter without closure.
I mean, in examples, the counter lives in closure, and only accessible from it, but that way I cannot use it from endpoint

from prometheus-fastapi-instrumentator.

trallnag avatar trallnag commented on June 16, 2024

Accessing metrics defined within these closures is not possible from endpoint functions, I'm afraid. At least to my knowledge. Why do you want to access it from endpoint?

Can't you define the metric yourself somewhere outside the endpoint and reference it then? Basically not using PFI and just using prometheus client library?

from prometheus-fastapi-instrumentator.

BohdanKaminskyi avatar BohdanKaminskyi commented on June 16, 2024

I'm trying to do so, and it looks like PFI still adds this metric into metrics endpoint (that's good:))

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.