You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While testing the exporter against some of my ongoing DNS test I noticed that the rtt value isn't recognised when the response contains multiple results in a resultset.
According to the ripe documentation;
resultset - [optional] an array of objects containing all the fields of a DNS result object, except for the fields: fw, from, msm_id, prb_id, and type. Available for queries sent to each local resolver.
Here's a lazy workaround that's super ugly, but i can't get the nicer version working (See later).
diff --git a/dns/exporter.go b/dns/exporter.go
index d7819ed..55e7bf5 100644
--- a/dns/exporter.go+++ b/dns/exporter.go@@ -41,8 +41,18 @@ func (m *dnsExporter) Export(res *measurement.Result, probe *probe.Probe, ch cha
var rtt float64
if res.DnsResult() != nil {
rtt = res.DnsResult().Rt()
+ recordRtt(rtt, labelValues, ch)+ } else if res.DnsResultsets() != nil {+ for _, s := range res.DnsResultsets() {+ if s.Result() != nil {+ rtt = s.Result().Rt()+ recordRtt(rtt, labelValues, ch)+ }+ }
}
+}+func recordRtt(rtt float64, labelValues []string, ch chan<- prometheus.Metric) {
if rtt > 0 {
ch <- prometheus.MustNewConstMetric(successDesc, prometheus.GaugeValue, 1, labelValues...)
ch <- prometheus.MustNewConstMetric(rttDesc, prometheus.GaugeValue, rtt, labelValues...)
Non Working Workaround
I'd much prefer to do something like this, but I can't quite get my head around golangs slices/arrays pointers/references etc to make the popping of the first element off the DNSResultSets() array response not cause a segfault.
diff --git a/dns/exporter.go b/dns/exporter.go
index d7819ed..b6706d4 100644
--- a/dns/exporter.go+++ b/dns/exporter.go@@ -41,6 +41,8 @@ func (m *dnsExporter) Export(res *measurement.Result, probe *probe.Probe, ch cha
var rtt float64
if res.DnsResult() != nil {
rtt = res.DnsResult().Rt()
+ } else if res.DnsResultsets() != nil {+ rtt = res.DnsResultsets()[0].Result().Rt()
}
if rtt > 0 {
The text was updated successfully, but these errors were encountered:
warmfusion
changed the title
DNS with multiple results in ResultSet do not recognise rtt correctly
DNS against local resolvers with ResultSet respojse does not recognise rtt correctly
Nov 4, 2018
While testing the exporter against some of my ongoing DNS test I noticed that the rtt value isn't recognised when the response contains multiple results in a resultset.
According to the ripe documentation;
This was added in version 4750.
Test ID as a reference: 16878571
Here's a lazy workaround that's super ugly, but i can't get the nicer version working (See later).
Non Working Workaround
I'd much prefer to do something like this, but I can't quite get my head around golangs slices/arrays pointers/references etc to make the popping of the first element off the DNSResultSets() array response not cause a segfault.
The text was updated successfully, but these errors were encountered: