Introduction
Vault Telemetry provides administrators with a wealth of information regarding the operation of HashiCorp Vault. The telemetry stanza specifies various configurations for Vault to publish metrics to upstream systems. Available Vault metrics can be found in the Telemetry internals documentation. In this stanza, there are a few parameters that let you control the structure of the data. The two that we will discuss below let administrators control whether or not a hostname is prefixed to gauge values, and whether a metric should include a label denoting the host.
Explanation
disable_hostname
The disable_hostname
value toggles whether or not gauge values should be prefixed with a local hostname. To see this in action, you have to view the raw data by sending the Vault process a USR1
signal - I've included an example of this command below.
kill -s USR1 <pid_of_vault>
Here are examples of this value disabled and enabled:
# disable_hostname set to false - note the appended hostname "0b5e82da6211"
[2022-05-09 15:15:30 +0000 UTC][G] 'vault.0b5e82da6211.runtime.alloc_bytes': 17073992.000
# disable_hostname set to true - note the lack of hostname
[2022-05-09 15:18:00 +0000 UTC][G] 'vault.runtime.alloc_bytes': 11546328.000
enable_hostname_label
The enable_hostname_label
specifies if metrics should include a label denoting the 'host'. I can demonstrate by hitting the sys/metrics
endpoint and specifying the format to be prometheus
. An example of that command is below.
curl --header "X-Vault-Token: <insert_token_here>" 'http://127.0.0.1:8200/v1/sys/metrics?format=prometheus'
Here are examples of this value disabled and enabled:
# enable_hostname_label set to false - note the lack of a host label
vault_runtime_malloc_count 118103
# enable_hostname_label set to true - note the host label "{host="0b5e82da6211"}"
vault_runtime_malloc_count{host="0b5e82da6211"} 187163