Skip to content

Commit eae516b

Browse files
authored
Merge pull request #89 from coroot/fix_dns_capturing
fix DNS request capturing
2 parents 4c8e82e + 87093a7 commit eae516b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

containers/container.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,10 @@ func (c *Container) onDNSRequest(r *l7.RequestData) map[netaddr.IP]string {
582582
dnsReq := L7Requests[l7.ProtocolDNS]
583583
c.dnsStats.Requests = prometheus.NewCounterVec(
584584
prometheus.CounterOpts{Name: dnsReq.Name, Help: dnsReq.Help},
585-
[]string{"request_type", "status"},
585+
[]string{"request_type", "domain", "status"},
586586
)
587587
}
588-
if m, _ := c.dnsStats.Requests.GetMetricWithLabelValues(t, status); m != nil {
588+
if m, _ := c.dnsStats.Requests.GetMetricWithLabelValues(t, fqdn, status); m != nil {
589589
m.Inc()
590590
}
591591
if r.Duration != 0 {

ebpftracer/ebpf.go

+8-8
Large diffs are not rendered by default.

ebpftracer/ebpf/l7/dns.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int is_dns_response(char *buf, __u64 buf_size, __s16 *stream_id, __u32 *status)
4545
if (h.bits0 & DNS_OPCODE) {
4646
return 0;
4747
}
48-
if (!(h.bits1 & DNS_Z)) {
48+
if ((h.bits1 & DNS_Z)) {
4949
return 0;
5050
}
5151
h.qdcount = bpf_ntohs(h.qdcount);

0 commit comments

Comments
 (0)