mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-21 15:31:00 +00:00
Add libretranslate namespace to prometheus metrics
This commit is contained in:
parent
b6111b95f8
commit
9d2a2cd55f
3 changed files with 10 additions and 10 deletions
14
README.md
14
README.md
|
@ -276,13 +276,13 @@ LibreTranslate has Prometheus [exporter](https://prometheus.io/docs/instrumentin
|
||||||
http://localhost:5000/metrics
|
http://localhost:5000/metrics
|
||||||
|
|
||||||
```
|
```
|
||||||
# HELP request_inprogress Multiprocess metric
|
# HELP libretranslate_http_requests_in_flight Multiprocess metric
|
||||||
# TYPE request_inprogress gauge
|
# TYPE libretranslate_http_requests_in_flight gauge
|
||||||
request_inprogress{api_key="",endpoint="/translate",request_ip="127.0.0.1"} 0.0
|
libretranslate_http_requests_in_flight{api_key="",endpoint="/translate",request_ip="127.0.0.1"} 0.0
|
||||||
# HELP request_seconds Multiprocess metric
|
# HELP libretranslate_http_request_duration_seconds Multiprocess metric
|
||||||
# TYPE request_seconds summary
|
# TYPE libretranslate_http_request_duration_seconds summary
|
||||||
request_seconds_count{api_key="",endpoint="/translate",request_ip="127.0.0.1",status="200"} 0.0
|
libretranslate_http_request_duration_seconds_count{api_key="",endpoint="/translate",request_ip="127.0.0.1",status="200"} 0.0
|
||||||
request_seconds_sum{api_key="",endpoint="/translate",request_ip="127.0.0.1",status="200"} 0.0
|
libretranslate_http_request_duration_seconds_sum{api_key="",endpoint="/translate",request_ip="127.0.0.1",status="200"} 0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then configure `prometheus.yml` to read the metrics:
|
You can then configure `prometheus.yml` to read the metrics:
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
1.3.5
|
1.3.6
|
||||||
|
|
|
@ -192,10 +192,10 @@ def create_app(args):
|
||||||
multiprocess.MultiProcessCollector(registry)
|
multiprocess.MultiProcessCollector(registry)
|
||||||
return Response(generate_latest(registry), mimetype=CONTENT_TYPE_LATEST)
|
return Response(generate_latest(registry), mimetype=CONTENT_TYPE_LATEST)
|
||||||
|
|
||||||
measure_request = Summary('request_seconds', 'Time spent on request', ['endpoint', 'status', 'request_ip', 'api_key'])
|
measure_request = Summary('libretranslate_http_request_duration_seconds', 'Time spent on request', ['endpoint', 'status', 'request_ip', 'api_key'])
|
||||||
measure_request.labels('/translate', 200, '127.0.0.1', '')
|
measure_request.labels('/translate', 200, '127.0.0.1', '')
|
||||||
|
|
||||||
gauge_request = Gauge('request_inprogress', 'Active requests', ['endpoint', 'request_ip', 'api_key'], multiprocess_mode='livesum')
|
gauge_request = Gauge('libretranslate_http_requests_in_flight', 'Active requests', ['endpoint', 'request_ip', 'api_key'], multiprocess_mode='livesum')
|
||||||
gauge_request.labels('/translate', '127.0.0.1', '')
|
gauge_request.labels('/translate', '127.0.0.1', '')
|
||||||
|
|
||||||
def access_check(f):
|
def access_check(f):
|
||||||
|
|
Loading…
Reference in a new issue