restreamer, thrimshim: Allow /metrics/* in addition to /metrics

This allows the metrics proxying from nginx to work even if the path is not rewritten,
which is hard to do in k8s.
pull/197/head
Mike Lang 4 years ago committed by Hubbe
parent fbcfea745a
commit 48ef416dfb

@ -86,6 +86,13 @@ def metrics():
"""Return current metrics in prometheus metrics format""" """Return current metrics in prometheus metrics format"""
return prom.generate_latest() return prom.generate_latest()
# To make nginx proxying simpler, we want to allow /metrics/* to work
@app.route('/metrics/<trailing>')
@request_stats
def metrics_with_trailing(trailing):
"""Expose Prometheus metrics."""
return prometheus_client.generate_latest()
@app.route('/files') @app.route('/files')
@request_stats @request_stats
def list_channels(): def list_channels():

@ -90,6 +90,13 @@ def authenticate(f):
def test(editor=None): def test(editor=None):
return json.dumps(editor) return json.dumps(editor)
# To make nginx proxying simpler, we want to allow /metrics/* to work
@app.route('/metrics/<trailing>')
@request_stats
def metrics_with_trailing(trailing):
"""Expose Prometheus metrics."""
return prometheus_client.generate_latest()
@app.route('/metrics') @app.route('/metrics')
@request_stats @request_stats
def metrics(): def metrics():

Loading…
Cancel
Save