Open CooFlow opened 1 year ago
Hi! Please check the README for excluding things you don't need or want: https://github.com/rycus86/prometheus_flask_exporter#default-metrics
You can avoid recording metrics on individual endpoints by decorating them with @metrics.do_not_track(), or use the excluded_paths argument when creating the PrometheusMetrics instance that takes a regular expression (either a single string, or a list) and matching paths will be excluded. These apply to both built-in and user-defined default metrics, unless you disable it by setting the exclude_user_defaults argument to False. If you have functions that are inherited or otherwise get metrics collected that you don't want, you can use @metrics.exclude_all_metrics() to exclude both default and non-default metrics being collected from it.
See also the https://github.com/rycus86/prometheus_flask_exporter#configuration section that has more customisation options.
thank you very much, I solved my second problem with your help.
metrics = PrometheusMetrics(app, excluded_paths=".*.js|.*.gif|.*.css|.*.mp4|.*.jpg|.*.png|.*.svg|.*.ico|.*.woff2")
however, I still don't know how to filter specific default
when I set
metrics = PrometheusMetrics(app,
excluded_paths=".*.js|.*.gif|.*.css|.*.mp4|.*.jpg|.*.png|.*.svg|.*.ico|.*.woff2",
exclude_user_defaults=False,
export_defaults=False,
)
I lose all default information, how can I make the last two metrics appear?
I don't need some of default metrics
To get those, you can follow the README instructions in https://github.com/rycus86/prometheus_flask_exporter#default-metrics
To register your own default metrics that will track all registered Flask view functions, use the register_default function. Note: register your default metrics after all routes have been set up. Also note, that Gauge metrics registered as default will track the /metrics endpoint, and this can't be disabled at the moment.
How do I save only the information I need?
I only need info about path count:
flask_http_request_duration_seconds_count{method="GET",path="/sanhe/products",status="200"} 2.0
how can I hidden following information in route /metrics: can I
Can I add filters to the information?
I don't need count static files like .js, .css
Thank you very much for checking my issue.