GithubHelp home page GithubHelp logo

Comments (9)

trallnag avatar trallnag commented on May 26, 2024 3

If you want to do that don't use the provided expose method. Just instrument the API and expose the metrics endpoint yourself for example like this:

from prometheus_client import start_http_server

start_http_server(8000)

from prometheus-fastapi-instrumentator.

trallnag avatar trallnag commented on May 26, 2024 3

Hi @VMAtm, I can't reproduce your issue. Here is the example I tried: https://github.com/trallnag/prometheus-fastapi-instrumentator/tree/example-different-port/devel/examples/metrics-diff-port-uvicorn

from prometheus-fastapi-instrumentator.

VMAtm avatar VMAtm commented on May 26, 2024 1

Hi, sorry for bringing this old issue up.
Is there any example of start_http_server on a dedicated port?
I'm using FastAPI with uvicorn, and I want to export the metrics on a different port. I call start_http_server, but I never get any answer from that endpoint.
Is there any complete example of how this can be done?

from prometheus-fastapi-instrumentator.

VMAtm avatar VMAtm commented on May 26, 2024 1

Hi, sorry that this took so long. Your example is perfect, thank you, this worked

from prometheus-fastapi-instrumentator.

rajataneja101 avatar rajataneja101 commented on May 26, 2024

Thanks 👍

from prometheus-fastapi-instrumentator.

rajataneja101 avatar rajataneja101 commented on May 26, 2024

So default port will also work alongwith this port?

from prometheus-fastapi-instrumentator.

trallnag avatar trallnag commented on May 26, 2024

Not 100 % sure what you mean, but I would say yes 😄

from prometheus-fastapi-instrumentator.

VMAtm avatar VMAtm commented on May 26, 2024

Thank you @trallnag
I'll check on my side, thank you for the fast example!

from prometheus-fastapi-instrumentator.

trallnag avatar trallnag commented on May 26, 2024

Happy to hear that

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.