Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 67247c2

Browse files
authored
Merge a61e4b0 into 9c84fee
2 parents 9c84fee + a61e4b0 commit 67247c2

8 files changed

Lines changed: 287 additions & 67 deletions

File tree

docs/monitoring/metrics.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,33 @@ curl https://localhost:7979/metrics
2424
> Full metric name is constructed as follows:
2525
> `external_dns_<subsystem>_<name>`
2626
27-
| Name | Metric Type | Subsystem | Labels | Help |
28-
|:----------------------------------------|:------------|:-----------------|:--------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------|
29-
| build_info | Gauge | | arch, go_version, os, revision, version | A metric with a constant '1' value labeled with 'version' and 'revision' of external_dns and the 'go_version', 'os' and the 'arch' used the build. |
30-
| consecutive_soft_errors | Gauge | controller | | Number of consecutive soft errors in reconciliation loop. |
31-
| last_reconcile_timestamp_seconds | Gauge | controller | | Timestamp of last attempted sync with the DNS provider |
32-
| last_sync_timestamp_seconds | Gauge | controller | | Timestamp of last successful sync with the DNS provider |
33-
| no_op_runs_total | Counter | controller | | Number of reconcile loops ending up with no changes on the DNS provider side. |
34-
| verified_records | Gauge | controller | record_type | Number of DNS records that exists both in source and registry (vector). |
35-
| request_duration_seconds | Summaryvec | http | handler, scheme, host, path, method, status | The HTTP request latencies in seconds. |
36-
| cache_apply_changes_calls | Counter | provider | | Number of calls to the provider cache ApplyChanges. |
37-
| cache_records_calls | Counter | provider | from_cache | Number of calls to the provider cache Records list. |
38-
| endpoints_total | Gauge | registry | | Number of Endpoints in the registry |
39-
| errors_total | Counter | registry | | Number of Registry errors. |
40-
| records | Gauge | registry | record_type | Number of registry records partitioned by label name (vector). |
41-
| skipped_records_owner_mismatch_per_sync | Gauge | registry | record_type, owner, foreign_owner, domain | Number of records skipped with owner mismatch for each record type, owner mismatch ID and domain (vector). |
42-
| deduplicated_endpoints | Gauge | source | record_type, source_type | Number of endpoints currently removed as duplicates, partitioned by record type and source. |
43-
| endpoints_total | Gauge | source | | Number of Endpoints in all sources |
44-
| errors_total | Counter | source | | Number of Source errors. |
45-
| invalid_endpoints | Gauge | source | record_type, source_type | Number of endpoints currently rejected due to invalid configuration, partitioned by record type and source. |
46-
| records | Gauge | source | record_type | Number of source records partitioned by label name (vector). |
47-
| adjustendpoints_errors_total | Gauge | webhook_provider | | Errors with AdjustEndpoints method |
48-
| adjustendpoints_requests_total | Gauge | webhook_provider | | Requests with AdjustEndpoints method |
49-
| applychanges_errors_total | Gauge | webhook_provider | | Errors with ApplyChanges method |
50-
| applychanges_requests_total | Gauge | webhook_provider | | Requests with ApplyChanges method |
51-
| records_errors_total | Gauge | webhook_provider | | Errors with Records method |
52-
| records_requests_total | Gauge | webhook_provider | | Requests with Records method |
27+
| Name | Metric Type | Subsystem | Labels | Help |
28+
|:----------------------------------------|:------------|:-----------------|:--------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------|
29+
| build_info | Gauge | | arch, go_version, os, revision, version | A metric with a constant '1' value labeled with 'version' and 'revision' of external_dns and the 'go_version', 'os' and the 'arch' used the build. |
30+
| consecutive_soft_errors | Gauge | controller | | Number of consecutive soft errors in reconciliation loop. |
31+
| last_reconcile_timestamp_seconds | Gauge | controller | | Timestamp of last attempted sync with the DNS provider |
32+
| last_sync_timestamp_seconds | Gauge | controller | | Timestamp of last successful sync with the DNS provider |
33+
| no_op_runs_total | Counter | controller | | Number of reconcile loops ending up with no changes on the DNS provider side. |
34+
| verified_records | Gauge | controller | record_type | Number of DNS records that exists both in source and registry (vector). |
35+
| request_duration_seconds | Summaryvec | http | handler, scheme, host, path, method, status | The HTTP request latencies in seconds. |
36+
| cache_apply_changes_calls | Counter | provider | | Number of calls to the provider cache ApplyChanges. |
37+
| cache_records_calls | Counter | provider | from_cache | Number of calls to the provider cache Records list. |
38+
| endpoints_total | Gauge | registry | | Number of Endpoints in the registry |
39+
| errors_total | Counter | registry | | Number of Registry errors. |
40+
| records | Gauge | registry | record_type | Number of registry records partitioned by label name (vector). |
41+
| skipped_records_label_too_long_per_sync | Gauge | registry | record_type, domain | Number of records skipped because the projected TXT registry name has a DNS label exceeding RFC 1035's 63-char limit, for each record type and domain (vector). |
42+
| skipped_records_owner_mismatch_per_sync | Gauge | registry | record_type, owner, foreign_owner, domain | Number of records skipped with owner mismatch for each record type, owner mismatch ID and domain (vector). |
43+
| deduplicated_endpoints | Gauge | source | record_type, source_type | Number of endpoints currently removed as duplicates, partitioned by record type and source. |
44+
| endpoints_total | Gauge | source | | Number of Endpoints in all sources |
45+
| errors_total | Counter | source | | Number of Source errors. |
46+
| invalid_endpoints | Gauge | source | record_type, source_type | Number of endpoints currently rejected due to invalid configuration, partitioned by record type and source. |
47+
| records | Gauge | source | record_type | Number of source records partitioned by label name (vector). |
48+
| adjustendpoints_errors_total | Gauge | webhook_provider | | Errors with AdjustEndpoints method |
49+
| adjustendpoints_requests_total | Gauge | webhook_provider | | Requests with AdjustEndpoints method |
50+
| applychanges_errors_total | Gauge | webhook_provider | | Errors with ApplyChanges method |
51+
| applychanges_requests_total | Gauge | webhook_provider | | Requests with ApplyChanges method |
52+
| records_errors_total | Gauge | webhook_provider | | Errors with Records method |
53+
| records_requests_total | Gauge | webhook_provider | | Requests with Records method |
5354

