Skip to content

Commit

Permalink
Merge pull request #89 from coroot/fix_dns_capturing
Browse files Browse the repository at this point in the history
fix DNS request capturing
  • Loading branch information
def authored May 28, 2024
2 parents 4c8e82e + 87093a7 commit eae516b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions containers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,10 @@ func (c *Container) onDNSRequest(r *l7.RequestData) map[netaddr.IP]string {
dnsReq := L7Requests[l7.ProtocolDNS]
c.dnsStats.Requests = prometheus.NewCounterVec(
prometheus.CounterOpts{Name: dnsReq.Name, Help: dnsReq.Help},
[]string{"request_type", "status"},
[]string{"request_type", "domain", "status"},
)
}
if m, _ := c.dnsStats.Requests.GetMetricWithLabelValues(t, status); m != nil {
if m, _ := c.dnsStats.Requests.GetMetricWithLabelValues(t, fqdn, status); m != nil {
m.Inc()
}
if r.Duration != 0 {
Expand Down
16 changes: 8 additions & 8 deletions ebpftracer/ebpf.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ebpftracer/ebpf/l7/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int is_dns_response(char *buf, __u64 buf_size, __s16 *stream_id, __u32 *status)
if (h.bits0 & DNS_OPCODE) {
return 0;
}
if (!(h.bits1 & DNS_Z)) {
if ((h.bits1 & DNS_Z)) {
return 0;
}
h.qdcount = bpf_ntohs(h.qdcount);
Expand Down

0 comments on commit eae516b

Please sign in to comment.