Skip to content

Commit

Permalink
feat: add prometheus metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf Grubenmann committed Oct 13, 2023
1 parent 80f70f5 commit 689929c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
41 changes: 35 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ redis = { version = ">=3.5.3,<4.6.0,!=4.5.5", optional = true }
rq = { version = "==1.15.0", optional = true }
sentry-sdk = { version = ">=1.5.11,<1.26.0", extras = ["flask"], optional = true }
walrus = { version = ">=0.8.2,<0.10.0", optional = true }
prometheus-flask-exporter = "^0.22.4"

[tool.poetry.group.dev.dependencies]
black = "==23.1.0"
Expand Down Expand Up @@ -301,6 +302,7 @@ module = [
"pexpect",
"PIL",
"pluggy",
"prometheus_flask_exporter",
"psutil",
"pyld",
"pyshacl",
Expand Down
3 changes: 3 additions & 0 deletions renku/ui/service/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import sentry_sdk
from flask import Flask, Response, jsonify, request, url_for
from jwt import InvalidTokenError
from prometheus_flask_exporter import PrometheusMetrics
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations.rq import RqIntegration
Expand Down Expand Up @@ -73,6 +74,8 @@ def create_app(custom_exceptions=True):
app.config["MAX_CONTENT_LENGTH"] = MAX_CONTENT_LENGTH

app.config["cache"] = cache
metrics = PrometheusMetrics.for_app_factory()
metrics.init_app(app)

build_routes(app)

Expand Down

0 comments on commit 689929c

Please sign in to comment.