prometheus / prometheus/client_python

prometheus_client.generate_latest()

Open
#986 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
876
Avg merge
8d 4h
Merged PRs (30d)
1

Description

Hi,

I use this method in combination with fastAPI in order to expose metrics over the API. The data come from a JSON file saved on Linux system (where the service runs).

When changing the values in the file in order to create metrics the metric value does not change, only when restarting the web server (Uvicorn).

Why are the changed values not recalculated?

For opening the file I use the standard command with open('filename.json', mode = 'r') as f:

Thank you in advance for the feedback!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with prometheus_client.generate_latest() and reproduce the reported behavior in the FastAPI/Uvicorn setup using values read from the JSON file on Linux. The issue does not name a source file or test; first determine whether changed file values should be reflected without restarting, then document the cause or add a focused fix and verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, prometheus, python
Domain
api, backend, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.