Fill in each dns stats value in message NetworkDnsEventReported
Result dump
metric_id: 1111
event_metrics {
data {
elapsed_timestamp_nanos: 166844290056
atom {
network_dns_event_reported {
event_type: EVENT_GETADDRINFO
return_code: RC_EAI_NO_ERROR
latency_micros: 78961
hints_ai_flags: 1024
res_nsend_flags: -1
network_type: NT_UNKNOWN
private_dns_modes: PDM_STRICT
dns_query_events {
dns_query_event {
rcode: NS_R_NO_ERROR
type: NS_T_A
ip_version: IV_IPV4
protocol: PROTO_DOT
dns_server_index: 0
latency_micros: 77843
}
}
}
}
}
Bug: 119862317
Test: ./out/host/linux-x86/bin/statsd_testdrive 116
Change-Id: Ia9d2ca076cdd95df206f573531a17badb34fda62
diff --git a/res_init.cpp b/res_init.cpp
index 5be0188..bb86723 100644
--- a/res_init.cpp
+++ b/res_init.cpp
@@ -309,7 +309,8 @@
return (statp->nscount);
}
-void res_setnetcontext(res_state statp, const struct android_net_context* netcontext) {
+void res_setnetcontext(res_state statp, const struct android_net_context* netcontext,
+ android::net::NetworkDnsEventReported* _Nonnull event) {
if (statp != NULL) {
statp->netid = netcontext->dns_netid;
statp->_mark = netcontext->dns_mark;
@@ -319,5 +320,6 @@
if (netcontext->flags & NET_CONTEXT_FLAG_USE_LOCAL_NAMESERVERS) {
statp->use_local_nameserver = true;
}
+ statp->event = event;
}
}