Skip to content

Commit

Permalink
Merge pull request #151 from yrro/debug-metrics-explainer
Browse files Browse the repository at this point in the history
Provide a message explaining that metrics are disabled when running i…
  • Loading branch information
rycus86 authored Feb 28, 2023
2 parents 73404e9 + b23d178 commit 39a1192
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions prometheus_flask_exporter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,17 @@ def register_endpoint(self, path, app=None):
(by default it is the application registered with this class)
"""

if is_running_from_reloader() and not os.environ.get('DEBUG_METRICS'):
return

if app is None:
app = self.app or current_app

if is_running_from_reloader() and not os.environ.get('DEBUG_METRICS'):
app.logger.debug(
'Metrics are disabled when run in the Flask development server'
' with reload enabled. Set the environment variable'
' DEBUG_METRICS=1 to enable them anyway.'
)
return

@self.do_not_track()
def prometheus_metrics():
accept_header = request.headers.get("Accept")
Expand Down

0 comments on commit 39a1192

Please sign in to comment.