Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Prometheus metrics for API requests #908

Merged
merged 4 commits into from
Feb 12, 2024
Merged

Conversation

psrok1
Copy link
Member

@psrok1 psrok1 commented Feb 9, 2024

Your checklist for this pull request

  • I've read the contributing guideline.
  • I've tested my changes by building and running the project, and testing changed functionality (if applicable)
  • I've added automated tests for my change (if applicable, optional)
  • I've updated documentation to reflect my change (if applicable)

What is the new behaviour?

/api/varz endpoint that exposes basic Prometheus metrics:

# HELP api_requests API request metrics
# TYPE api_requests gauge
api_requests{endpoint="api.serverdocsresource",method="GET",status_code="200",user="admin"} 2.0
api_requests{endpoint="api.fileresource",method="GET",status_code="200",user="admin"} 3.0
api_requests{endpoint="api.configstatsresource",method="GET",status_code="200",user="admin"} 1.0
api_requests{endpoint="api.configresource",method="GET",status_code="200",user="admin"} 1.0
api_requests{endpoint="api.metricsresource",method="GET",status_code="200",user="admin"} 1.0
api_requests{endpoint="api.loginresource",method="POST",status_code="200",user="172.19.0.7"} 1.0
api_requests{endpoint="api.quickqueryresource",method="GET",status_code="200",user="admin"} 4.0
api_requests{endpoint="api.userlistresource",method="GET",status_code="200",user="admin"} 4.0
api_requests{endpoint="api.remotelistresource",method="GET",status_code="200",user="admin"} 2.0
api_requests{endpoint="api.serverinforesource",method="GET",status_code="200",user="admin"} 1.0
api_requests{endpoint="api.serveradmininforesource",method="GET",status_code="200",user="admin"} 1.0

Endpoint requires authentication (API key) with access_prometheus_metrics capability.

TODO: Documentation

@psrok1 psrok1 mentioned this pull request Feb 12, 2024
4 tasks
@psrok1 psrok1 requested a review from nazywam February 12, 2024 12:05
mwdb/core/metrics/redis_counter.py Outdated Show resolved Hide resolved
mwdb/core/metrics/redis_counter.py Outdated Show resolved Hide resolved
@psrok1 psrok1 force-pushed the feature/prometheus-metrics branch from 91654cb to d7c7470 Compare February 12, 2024 13:31
@psrok1 psrok1 requested a review from nazywam February 12, 2024 13:40
@psrok1 psrok1 merged commit 3be33c6 into master Feb 12, 2024
12 checks passed
@psrok1 psrok1 deleted the feature/prometheus-metrics branch February 12, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants