Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign updns discovery should expose the resolved name of each record #4726
Comments
This comment has been minimized.
This comment has been minimized.
|
A records only contain IPv4 addresses, they don't have names. |
This comment has been minimized.
This comment has been minimized.
|
According to the DNS RFC, "All RRs have the same top level format", which includes
Defining a DNS A record within a DNS configuration follows the form:
Here, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
depeele commentedOct 11, 2018
Proposal
For DNS discovery, when multiple records are returned, currently the
nameentry of each record is ignored, losing information that would be very useful in relabeling.For example, using a prometheus configuration like:
In a setup where a DNS query for A records with the name
tasks.controllerreturns:All metrics for
controllerjobs will be given aninstancelabel assigned the value of the IP address, which in many cases is ephemeral (e.g. docker swarm where the next time the service is restarted or scaled, the IP address may change).Currently, during relabeling, the only information to work with is the IP address and the
__meta_dns_name, which is set to the name specified for lookup, in this casetasks.controller.If the
nameentry of each record (e.g.controller-1,controller-2,controller-3) were made available as additional metadata during relabeling, perhaps something like__meta_dns_host, it would be easy to add relabelling to associate metrics with a particular instance of a service.Changes
This seems like it would be a simple change to the
refresh()function indiscovery/dns/dns.go.Remembering the
addr.TargetforSRV, andaddr.Hdr.NameforAandAAAArecords, a new__meta_dns_hostentry could be included in the generatedTargets.