mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Fix bugs in metrics tooling
This commit is contained in:
@@ -43,7 +43,7 @@ class Metric(object):
|
||||
else:
|
||||
named_labels = []
|
||||
for labelname in self.labelnames:
|
||||
named_labels.append('{}="{}",'.format(labelname, labels[labelname]))
|
||||
named_labels.append('{}="{}"'.format(labelname, labels[labelname]))
|
||||
|
||||
return metricname + "{" + ",".join(named_labels) + "}"
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import base64
|
||||
import hmac
|
||||
|
||||
from django.conf import settings
|
||||
@@ -26,7 +27,7 @@ def serve_metrics(request):
|
||||
if method.lower() != "basic":
|
||||
return unauthed_response()
|
||||
|
||||
user, passphrase = credentials.strip().decode("base64").split(":", 1)
|
||||
user, passphrase = base64.b64decode(credentials.strip()).decode().split(":", 1)
|
||||
|
||||
if not hmac.compare_digest(user, settings.METRICS_USER):
|
||||
return unauthed_response()
|
||||
@@ -37,7 +38,7 @@ def serve_metrics(request):
|
||||
m = metrics.metric_values()
|
||||
|
||||
output = []
|
||||
for metric, value in m:
|
||||
for metric, value in m.items():
|
||||
output.append("{} {}".format(metric, str(value)))
|
||||
|
||||
content = "\n".join(output)
|
||||
|
||||
Reference in New Issue
Block a user