# What this PR does Add OnCall prometheus metrics exporter ## Which issue(s) this PR fixes ## Checklist - [x] Tests updated - [ ] Documentation added - [ ] `CHANGELOG.md` updated --------- Co-authored-by: Joey Orlando <joey.orlando@grafana.com> Co-authored-by: Matias Bordese <mbordese@gmail.com>
11 lines
424 B
Python
11 lines
424 B
Python
from django.http import HttpResponse
|
|
from prometheus_client import generate_latest
|
|
from rest_framework.views import APIView
|
|
|
|
from .metrics_collectors import application_metrics_registry
|
|
|
|
|
|
class MetricsExporterView(APIView):
|
|
def get(self, request):
|
|
result = generate_latest(application_metrics_registry).decode("utf-8")
|
|
return HttpResponse(result, content_type="text/plain; version=0.0.4; charset=utf-8")
|