add prefix to metric for easy sorting

master
parent bcc4857174
commit 2988e70c7f
  1. 8
      DNSLG/Formatter.py
  2. 1
      DNSLG/Resolver.py

@ -425,11 +425,11 @@ class OpenMetricsFormatter(Formatter):
def collect(self):
for record in self.json_data['AnswerSection']:
yield InfoMetricFamily('answer_section_rr', 'Record values', value={
yield InfoMetricFamily('dns_lg_answer_section_rr', 'Record values', value={
k: str(v) for k, v in record.items()
})
yield InfoMetricFamily('dns_lg', 'Build information', value={
yield InfoMetricFamily('dns_lg_build', 'Build information', value={
'dns_lg_version': self.version,
'dnspython_version': dnspythonversion.version,
'python_implementation': platform.python_implementation(),
@ -438,11 +438,11 @@ class OpenMetricsFormatter(Formatter):
})
query_labels = dict(self.json_data['QuestionSection'], Server=self.json_data['Query']['Server'])
duration = GaugeMetricFamily('query_duration_seconds', 'Query duration in seconds', labels=query_labels.keys())
duration = GaugeMetricFamily('dns_lg_query_duration_seconds', 'Query duration in seconds', labels=query_labels.keys())
duration.add_metric(query_labels.values(), self.json_data['Query']['Duration'])
yield duration
rrs_count = GaugeMetricFamily('answer_rrs_count', 'Number of records in the answer section', labels=query_labels.keys())
rrs_count = GaugeMetricFamily('dns_lg_answer_rrs_count', 'Number of records in the answer section', labels=query_labels.keys())
rrs_count.add_metric(query_labels.values(), len(self.json_data['AnswerSection']))
yield rrs_count

@ -158,7 +158,6 @@ class Resolver(object):
pass
else:
self.nameservers.append(ns)
print(self.nameservers)
def reset(self):
self.edns = self.original_edns

Loading…
Cancel
Save