mirror of
https://github.com/status-im/consul.git
synced 2025-01-13 15:26:48 +00:00
Merge pull request #1537 from hashicorp/f-dns-counting
Adds telemetry on number of DNS queries served, per-agent.
This commit is contained in:
commit
d1b440803c
@ -9,6 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/consul/consul"
|
||||
"github.com/hashicorp/consul/consul/structs"
|
||||
"github.com/miekg/dns"
|
||||
@ -165,6 +166,7 @@ START:
|
||||
func (d *DNSServer) handlePtr(resp dns.ResponseWriter, req *dns.Msg) {
|
||||
q := req.Question[0]
|
||||
defer func(s time.Time) {
|
||||
metrics.MeasureSince([]string{"consul", "dns", "ptr_query", d.agent.config.NodeName}, s)
|
||||
d.logger.Printf("[DEBUG] dns: request for %v (%v) from client %s (%s)",
|
||||
q, time.Now().Sub(s), resp.RemoteAddr().String(),
|
||||
resp.RemoteAddr().Network())
|
||||
@ -227,6 +229,7 @@ func (d *DNSServer) handlePtr(resp dns.ResponseWriter, req *dns.Msg) {
|
||||
func (d *DNSServer) handleQuery(resp dns.ResponseWriter, req *dns.Msg) {
|
||||
q := req.Question[0]
|
||||
defer func(s time.Time) {
|
||||
metrics.MeasureSince([]string{"consul", "dns", "domain_query", d.agent.config.NodeName}, s)
|
||||
d.logger.Printf("[DEBUG] dns: request for %v (%v) from client %s (%s)",
|
||||
q, time.Now().Sub(s), resp.RemoteAddr().String(),
|
||||
resp.RemoteAddr().Network())
|
||||
|
Loading…
x
Reference in New Issue
Block a user