mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
lib/promscrape/discovery/dns: add __meta_dns_srv_record_target
and __meta_dns_srv_record_port
labels
This syncs dns service discovery with Prometheus 2.21 - see https://github.com/prometheus/prometheus/releases and https://github.com/prometheus/prometheus/pull/7678 .
This commit is contained in:
parent
6ad6480400
commit
0e19f35af5
2 changed files with 6 additions and 3 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -122,8 +123,10 @@ func getAAddrLabels(ctx context.Context, sdc *SDConfig, lookupType string) ([]ma
|
|||
func appendAddrLabels(ms []map[string]string, name, target string, port int) []map[string]string {
|
||||
addr := discoveryutils.JoinHostPort(target, port)
|
||||
m := map[string]string{
|
||||
"__address__": addr,
|
||||
"__meta_dns_name": name,
|
||||
"__address__": addr,
|
||||
"__meta_dns_name": name,
|
||||
"__meta_dns_srv_record_target": target,
|
||||
"__meta_dns_srv_record_port": strconv.Itoa(port),
|
||||
}
|
||||
return append(ms, m)
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ func getEndpointSliceLabels(eps *EndpointSlice, addr string, ea Endpoint, epp En
|
|||
"__meta_kubernetes_endpointslice_endpoint_conditions_ready": strconv.FormatBool(ea.Conditions.Ready),
|
||||
"__meta_kubernetes_endpointslice_port_name": epp.Name,
|
||||
"__meta_kubernetes_endpointslice_port_protocol": epp.Protocol,
|
||||
"__meta_kubernetes_endpointslice_port": strconv.FormatUint(uint64(epp.Port), 10),
|
||||
"__meta_kubernetes_endpointslice_port": strconv.Itoa(epp.Port),
|
||||
}
|
||||
if epp.AppProtocol != "" {
|
||||
m["__meta_kubernetes_endpointslice_port_app_protocol"] = epp.AppProtocol
|
||||
|
|
Loading…
Reference in a new issue