hashicorp / hashicorp/consul

/v1/agent/self DebugConfig's Allowed/BlockedPrefixes are not updated on config reload

Open
#8,992 0 comments 0 reactions 0 assignees View on GitHub
theme/telemetry
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Overview of the Issue

DebugConfig is described as "contain[ing] the full runtime configuration but its format is subject to change without notice or deprecation". Therefore, any changes to the runtime configuration should be reflected by the structure. In my understanding, reloading the configuration with a reload-compatible change brings changes to the runtime configuration.

When reloading the config after adding a new filter, DebugConfig is not updated even though changes are effectively taken into account and applied to filter metrics.

When starting consul with filters, DebugConfig will have them at the right place.

#### Reproduction Steps

- create a config folder with appropriate rights to be mounted by docker:
``` sh
mkdir config
```
- Create the following config file (`consul.json`) in `$(pwd)/config` :
``` json
{
"telemetry": {
"prometheus_retention_time": "120s",
"disable_hostname_true": true,
"filter_default": false,
"prefix_filter": ["+consul"]
}
}
```
- run consul - `docker run --rm --name consul -v $(pwd)/config/:/consul/config/ consul`
- enter the container - `docker exec -it consul sh`
- check that all consul metrics are present : `curl localhost:8500/v1/agent/metrics?format=prometheus`
- check that `DebugConfig["telemetry"]["AllowedPrefixes"] ` contains the value `consul` `curl localhost:8500/v1/agent/self | grep -i -A 8 -B 8 telemetry`
- edit `/consul/config/ consul.json` in the container (`vi /consul/config/consul.json`); remove the filter value (i.e. `"prefix_filter": []`)
- get consul's PID - `ps | grep consul`
- reload the config - `kill -SIGHUP `
- check that consul metrics are filtered out (no metrics starting with the name `consul`) - `curl localhost:8500/v1/agent/metrics?format=prometheus`
- check that `DebugConfig` still contains the value `consul` in `AllowedPrefixes` (has not been updated then) - `curl localhost:8500/v1/agent/self | grep -i -A 8 -B 8 telemetry`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.