Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for NS records to discovery.dns #942

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading