Skip to content

Commit

Permalink
chore(metrics): Added presigned url metric
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Malinowski authored and Edward Malinowski committed May 28, 2024
1 parent d0a7048 commit 9a9910b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fence/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ def app_config(
if config["ENABLE_PROMETHEUS_METRICS"]:
logger.info("Enabling Prometheus metrics...")
_setup_prometheus(app)
from prometheus_client import (
Counter,
)

presigned_url_counter = Counter(
"fence_presigned_url_requests_total",
"Total number of presigned URL requests",
Expand Down Expand Up @@ -525,16 +529,10 @@ def _setup_prometheus(app):
CollectorRegistry,
multiprocess,
make_wsgi_app,
Counter,
)

app.prometheus_registry = CollectorRegistry()
multiprocess.MultiProcessCollector(app.prometheus_registry)
presigned_url_counter = Counter(
"fence_presigned_url_requests_total",
"Total number of presigned URL requests",
registry=app.prometheus_registry,
)
# Add prometheus wsgi middleware to route /metrics requests
app.wsgi_app = DispatcherMiddleware(
app.wsgi_app, {"/metrics": make_wsgi_app(registry=app.prometheus_registry)}
Expand Down

0 comments on commit 9a9910b

Please sign in to comment.