mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-14 16:12:15 +01:00
lib/promscrape/discovery/kubernetes: add __meta_kubernetes_service_port_number
label to role: service
in the same way as Prometheus 2.38 does
See https://github.com/prometheus/prometheus/pull/11002
This commit is contained in:
parent
40c2fae617
commit
2fb63dda83
@ -19,6 +19,7 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
||||
|
||||
* FEATURE: [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html): improve performance for heavy queries on systems with many CPU cores.
|
||||
* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add support for MX record types in [dns_sd_configs](https://docs.victoriametrics.com/sd_configs.html#dns_sd_configs) in the same way as Prometheus 2.38 [does](https://github.com/prometheus/prometheus/pull/10099).
|
||||
* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `__meta_kubernetes_service_port_number` meta-label for `role: service` in [kubernetes_sd_configs](https://docs.victoriametrics.com/sd_configs.html#kubernetes_sd_configs) in the same way as Prometheus 2.38 [does](https://github.com/prometheus/prometheus/pull/11002).
|
||||
* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): add `toTime()` template function in the same way as Prometheus 2.38 [does](https://github.com/prometheus/prometheus/pull/10993). See [these docs](https://prometheus.io/docs/prometheus/latest/configuration/template_reference/#numbers).
|
||||
|
||||
* BUGFIX: prevent from excess CPU usage when the storage enters [read-only mode](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#readonly-mode).
|
||||
|
@ -756,6 +756,7 @@ One of the following `role` types can be configured to discover targets:
|
||||
* `__meta_kubernetes_service_labelpresent_<labelname>`: "true" for each label of the service object.
|
||||
* `__meta_kubernetes_service_name`: The name of the service object.
|
||||
* `__meta_kubernetes_service_port_name`: Name of the service port for the target.
|
||||
* `__meta_kubernetes_service_port_number`: Service port number for the target.
|
||||
* `__meta_kubernetes_service_port_protocol`: Protocol of the service port for the target.
|
||||
* `__meta_kubernetes_service_type`: The type of the service.
|
||||
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
|
||||
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promscrape/discoveryutils"
|
||||
)
|
||||
@ -79,6 +80,7 @@ func (s *Service) getTargetLabels(gw *groupWatcher) []map[string]string {
|
||||
m := map[string]string{
|
||||
"__address__": addr,
|
||||
"__meta_kubernetes_service_port_name": sp.Name,
|
||||
"__meta_kubernetes_service_port_number": strconv.Itoa(sp.Port),
|
||||
"__meta_kubernetes_service_port_protocol": sp.Protocol,
|
||||
}
|
||||
s.appendCommonLabels(m)
|
||||
|
@ -107,6 +107,7 @@ func TestParseServiceListSuccess(t *testing.T) {
|
||||
"__meta_kubernetes_service_name": "kube-dns",
|
||||
"__meta_kubernetes_service_type": "ClusterIP",
|
||||
"__meta_kubernetes_service_port_name": "dns",
|
||||
"__meta_kubernetes_service_port_number": "53",
|
||||
"__meta_kubernetes_service_port_protocol": "UDP",
|
||||
"__meta_kubernetes_service_cluster_ip": "10.96.0.10",
|
||||
|
||||
@ -130,6 +131,7 @@ func TestParseServiceListSuccess(t *testing.T) {
|
||||
"__meta_kubernetes_service_name": "kube-dns",
|
||||
"__meta_kubernetes_service_type": "ClusterIP",
|
||||
"__meta_kubernetes_service_port_name": "dns-tcp",
|
||||
"__meta_kubernetes_service_port_number": "53",
|
||||
"__meta_kubernetes_service_port_protocol": "TCP",
|
||||
"__meta_kubernetes_service_cluster_ip": "10.96.0.10",
|
||||
|
||||
@ -153,6 +155,7 @@ func TestParseServiceListSuccess(t *testing.T) {
|
||||
"__meta_kubernetes_service_name": "kube-dns",
|
||||
"__meta_kubernetes_service_type": "ClusterIP",
|
||||
"__meta_kubernetes_service_port_name": "metrics",
|
||||
"__meta_kubernetes_service_port_number": "9153",
|
||||
"__meta_kubernetes_service_port_protocol": "TCP",
|
||||
"__meta_kubernetes_service_cluster_ip": "10.96.0.10",
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user