Skip to content

Commit df8c266

Browse files
committed
Better metric names and description
Signed-off-by: Örnfeldt Philip (66140321) <philip.ornfeldt@forsakringskassan.se>
1 parent 8471644 commit df8c266

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Supported metrics right now as follows.
3838
Global:
3939

4040
* _Network/Dns/Latency_
41-
* `fortigate_network_dns_latency`
41+
* `fortigate_network_dns_latency_`
4242
* `fortigate_network_dns_latest_update`
4343
* _System/SensorInfo_
4444
* `fortigate_sensor_fan_rpm`

pkg/probe/network_dns_latency.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ import (
2323
func probeNetworkDnsLatency(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, bool) {
2424
var (
2525
dnsLatency = prometheus.NewDesc(
26-
"fortigate_network_dns_latency",
26+
"fortigate_network_dns_latency_seconds",
2727
"Network dns latency",
2828
[]string{"service", "ip"}, nil,
2929
)
3030
dnsLastUpdate = prometheus.NewDesc(
3131
"fortigate_network_dns_latest_update",
32-
"Network dns last update",
32+
"Network dns last record update",
3333
[]string{"service", "ip"}, nil,
3434
)
3535
)
@@ -52,7 +52,7 @@ func probeNetworkDnsLatency(c http.FortiHTTP, meta *TargetMetadata) ([]prometheu
5252
}
5353
m := []prometheus.Metric{}
5454
for _, r := range res.Results {
55-
m = append(m, prometheus.MustNewConstMetric(dnsLatency, prometheus.GaugeValue, r.Latency, r.Service, r.Ip))
55+
m = append(m, prometheus.MustNewConstMetric(dnsLatency, prometheus.GaugeValue, r.Latency * 0.001, r.Service, r.Ip))
5656
m = append(m, prometheus.MustNewConstMetric(dnsLastUpdate, prometheus.GaugeValue, r.LastUpdate, r.Service, r.Ip))
5757
}
5858

pkg/probe/network_dns_latency_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ func TestNetworkDnsLatency(t *testing.T) {
2929
}
3030

3131
em := `
32-
# HELP fortigate_network_dns_latency Network dns latency
33-
# TYPE fortigate_network_dns_latency gauge
34-
fortigate_network_dns_latency{ip="8.8.8.8",service="dns_server"} 10
35-
# HELP fortigate_network_dns_latest_update Network dns last update
32+
# HELP fortigate_network_dns_latency_seconds Network dns latency
33+
# TYPE fortigate_network_dns_latency_seconds gauge
34+
fortigate_network_dns_latency_seconds{ip="8.8.8.8",service="dns_server"} 0.01
35+
# HELP fortigate_network_dns_latest_update Network dns last record update
3636
# TYPE fortigate_network_dns_latest_update gauge
3737
fortigate_network_dns_latest_update{ip="8.8.8.8",service="dns_server"} 1040
3838
`

0 commit comments

Comments
 (0)