5455
## Available Go Runtime Metrics
5556

docs/registry/txt.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,25 @@ the record type of the DNS record for which it is storing metadata.
103103
The prefix is specified using the `--txt-prefix` flag and the suffix is specified using
104104
the `--txt-suffix` flag. The two flags are mutually exclusive.
105105

106+
## Label length limits
107+
108+
DNS labels are capped at 63 octets per RFC 1035. The TXT registry stores ownership at a
109+
sibling name with a record-type prefix on the first label (e.g., `cname-foo.example.com`
110+
for a CNAME `foo.example.com`). Any configured `--txt-prefix` or `--txt-suffix` further
111+
extends that label.
112+
113+
If any label in the projected TXT name exceeds 63 characters, external-dns skips both
114+
the owned record and its ownership TXT. Creating the owned record without a TXT would
115+
leave an unmanageable record in the zone, since later reconciles could not identify it
116+
as managed.
117+
118+
Each skip is logged at error level and increments the
119+
`external_dns_registry_skipped_records_label_too_long_per_sync` gauge, labeled by
120+
`record_type` and apex `domain`.
121+
122+
To resolve, shorten the source hostname's first label or trim `--txt-prefix`/`--txt-suffix`.
123+
The inline record-type prefix alone consumes 2–6 characters; the longest is `cname-`.
124+
106125
## Wildcard Replacement
107126

108127
The `--txt-wildcard-replacement` flag specifies a string to use to replace the "\*" in

endpoint/endpoint.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,16 @@ func FilterEndpointsByOwnerID(ownerID string, eps []*Endpoint) []*Endpoint {
534534
return filtered
535535
}
536536

537+
// OverflowingLabel returns the first label in name longer than 63 chars.
538+
func OverflowingLabel(name string) (string, bool) {
539+
for label := range strings.SplitSeq(name, ".") {
540+
if len(label) > 63 {
541+
return label, true
542+
}
543+
}
544+
return "", false
545+
}
546+
537547
// RemoveDuplicates returns a slice holding the unique endpoints.
538548
// This function doesn't contemplate the Targets of an Endpoint
539549
// as part of the primary Key

internal/gen/docs/metrics/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
const (
3333
pathToDocs = "%s/../../../../docs/monitoring"
34-
knownMetricsCount = 24
34+
knownMetricsCount = 25
3535
)
3636

3737
func TestComputeMetrics(t *testing.T) {

registry/txt/encryption_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ func TestGenerateTXTGenerateTextRecordEncryptionWihDecryption(t *testing.T) {
108108
key := []byte(k)
109109
r, err := newRegistry(p, "", "", "owner", time.Minute, "", []string{}, []string{}, true, key, "")
110110
assert.NoError(t, err, "Error creating TXT registry")
111-
txtRecords := r.generateTXTRecord(test.record)
111+
txtRecords, err := r.generateTXTRecord(test.record)
112+
require.NoError(t, err)
112113
assert.Len(t, txtRecords, len(test.record.Targets))
113114

114115
for _, txt := range txtRecords {

registry/txt/metrics.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package txt
18+
19+
import (
20+
"github.com/prometheus/client_golang/prometheus"
21+
22+
"sigs.k8s.io/external-dns/endpoint"
23+
"sigs.k8s.io/external-dns/pkg/metrics"
24+
)
25+
26+
// registrySkippedLabelTooLongPerSync tracks records dropped because the projected
27+
// TXT name has a label exceeding the 63-char RFC 1035 limit.
28+
var registrySkippedLabelTooLongPerSync = metrics.NewGaugedVectorOpts(
29+
prometheus.GaugeOpts{
30+
Subsystem: "registry",
31+
Name: "skipped_records_label_too_long_per_sync",
32+
Help: "Number of records skipped because the projected TXT registry name has a DNS label exceeding RFC 1035's 63-char limit, for each record type and domain (vector).",
33+
},
34+
[]string{"record_type", "domain"},
35+
)
36+
37+
func init() {
38+
metrics.RegisterMetric.MustRegister(registrySkippedLabelTooLongPerSync)
39+
}
40+
41+
// recordSkippedLabelTooLong increments the per-sync gauge for a record dropped
42+
// because its projected TXT name overflows RFC 1035's 63-char label limit.
43+
func recordSkippedLabelTooLong(skipped *endpoint.Endpoint) {
44+
registrySkippedLabelTooLongPerSync.AddWithLabels(1.0, skipped.RecordType, skipped.GetNakedDomain())
45+
}

0 commit comments

Comments
 (0)