Comments (2)
Hi @warmfusion ,
Prometheus doesn't support declaring the same metric twice, that's why you get the error. Arguably, this library could help you merge them together, but I'm not sure the underlying client library supports that, I can have a look.
For your particular use case, you should be able to do this just like the the README suggests:
If you want to apply the same metric to multiple (but not all) endpoints, create its wrapper first, then add to each function.
app = Flask(__name__)
metrics = PrometheusMetrics(app)
by_path_counter = metrics.counter(
'by_path_counter', 'Request count by request paths',
labels={'path': lambda: request.path}
)
@app.route('/simple')
@by_path_counter
def simple_get():
pass
@app.route('/plain')
@by_path_counter
def plain():
pass
Does this help?
from prometheus_flask_exporter.
Closing this old issue, but feel free to reopen (or open a new one) if you have any problems or questions!
from prometheus_flask_exporter.
Related Issues (20)
- prometheus_flask_exporter/examples/uwsgi-lazy-apps/server.py HOT 6
- Registering new collectors with GunicornInternalPrometheusMetrics HOT 1
- Gunicorn mutliprocess with app factory pattern examples HOT 1
- two questions about filtering information (only need path info, omit static file like *.css) HOT 3
- With `group_by='url_rule'` all unhandled URLs become `None` in metrics HOT 5
- Lambda functions on metrics page HOT 5
- Question: is it possible to group metrics of endpoints that use path parameters? HOT 2
- Receiving 404 when trying to curl /metrics HOT 6
- How to clean PROMETHEUS_ MULTIPROC_ HOT 2
- Could not import prometheus_flask_exporter.multiprocess HOT 4
- Enum metric type not supported HOT 2
- Support connexion 3.0 HOT 2
- Gunicorn metrics don't work HOT 6
- Not receiving process_* in multiprocess HOT 3
- Request for help of using it HOT 1
- metrics include path parameters instead of setting them as a field HOT 2
- Gunicorn flask metrics exporting HOT 3
- custom metrics return function memory location HOT 4
- Is working outside of request context possible HOT 1
- How to return flask_http_request_duration_milliseconds_bucket instead of flask_http_request_duration_seconds_bucket HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prometheus_flask_exporter.