Skip to content

Commit e6f2443

Browse files
authored
Merge pull request #4 from nsone/ftests
Testing and metric unit switch
2 parents 32d44cb + 1eefd6b commit e6f2443

21 files changed

+174
-102
lines changed

CMakeLists.txt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,31 @@ target_link_libraries(pktvisord
8585
PRIVATE pktvisorcore
8686
)
8787

88-
add_executable(tests
88+
add_executable(unit-tests
8989
tests/main.cpp
9090
tests/test_parse_pcap.cpp
9191
tests/test_sketches.cpp
9292
tests/test_utils.cpp
9393
)
9494

9595
if (MMDB_ENABLE)
96-
target_sources(tests
96+
target_sources(unit-tests
9797
PUBLIC
9898
tests/test_geoip.cpp
9999
)
100100
endif()
101101

102-
target_include_directories(tests SYSTEM
102+
target_include_directories(unit-tests SYSTEM
103103
PRIVATE ${CMAKE_SOURCE_DIR}/3rd/datasketches
104104
PRIVATE "${CMAKE_SOURCE_DIR}/3rd/catch"
105105
)
106106

107-
target_include_directories(tests
107+
target_include_directories(unit-tests
108108
PRIVATE "${CMAKE_SOURCE_DIR}/tests"
109109
PRIVATE "${CMAKE_SOURCE_DIR}/src"
110110
)
111111

112-
target_link_libraries(tests
112+
target_link_libraries(unit-tests
113113
PRIVATE pktvisorcore
114114
)
115115

@@ -125,36 +125,42 @@ add_test(NAME pktvisor-units
125125

126126
add_test(NAME pktvisor-ftest-ipv4-udp
127127
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
128-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 fixtures/dns_ipv4_udp.pcap
128+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv4_udp.json -- -H 127.0.0.1/32 fixtures/dns_ipv4_udp.pcap
129129
)
130130
add_test(NAME pktvisor-ftest-ipv4-tcp
131131
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
132-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 fixtures/dns_ipv4_tcp.pcap
132+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv4_tcp.json -- -H 127.0.0.1/32 fixtures/dns_ipv4_tcp.pcap
133133
)
134134
add_test(NAME pktvisor-ftest-ipv6-udp
135135
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
136-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 fixtures/dns_ipv6_udp.pcap
136+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv6_udp.json -- -H 127.0.0.1/32 fixtures/dns_ipv6_udp.pcap
137137
)
138138
add_test(NAME pktvisor-ftest-ipv6-tcp
139139
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
140-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 fixtures/dns_ipv6_tcp.pcap
140+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv6_tcp.json -- -H 127.0.0.1/32 fixtures/dns_ipv6_tcp.pcap
141141
)
142142

143143
if (MMDB_ENABLE)
144144
add_test(NAME pktvisor-ftest-ipv4-udp-geo
145145
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
146-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv4_udp.pcap
146+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv4_udp_geo.json -- -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv4_udp.pcap
147147
)
148148
add_test(NAME pktvisor-ftest-ipv4-tcp-geo
149149
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
150-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv4_tcp.pcap
150+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv4_tcp_geo.json -- -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv4_udp.pcap
151151
)
152152
add_test(NAME pktvisor-ftest-ipv6-udp-geo
153153
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
154-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv6_udp.pcap
154+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv6_udp_geo.json -- -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv6_udp.pcap
155155
)
156156
add_test(NAME pktvisor-ftest-ipv6-tcp-geo
157157
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
158-
COMMAND ${CMAKE_BINARY_DIR}/pktvisord -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv6_tcp.pcap
158+
COMMAND ${CMAKE_SOURCE_DIR}/tests/integration.sh ${CMAKE_BINARY_DIR}/pktvisord output-templates/dns_ipv6_tcp_geo.json -- -H 127.0.0.1/32 --geo-city fixtures/GeoIP2-City-Test.mmdb --geo-asn fixtures/GeoIP2-ISP-Test.mmdb fixtures/dns_ipv6_tcp.pcap
159159
)
160160
endif()
161+
162+
add_test(NAME external-tests
163+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
164+
COMMAND ${CMAKE_SOURCE_DIR}/tests/external.sh ${CMAKE_BINARY_DIR}/pktvisord
165+
)
166+

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ RUN \
2323
mkdir /tmp/build && \
2424
cd /tmp/build && \
2525
PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DMMDB_ENABLE=true -DCMAKE_BUILD_TYPE=RelWithDebInfo /src && \
26-
make all tests && \
27-
cd /src/tests && \
28-
/tmp/build/tests
26+
make all test
2927

3028
RUN \
3129
cd /tmp/build && \

cmd/pktvisor/pktvisor.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,29 @@ type StatSnapshot struct {
6464
Refused int64 `json:"refused"`
6565
} `json:"wire_packets"`
6666
Cardinality struct {
67-
Qname float64 `json:"qname"`
67+
Qname int64 `json:"qname"`
6868
} `json:"cardinality"`
6969
Xact struct {
7070
Counts struct {
7171
Total int64 `json:"total"`
7272
} `json:"counts"`
7373
In struct {
74-
QuantilesMS struct {
75-
P50 float64 `json:"p50"`
76-
P90 float64 `json:"p90"`
77-
P95 float64 `json:"p95"`
78-
P99 float64 `json:"p99"`
79-
} `json:"quantiles_ms"`
74+
QuantilesUS struct {
75+
P50 int64 `json:"p50"`
76+
P90 int64 `json:"p90"`
77+
P95 int64 `json:"p95"`
78+
P99 int64 `json:"p99"`
79+
} `json:"quantiles_us"`
8080
TopSlow []NameCount `json:"top_slow"`
8181
Total int64 `json:"total"`
8282
} `json:"in"`
8383
Out struct {
84-
QuantilesMS struct {
85-
P50 float64 `json:"p50"`
86-
P90 float64 `json:"p90"`
87-
P95 float64 `json:"p95"`
88-
P99 float64 `json:"p99"`
89-
} `json:"quantiles_ms"`
84+
QuantilesUS struct {
85+
P50 int64 `json:"p50"`
86+
P90 int64 `json:"p90"`
87+
P95 int64 `json:"p95"`
88+
P99 int64 `json:"p99"`
89+
} `json:"quantiles_us"`
9090
TopSlow []NameCount `json:"top_slow"`
9191
Total int64 `json:"total"`
9292
} `json:"out"`
@@ -102,8 +102,8 @@ type StatSnapshot struct {
102102
} `json:"dns"`
103103
Packets struct {
104104
Cardinality struct {
105-
DstIpsOut float64 `json:"dst_ips_out"`
106-
SrcIpsIn float64 `json:"src_ips_in"`
105+
DstIpsOut int64 `json:"dst_ips_out"`
106+
SrcIpsIn int64 `json:"src_ips_in"`
107107
} `json:"cardinality"`
108108
Ipv4 int64 `json:"ipv4"`
109109
Ipv6 int64 `json:"ipv6"`
@@ -180,7 +180,7 @@ func updateHeader(v *gocui.View, rates *InstantRates, stats *StatSnapshot) {
180180
pcounts.Out,
181181
(float64(pcounts.Out)/float64(pcounts.Total-inOutDiff))*100,
182182
)
183-
_, _ = fmt.Fprintf(v, "Pkt Rates In %d/s %d/%d/%d/%d pps | Out %d/s %d/%d/%d/%d pps | IP Card. In: %3.1f | Out: %3.1f\n\n",
183+
_, _ = fmt.Fprintf(v, "Pkt Rates In %d/s %d/%d/%d/%d pps | Out %d/s %d/%d/%d/%d pps | IP Card. In: %d | Out: %d\n\n",
184184
rates.Packets.In,
185185
pcounts.Rates.Pps_in.P50,
186186
pcounts.Rates.Pps_in.P90,
@@ -212,20 +212,20 @@ func updateHeader(v *gocui.View, rates *InstantRates, stats *StatSnapshot) {
212212
(float64(dnsc.Replies)/float64(dnsc.Total))*100,
213213
)
214214
xact := stats.DNS.Xact
215-
_, _ = fmt.Fprintf(v, "DNS Xacts %d | In %d (%3.1f%%) | Out %d (%3.1f%%) | In %3.1f/%3.1f/%3.1f/%3.1f ms | Out %3.1f/%3.1f/%3.1f/%3.1f ms | Qname Card. %3.1f\n",
215+
_, _ = fmt.Fprintf(v, "DNS Xacts %d | In %d (%3.1f%%) | Out %d (%3.1f%%) | In %3.1f/%3.1f/%3.1f/%3.1f ms | Out %3.1f/%3.1f/%3.1f/%3.1f ms | Qname Card. %d\n",
216216
xact.Counts.Total,
217217
xact.In.Total,
218218
(float64(xact.In.Total)/float64(xact.Counts.Total))*100,
219219
xact.Out.Total,
220220
(float64(xact.Out.Total)/float64(xact.Counts.Total))*100,
221-
xact.In.QuantilesMS.P50,
222-
xact.In.QuantilesMS.P90,
223-
xact.In.QuantilesMS.P95,
224-
xact.In.QuantilesMS.P99,
225-
xact.Out.QuantilesMS.P50,
226-
xact.Out.QuantilesMS.P90,
227-
xact.Out.QuantilesMS.P95,
228-
xact.Out.QuantilesMS.P99,
221+
float64(xact.In.QuantilesUS.P50)/1000,
222+
float64(xact.In.QuantilesUS.P90)/1000,
223+
float64(xact.In.QuantilesUS.P95)/1000,
224+
float64(xact.In.QuantilesUS.P99)/1000,
225+
float64(xact.Out.QuantilesUS.P50)/1000,
226+
float64(xact.Out.QuantilesUS.P90)/1000,
227+
float64(xact.Out.QuantilesUS.P95)/1000,
228+
float64(xact.Out.QuantilesUS.P99)/1000,
229229
stats.DNS.Cardinality.Qname,
230230
)
231231
startTime := time.Unix(stats.Period.StartTS, 0)

src/main.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,24 @@ static pktvisor::IPv6subnetList hostIPv6;
5656
typedef std::pair<pktvisor::TcpDnsReassembly *, bool> devCookie;
5757

5858
// got a full DNS wire message. called from all l3 and l4.
59-
static void onGotDnsMessage(pcpp::DnsLayer *dnsLayer, pktvisor::Direction dir, pcpp::ProtocolType l3, pcpp::ProtocolType l4, uint32_t flowKey)
59+
static void onGotDnsMessage(pcpp::DnsLayer *dnsLayer, pktvisor::Direction dir, pcpp::ProtocolType l3, pcpp::ProtocolType l4, uint32_t flowKey, timeval stamp)
6060
{
6161
assert(dnsLayer != nullptr);
6262
metricsManager->newDNSPacket(dnsLayer, dir, l3, l4);
6363
if (dnsLayer->getDnsHeader()->queryOrResponse == pktvisor::response) {
64-
auto xact = dnsQueryPairManager.maybeEndDnsTransaction(flowKey, dnsLayer->getDnsHeader()->transactionID);
65-
if (xact) {
66-
auto now = std::chrono::high_resolution_clock::now();
67-
metricsManager->newDNSXact(dnsLayer, dir, now - xact->queryStartTS);
64+
auto xact = dnsQueryPairManager.maybeEndDnsTransaction(flowKey, dnsLayer->getDnsHeader()->transactionID, stamp);
65+
if (xact.first) {
66+
metricsManager->newDNSXact(dnsLayer, dir, xact.second);
6867
}
6968
} else {
70-
dnsQueryPairManager.startDnsTransaction(flowKey, dnsLayer->getDnsHeader()->transactionID);
69+
dnsQueryPairManager.startDnsTransaction(flowKey, dnsLayer->getDnsHeader()->transactionID, stamp);
7170
}
7271
};
7372

7473
// called only for TCP, both IPv4 and 6
75-
static void onGotTcpDnsMessage(pcpp::DnsLayer *dnsLayer, pktvisor::Direction dir, pcpp::ProtocolType l3, uint32_t flowKey)
74+
static void onGotTcpDnsMessage(pcpp::DnsLayer *dnsLayer, pktvisor::Direction dir, pcpp::ProtocolType l3, uint32_t flowKey, timeval stamp)
7675
{
77-
onGotDnsMessage(dnsLayer, dir, l3, pcpp::TCP, flowKey);
76+
onGotDnsMessage(dnsLayer, dir, l3, pcpp::TCP, flowKey, stamp);
7877
}
7978

8079
/**
@@ -130,7 +129,7 @@ static void processRawPacket(pcpp::RawPacket *rawPacket, pktvisor::TcpDnsReassem
130129
// a UDP packet which wasn't DNS
131130
return;
132131
}
133-
onGotDnsMessage(dnsLayer, dir, l3, l4, pcpp::hash5Tuple(&packet));
132+
onGotDnsMessage(dnsLayer, dir, l3, l4, pcpp::hash5Tuple(&packet), rawPacket->getPacketTimeStamp());
134133
} else if (packet.isPacketOfType(pcpp::TCP)) {
135134
// get a pointer to the TCP reassembly instance and feed the packet arrived to it
136135
// we don't know yet if it's DNS, the reassembly manager figures that out

src/metrics.cpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <datasketches/datasketches/cpc/cpc_union.hpp>
77
#include <sstream>
88

9+
#include <math.h>
910
#include <arpa/inet.h>
1011

1112
#include "dns.h"
@@ -56,8 +57,8 @@ void Metrics::merge(Metrics &other)
5657
_rateSketches.net_rateIn.merge(other._rateSketches.net_rateIn);
5758
_rateSketches.net_rateOut.merge(other._rateSketches.net_rateOut);
5859

59-
_sketches->_dnsXactFromTimeMs.merge(other._sketches->_dnsXactFromTimeMs);
60-
_sketches->_dnsXactToTimeMs.merge(other._sketches->_dnsXactToTimeMs);
60+
_sketches->_dnsXactFromTimeUs.merge(other._sketches->_dnsXactFromTimeUs);
61+
_sketches->_dnsXactToTimeUs.merge(other._sketches->_dnsXactToTimeUs);
6162

6263
datasketches::cpc_union merge_srcIPCard;
6364
merge_srcIPCard.update(_sketches->_net_srcIPCard);
@@ -158,31 +159,31 @@ void Metrics::newDNSPacket(pcpp::DnsLayer *dns, Direction dir, pcpp::ProtocolTyp
158159
}
159160
}
160161

161-
void Metrics::newDNSXact(pcpp::DnsLayer *dns, Direction dir, hr_clock::duration xact_dur)
162+
void Metrics::newDNSXact(pcpp::DnsLayer *dns, Direction dir, DnsTransaction xact)
162163
{
163164
// lock for write
164165
std::unique_lock lock(_sketchMutex);
165166

166167
_DNS_xacts_total++;
167-
double xactTime = (double)std::chrono::duration_cast<std::chrono::microseconds>(xact_dur).count() / 1000.0; // milliseconds
168+
uint64_t xactTime = (xact.totalTS.tv_sec * 1000000) + xact.totalTS.tv_usec; // microseconds
168169
// dir is the direction of the last packet, meaning the reply so from a transaction perspective
169170
// we look at it from the direction of the query, so the opposite side than we have here
170171
float to90th = 0.0;
171172
float from90th = 0.0;
172173
uint64_t sample_threshold = 10;
173174
if (dir == toHost) {
174175
_DNS_xacts_out++;
175-
_sketches->_dnsXactFromTimeMs.update(xactTime);
176+
_sketches->_dnsXactFromTimeUs.update(xactTime);
176177
// wait for N samples
177-
if (_sketches->_dnsXactFromTimeMs.get_n() > sample_threshold) {
178-
from90th = _sketches->_dnsXactFromTimeMs.get_quantile(0.90);
178+
if (_sketches->_dnsXactFromTimeUs.get_n() > sample_threshold) {
179+
from90th = _sketches->_dnsXactFromTimeUs.get_quantile(0.90);
179180
}
180181
} else if (dir == fromHost) {
181182
_DNS_xacts_in++;
182-
_sketches->_dnsXactToTimeMs.update(xactTime);
183+
_sketches->_dnsXactToTimeUs.update(xactTime);
183184
// wait for N samples
184-
if (_sketches->_dnsXactToTimeMs.get_n() > sample_threshold) {
185-
to90th = _sketches->_dnsXactToTimeMs.get_quantile(0.90);
185+
if (_sketches->_dnsXactToTimeUs.get_n() > sample_threshold) {
186+
to90th = _sketches->_dnsXactToTimeUs.get_quantile(0.90);
186187
}
187188
}
188189

@@ -198,9 +199,9 @@ void Metrics::newDNSXact(pcpp::DnsLayer *dns, Direction dir, hr_clock::duration
198199
}
199200
}
200201

201-
void MetricsMgr::newDNSXact(pcpp::DnsLayer *dns, Direction dir, hr_clock::duration xact_dur)
202+
void MetricsMgr::newDNSXact(pcpp::DnsLayer *dns, Direction dir, DnsTransaction xact)
202203
{
203-
_metrics.back()->newDNSXact(dns, dir, xact_dur);
204+
_metrics.back()->newDNSXact(dns, dir, xact);
204205
}
205206

206207
void MetricsMgr::newDNSPacket(pcpp::DnsLayer *dns, Direction dir, pcpp::ProtocolType l3, pcpp::ProtocolType l4)
@@ -356,8 +357,8 @@ void MetricsMgr::newPacket(const pcpp::Packet &packet, QueryResponsePairMgr &pai
356357
auto pkt_ts = packet.getRawPacketReadOnly()->getPacketTimeStamp();
357358
if (pkt_ts.tv_sec - _lastShiftTS.tv_sec > MetricsMgr::PERIOD_SEC) {
358359
_periodShift();
359-
_lastShiftTS.tv_sec = packet.getRawPacketReadOnly()->getPacketTimeStamp().tv_sec;
360-
pairMgr.purgeOldTransactions();
360+
_lastShiftTS.tv_sec = pkt_ts.tv_sec;
361+
pairMgr.purgeOldTransactions(pkt_ts);
361362
_openDnsTransactionCount = pairMgr.getOpenTransactionCount();
362363
}
363364
switch (dir) {
@@ -389,8 +390,8 @@ void Metrics::toJSON(nlohmann::json &j, const std::string &key)
389390
j[key]["packets"]["in"] = _numPackets_in.load();
390391
j[key]["packets"]["out"] = _numPackets_out.load();
391392

392-
j[key]["packets"]["cardinality"]["src_ips_in"] = _sketches->_net_srcIPCard.get_estimate();
393-
j[key]["packets"]["cardinality"]["dst_ips_out"] = _sketches->_net_dstIPCard.get_estimate();
393+
j[key]["packets"]["cardinality"]["src_ips_in"] = lround(_sketches->_net_srcIPCard.get_estimate());
394+
j[key]["packets"]["cardinality"]["dst_ips_out"] = lround(_sketches->_net_dstIPCard.get_estimate());
394395

395396
const double fractions[4]{0.50, 0.90, 0.95, 0.99};
396397
auto quantiles = _rateSketches.net_rateIn.get_quantiles(fractions, 4);
@@ -420,7 +421,7 @@ void Metrics::toJSON(nlohmann::json &j, const std::string &key)
420421
j[key]["dns"]["wire_packets"]["srvfail"] = _DNS_SRVFAIL.load();
421422
j[key]["dns"]["wire_packets"]["noerror"] = _DNS_NOERROR.load();
422423

423-
j[key]["dns"]["cardinality"]["qname"] = _sketches->_dns_qnameCard.get_estimate();
424+
j[key]["dns"]["cardinality"]["qname"] = lround(_sketches->_dns_qnameCard.get_estimate());
424425

425426
{
426427
j[key]["packets"]["top_ipv4"] = nlohmann::json::array();
@@ -481,20 +482,20 @@ void Metrics::toJSON(nlohmann::json &j, const std::string &key)
481482
}
482483
}
483484

484-
auto d_quantiles = _sketches->_dnsXactFromTimeMs.get_quantiles(fractions, 4);
485+
auto d_quantiles = _sketches->_dnsXactFromTimeUs.get_quantiles(fractions, 4);
485486
if (d_quantiles.size()) {
486-
j[key]["dns"]["xact"]["out"]["quantiles_ms"]["p50"] = d_quantiles[0];
487-
j[key]["dns"]["xact"]["out"]["quantiles_ms"]["p90"] = d_quantiles[1];
488-
j[key]["dns"]["xact"]["out"]["quantiles_ms"]["p95"] = d_quantiles[2];
489-
j[key]["dns"]["xact"]["out"]["quantiles_ms"]["p99"] = d_quantiles[3];
487+
j[key]["dns"]["xact"]["out"]["quantiles_us"]["p50"] = d_quantiles[0];
488+
j[key]["dns"]["xact"]["out"]["quantiles_us"]["p90"] = d_quantiles[1];
489+
j[key]["dns"]["xact"]["out"]["quantiles_us"]["p95"] = d_quantiles[2];
490+
j[key]["dns"]["xact"]["out"]["quantiles_us"]["p99"] = d_quantiles[3];
490491
}
491492

492-
d_quantiles = _sketches->_dnsXactToTimeMs.get_quantiles(fractions, 4);
493+
d_quantiles = _sketches->_dnsXactToTimeUs.get_quantiles(fractions, 4);
493494
if (d_quantiles.size()) {
494-
j[key]["dns"]["xact"]["in"]["quantiles_ms"]["p50"] = d_quantiles[0];
495-
j[key]["dns"]["xact"]["in"]["quantiles_ms"]["p90"] = d_quantiles[1];
496-
j[key]["dns"]["xact"]["in"]["quantiles_ms"]["p95"] = d_quantiles[2];
497-
j[key]["dns"]["xact"]["in"]["quantiles_ms"]["p99"] = d_quantiles[3];
495+
j[key]["dns"]["xact"]["in"]["quantiles_us"]["p50"] = d_quantiles[0];
496+
j[key]["dns"]["xact"]["in"]["quantiles_us"]["p90"] = d_quantiles[1];
497+
j[key]["dns"]["xact"]["in"]["quantiles_us"]["p95"] = d_quantiles[2];
498+
j[key]["dns"]["xact"]["in"]["quantiles_us"]["p99"] = d_quantiles[3];
498499
}
499500

500501
{

0 commit comments

Comments
 (0)