Skip to content

Commit

Permalink
add fanout/upstream metadata
Browse files Browse the repository at this point in the history
I would like to mimic coredns/coredns@32cc745 for fanout plugin, we would be using this metadata for our analytics and we would appreciate having this also in fanout

Signed-off-by: Ondrej Benkovsky <ondrej.benkovsky@wandera.com>
  • Loading branch information
Ondrej Benkovsky committed Jun 23, 2021
1 parent 241bb94 commit 4176222
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fanout.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/debug"
"github.com/coredns/coredns/plugin/dnstap"
"github.com/coredns/coredns/plugin/metadata"
clog "github.com/coredns/coredns/plugin/pkg/log"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
Expand Down Expand Up @@ -102,6 +103,9 @@ func (f *Fanout) ServeDNS(ctx context.Context, w dns.ResponseWriter, m *dns.Msg)
if result == nil {
return dns.RcodeServerFailure, timeoutContext.Err()
}
metadata.SetValueFunc(ctx, "fanout/upstream", func() string {
return result.client.Endpoint()
})
if result.err != nil {
return dns.RcodeServerFailure, result.err
}
Expand Down

0 comments on commit 4176222

Please sign in to comment.