Skip to content

Commit

Permalink
Merge pull request #716 from nledez/prometheus-metrics
Browse files Browse the repository at this point in the history
[WIP] Add prometheus /metrics
  • Loading branch information
EvanBldy authored Oct 10, 2023
2 parents f092b20 + d4dd940 commit 1a6039c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ install_requires =
OpenTimelineIO==0.15.0
orjson==3.9.7
pillow==10.0.1
prometheus-flask-exporter==0.22.4
psutil==5.9.5
psycopg[binary]==3.1.12
pygelf==0.4.2
Expand Down
16 changes: 16 additions & 0 deletions zou/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,24 @@ def add_permissions(_, payload):

def load_api():
from zou.app import api
from zou import __version__ as zou_version

api.configure(app)
try:
from prometheus_flask_exporter.multiprocess import (
GunicornPrometheusMetrics,
)

metrics = GunicornPrometheusMetrics(
app, defaults_prefix="zou", group_by="url_rule"
)
except ValueError:
from prometheus_flask_exporter import RESTfulPrometheusMetrics

metrics = RESTfulPrometheusMetrics(
app, api, defaults_prefix="zou", group_by="url_rule"
)
metrics.info("zou_info", "Application info", version=zou_version)

fs.mkdir_p(app.config["TMP_DIR"])
configure_auth()
Expand Down

0 comments on commit 1a6039c

Please sign in to comment.