Name: "probe_dns_additional_rrs",
Help: "Returns number of entries in the additional resource record list",
})
+ probeDNSQuerySucceeded := prometheus.NewGauge(prometheus.GaugeOpts{
+ Name: "probe_dns_query_succeeded",
+ Help: "Displays whether or not the query was executed successfully",
+ })
for _, lv := range []string{"resolve", "connect", "request"} {
probeDNSDurationGaugeVec.WithLabelValues(lv)
registry.MustRegister(probeDNSAnswerRRSGauge)
registry.MustRegister(probeDNSAuthorityRRSGauge)
registry.MustRegister(probeDNSAdditionalRRSGauge)
+ registry.MustRegister(probeDNSQuerySucceeded)
qc := uint16(dns.ClassINET)
if module.DNS.QueryClass != "" {
probeDNSAnswerRRSGauge.Set(float64(len(response.Answer)))
probeDNSAuthorityRRSGauge.Set(float64(len(response.Ns)))
probeDNSAdditionalRRSGauge.Set(float64(len(response.Extra)))
+ probeDNSQuerySucceeded.Set(1)
if qt == dns.TypeSOA {
probeDNSSOAGauge = prometheus.NewGauge(prometheus.GaugeOpts{
t.Fatal(err)
}
expectedResults := map[string]float64{
- "probe_dns_answer_rrs": 2,
- "probe_dns_authority_rrs": 0,
- "probe_dns_additional_rrs": 0,
+ "probe_dns_answer_rrs": 2,
+ "probe_dns_authority_rrs": 0,
+ "probe_dns_additional_rrs": 0,
+ "probe_dns_query_succeeded": 1,
}
if !test.Probe.Recursion {
expectedResults["probe_dns_answer_rrs"] = 0
t.Fatal(err)
}
expectedResults := map[string]float64{
- "probe_dns_answer_rrs": 1,
- "probe_dns_authority_rrs": 2,
- "probe_dns_additional_rrs": 3,
+ "probe_dns_answer_rrs": 1,
+ "probe_dns_authority_rrs": 2,
+ "probe_dns_additional_rrs": 3,
+ "probe_dns_query_succeeded": 1,
}
if test.Probe.QueryType == "SOA" {
expectedResults["probe_dns_serial"] = 1000
t.Fatal(err)
}
expectedResults := map[string]float64{
- "probe_dns_answer_rrs": 0,
- "probe_dns_authority_rrs": 0,
- "probe_dns_additional_rrs": 0,
+ "probe_dns_answer_rrs": 0,
+ "probe_dns_authority_rrs": 0,
+ "probe_dns_additional_rrs": 0,
+ "probe_dns_query_succeeded": 1,
}
+
+ // Handle case where ProbeDNS fails before executing the query because of an invalid query type
+ if test.Probe.QueryType == "NOT_A_VALID_QUERY_TYPE" {
+ expectedResults["probe_dns_query_succeeded"] = 0
+ }
+
checkRegistryResults(expectedResults, mfs, t)
}
}
"request": {},
},
},
- "probe_dns_answer_rrs": nil,
- "probe_dns_authority_rrs": nil,
- "probe_dns_additional_rrs": nil,
+ "probe_dns_answer_rrs": nil,
+ "probe_dns_authority_rrs": nil,
+ "probe_dns_additional_rrs": nil,
+ "probe_dns_query_succeeded": nil,
}
checkMetrics(expectedMetrics, mfs, t)