mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-13 13:11:37 +01:00
lib/promscrape/discovery/azure: add __meta_azure_machine_size label in the same way as Prometheus does
See https://github.com/prometheus/prometheus/pull/11650
This commit is contained in:
parent
134f7622d6
commit
855d560789
@ -21,9 +21,10 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
||||
* FEATURE: [vmui](https://docs.victoriametrics.com/#vmui): embed fonts into binary instead of loading them from external sources. This allows using `vmui` in full from isolated networks without access to Internet. Thanks to @ScottKevill for [the pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3696).
|
||||
* FEATURE: [vmui](https://docs.victoriametrics.com/#vmui): add ability to switch between tenants by selecting the needed tenant in the drop-down list at the top right corner of the UI. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3673).
|
||||
* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): reduce memory usage when sending stale markers for targets, which expose big number of metrics. See [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3668) and [this](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3675) issues.
|
||||
* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `__meta_kubernetes_pod_container_id` meta-label to the targets discovered via [kubernetes_sd_configs](https://docs.victoriametrics.com/sd_configs.html#kubernetes_sd_configs). This label has been added in Prometheus starting from `v2.42.0`. See [this feature request](https://github.com/prometheus/prometheus/issues/11843).
|
||||
* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `__meta_azure_machine_size` meta-label to the targets discovered via [azure_sd_configs](https://docs.victoriametrics.com/sd_configs.html#azure_sd_configs). This label has been added in Prometheus starting from `v2.42.0`. See [this pull request](https://github.com/prometheus/prometheus/pull/11650).
|
||||
* FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth.html): allow limiting the number of concurrent requests sent to `vmauth` via `-maxConcurrentRequests` command-line flag. This allows controlling memory usage of `vmauth` and the resource usage of backends behind `vmauth`. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3346). Thanks to @dmitryk-dk for [the initial implementation](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/3486).
|
||||
* FEATURE: allow using VictoriaMetrics components behind proxies, which communicate with the backend via [proxy protocol](https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt). See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3335). For example, [vmauth](https://docs.victoriametrics.com/vmauth.html) accepts proxy protocol connections when it starts with `-httpListenAddr.useProxyProtocol` command-line flag.
|
||||
* FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `__meta_kubernetes_pod_container_id` meta-label to the targets discovered via [kubernetes_sd_configs](https://docs.victoriametrics.com/sd_configs.html#kubernetes_sd_configs). This label has been added in Prometheus starting from `v2.42.0`. See [this feature request](https://github.com/prometheus/prometheus/issues/11843).
|
||||
* FEATURE: add `-internStringMaxLen` command-line flag, which can be used for fine-tuning RAM vs CPU usage in certain workloads. For example, if the stored time series contain long labels, then it may be useful reducing the `-internStringMaxLen` in order to reduce memory usage at the cost of increased CPU usage. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3692).
|
||||
|
||||
* BUGFIX: fix a bug, which could prevent background merges for the previous partitions until restart if the storage didn't have enough disk space for final deduplication and down-sampling.
|
||||
|
@ -82,8 +82,9 @@ The following meta labels are available on discovered targets during [relabeling
|
||||
* `__meta_azure_machine_private_ip`: the machine's private IP
|
||||
* `__meta_azure_machine_public_ip`: the machine's public IP if it exists
|
||||
* `__meta_azure_machine_resource_group`: the machine's resource group
|
||||
* `__meta_azure_machine_tag_<tagname>`: each tag value of the machine
|
||||
* `__meta_azure_machine_scale_set`: the name of the scale set which the vm is part of (this value is only set if you are using a scale set)
|
||||
* `__meta_azure_machine_size`: the machine size
|
||||
* `__meta_azure_machine_tag_<tagname>`: each tag value of the machine
|
||||
* `__meta_azure_subscription_id`: the subscription ID
|
||||
* `__meta_azure_tenant_id`: the tenant ID
|
||||
|
||||
@ -789,8 +790,8 @@ One of the following `role` types can be configured to discover targets:
|
||||
* `__meta_kubernetes_pod_annotation_<annotationname>`: Each annotation from the pod object.
|
||||
* `__meta_kubernetes_pod_annotationpresent_<annotationname>`: "true" for each annotation from the pod object.
|
||||
* `__meta_kubernetes_pod_container_id`: ID of the container in the form `<type>://<container_id>`.
|
||||
* `__meta_kubernetes_pod_container_init`: "true" if the container is an InitContainer.
|
||||
* `__meta_kubernetes_pod_container_image`: Container image the target address points to.
|
||||
* `__meta_kubernetes_pod_container_init`: "true" if the container is an InitContainer.
|
||||
* `__meta_kubernetes_pod_container_name`: Name of the container the target address points to.
|
||||
* `__meta_kubernetes_pod_container_port_name`: Name of the container port.
|
||||
* `__meta_kubernetes_pod_container_port_number`: Number of the container port.
|
||||
|
@ -97,6 +97,9 @@ func appendMachineLabels(vms []virtualMachine, port int, sdc *SDConfig) []*promu
|
||||
if vm.scaleSet != "" {
|
||||
m.Add("__meta_azure_machine_scale_set", vm.scaleSet)
|
||||
}
|
||||
if vm.Properties.HardwareProfile.VMSize != "" {
|
||||
m.Add("__meta_azure_machine_size", vm.Properties.HardwareProfile.VMSize)
|
||||
}
|
||||
for k, v := range vm.Tags {
|
||||
m.Add(discoveryutils.SanitizeLabelName("__meta_azure_machine_tag_"+k), v)
|
||||
}
|
||||
|
@ -16,12 +16,16 @@ func TestAppendMachineLabels(t *testing.T) {
|
||||
}
|
||||
f("single vm", []virtualMachine{
|
||||
{
|
||||
Name: "vm-1",
|
||||
ID: "id-2",
|
||||
Type: "Azure",
|
||||
Location: "eu-west-1",
|
||||
Properties: virtualMachineProperties{OsProfile: osProfile{ComputerName: "test-1"}, StorageProfile: storageProfile{OsDisk: osDisk{OsType: "Linux"}}},
|
||||
Tags: map[string]string{"key-1": "value-1"},
|
||||
Name: "vm-1",
|
||||
ID: "id-2",
|
||||
Type: "Azure",
|
||||
Location: "eu-west-1",
|
||||
Properties: virtualMachineProperties{
|
||||
OsProfile: osProfile{ComputerName: "test-1"},
|
||||
StorageProfile: storageProfile{OsDisk: osDisk{OsType: "Linux"}},
|
||||
HardwareProfile: hardwareProfile{VMSize: "big"},
|
||||
},
|
||||
Tags: map[string]string{"key-1": "value-1"},
|
||||
ipAddresses: []vmIPAddress{
|
||||
{privateIP: "10.10.10.1"},
|
||||
},
|
||||
@ -36,6 +40,7 @@ func TestAppendMachineLabels(t *testing.T) {
|
||||
"__meta_azure_machine_computer_name": "test-1",
|
||||
"__meta_azure_machine_location": "eu-west-1",
|
||||
"__meta_azure_machine_private_ip": "10.10.10.1",
|
||||
"__meta_azure_machine_size": "big",
|
||||
"__meta_azure_machine_tag_key_1": "value-1",
|
||||
}),
|
||||
})
|
||||
|
@ -29,9 +29,14 @@ type vmIPAddress struct {
|
||||
}
|
||||
|
||||
type virtualMachineProperties struct {
|
||||
NetworkProfile networkProfile `json:"networkProfile,omitempty"`
|
||||
OsProfile osProfile `json:"osProfile,omitempty"`
|
||||
StorageProfile storageProfile `json:"storageProfile,omitempty"`
|
||||
NetworkProfile networkProfile `json:"networkProfile,omitempty"`
|
||||
OsProfile osProfile `json:"osProfile,omitempty"`
|
||||
StorageProfile storageProfile `json:"storageProfile,omitempty"`
|
||||
HardwareProfile hardwareProfile `json:"hardwareProfile,omitempty"`
|
||||
}
|
||||
|
||||
type hardwareProfile struct {
|
||||
VMSize string `json:"vmSize,omitempty"`
|
||||
}
|
||||
|
||||
type storageProfile struct {
|
||||
@ -45,6 +50,7 @@ type osDisk struct {
|
||||
type osProfile struct {
|
||||
ComputerName string `json:"computerName,omitempty"`
|
||||
}
|
||||
|
||||
type networkProfile struct {
|
||||
// NetworkInterfaces - Specifies the list of resource Ids for the network interfaces associated with the virtual machine.
|
||||
NetworkInterfaces []networkInterfaceReference `json:"networkInterfaces,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user