Skip to content

Commit

Permalink
add hosted zone name to route53 metrics (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
maorfr authored Jul 26, 2022
1 parent 5b5194e commit baf9f46
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions route53.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ func NewRoute53Exporter(sess *session.Session, logger log.Logger, timeout time.D

return &Route53Exporter{
sess: sess,
RecordsPerHostedZoneQuota: prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "route53_recordsperhostedzone_quota"), "Quota for maximum number of records in a Route53 hosted zone", []string{"hostedzoneid"}, nil),
RecordsPerHostedZoneUsage: prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "route53_recordsperhostedzone_total"), "Number of Resource records", []string{"hostedzoneid"}, nil),
RecordsPerHostedZoneQuota: prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "route53_recordsperhostedzone_quota"), "Quota for maximum number of records in a Route53 hosted zone", []string{"hostedzoneid", "hostedzonename"}, nil),
RecordsPerHostedZoneUsage: prometheus.NewDesc(prometheus.BuildFQName(namespace, "", "route53_recordsperhostedzone_total"), "Number of Resource records", []string{"hostedzoneid", "hostedzonename"}, nil),
logger: logger,
timeout: timeout,
}
Expand All @@ -52,13 +52,13 @@ func (e *Route53Exporter) Collect(ch chan<- prometheus.Metric) {
})

if err != nil {
level.Error(e.logger).Log("msg", "Could not get Quota for hosted zone", "hostedZoneId", hostedZone.Id, "error", err.Error())
level.Error(e.logger).Log("msg", "Could not get Quota for hosted zone", "hostedZoneId", hostedZone.Id, "hostedZoneName", hostedZone.Name, "error", err.Error())
exporterMetrics.IncrementErrors()
continue
}

ch <- prometheus.MustNewConstMetric(e.RecordsPerHostedZoneQuota, prometheus.GaugeValue, float64(*hostedZoneLimitOut.Limit.Value), *hostedZone.Id)
ch <- prometheus.MustNewConstMetric(e.RecordsPerHostedZoneUsage, prometheus.GaugeValue, float64(*hostedZoneLimitOut.Count), *hostedZone.Id)
ch <- prometheus.MustNewConstMetric(e.RecordsPerHostedZoneQuota, prometheus.GaugeValue, float64(*hostedZoneLimitOut.Limit.Value), *hostedZone.Id, *hostedZone.Name)
ch <- prometheus.MustNewConstMetric(e.RecordsPerHostedZoneUsage, prometheus.GaugeValue, float64(*hostedZoneLimitOut.Count), *hostedZone.Id, *hostedZone.Name)
}
}

Expand Down

0 comments on commit baf9f46

Please sign in to comment.