Skip to content

Commit

Permalink
Added support for NS records to discovery.dns
Browse files Browse the repository at this point in the history
  • Loading branch information
ptodev committed May 28, 2024
1 parent 7902416 commit 0507f5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Main (unreleased)

- Allow override debug metrics level for `otelcol.*` components. (@hainenber)

- Added support for NS records to `discovery.dns`. (@djcode)

### Bugfixes

- Fix panic when component ID contains `/` in `otelcomponent.MustNewType(ID)`.(@qclaogui)
Expand Down
14 changes: 7 additions & 7 deletions docs/sources/reference/components/discovery.dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ discovery.dns "LABEL" {

The following arguments are supported:

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
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, MX, or NS. | `"SRV"` | no

## Exported fields

Expand All @@ -41,7 +41,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

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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")
}
Expand Down

0 comments on commit 0507f5a

Please sign in to comment.