From 65d43dc9823ebd149725c069554953c8b7fdf387 Mon Sep 17 00:00:00 2001 From: Daniel Jolly Date: Fri, 1 Dec 2023 11:26:31 -0500 Subject: [PATCH] Added support for NS records to discovery.dns Signed-off-by: Daniel Jolly --- CHANGELOG.md | 2 ++ component/discovery/dns/dns.go | 2 +- docs/sources/flow/reference/components/discovery.dns.md | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7146605ebdc3..74c0b9ecb639 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ Main (unreleased) - `pyroscope.ebpf` support python on arm64 platforms. (@korniltsev) +- Added support for NS records to `discovery.dns`. (@djcode) + ### Bugfixes - Update `pyroscope.ebpf` to fix a logical bug causing to profile to many kthreads instead of regular processes https://github.com/grafana/pyroscope/pull/2778 (@korniltsev) diff --git a/component/discovery/dns/dns.go b/component/discovery/dns/dns.go index 1563f116075c..a86e44d8df6e 100644 --- a/component/discovery/dns/dns.go +++ b/component/discovery/dns/dns.go @@ -46,7 +46,7 @@ func (args *Arguments) SetToDefault() { func (args *Arguments) Validate() error { switch strings.ToUpper(args.Type) { case "SRV": - case "A", "AAAA", "MX": + case "A", "AAAA", "MX", "NS": if args.Port == 0 { return errors.New("a port is required in DNS-SD configs for all record types except SRV") } diff --git a/docs/sources/flow/reference/components/discovery.dns.md b/docs/sources/flow/reference/components/discovery.dns.md index 3a2615d5df29..61d8d79bca14 100644 --- a/docs/sources/flow/reference/components/discovery.dns.md +++ b/docs/sources/flow/reference/components/discovery.dns.md @@ -31,7 +31,7 @@ Name | Type | Description | Default | Required `names` | `list(string)` | DNS names to look up. | | yes `port` | `number` | Port to use for collecting metrics. Not used for SRV records. | `0` | no `refresh_interval` | `duration` | How often to query DNS for updates. | `"30s"` | no -`type` | `string` | Type of DNS record to query. Must be one of SRV, A, AAAA, or MX. | `"SRV"` | no +`type` | `string` | Type of DNS record to query. Must be one of SRV, A, AAAA, MX, or NS. | `"SRV"` | no ## Exported fields @@ -47,7 +47,7 @@ Each target includes the following labels: * `__meta_dns_srv_record_target`: Target field of the SRV record. * `__meta_dns_srv_record_port`: Port field of the SRV record. * `__meta_dns_mx_record_target`: Target field of the MX record. - +* `__meta_dns_ns_record_target`: Target field of the NS record. ## Component health