Description
openedon Feb 19, 2022
Describe the bug
I noticed that the -frontend.instance-interface-names
argument actually appends the interface name to the existing default list instead of overriding it fully from the value given in the CLI. For example:
$ docker run --rm grafana/loki:2.4.2 -config.file=/etc/loki/local-config.yaml -frontend.instance-interface-names=myiface -print-config-stderr
(...)
frontend:
log_queries_longer_than: 0s
max_body_size: 10485760
query_stats_enabled: false
max_outstanding_per_tenant: 100
querier_forget_delay: 0s
scheduler_address: ""
scheduler_dns_lookup_period: 10s
scheduler_worker_concurrency: 5
grpc_client_config:
max_recv_msg_size: 104857600
max_send_msg_size: 16777216
grpc_compression: ""
rate_limit: 0
rate_limit_burst: 0
backoff_on_ratelimits: false
backoff_config:
min_period: 100ms
max_period: 10s
max_retries: 10
tls_enabled: false
tls_cert_path: ""
tls_key_path: ""
tls_ca_path: ""
tls_server_name: ""
tls_insecure_skip_verify: false
instance_interface_names: # this should be a list with 'myiface' alone, but 'myiface' got appended instead
- eth0
- en0
- lo
- myiface
address: ""
port: 0
compress_responses: false
downstream_url: ""
tail_proxy_url: ""
(...)
I don't think I'm using the CLI incorrectly here, and I also noticed that it happens with any CLI argument that refers to interface names. Maybe it affects all options that are lists?
Moreover, if you want to set multiple values, this also doesn't work and instead single-appends anything passed:
EDIT: It was clarified that to append multiple values, you have to provide the CLI argument multiple times.
If this is the intended behaviour for -frontend.instance-interface-names
(and other similar options) then maybe the CLI argument is a bit useless because interface names are tried in top-down order in the list, thus any option passed has little effect if you want to override the default values.
To Reproduce
Steps to reproduce the behavior:
-
Start Loki with the
-frontend.instance-interface-names=myiface
argument and the-print-config-stderr
to see the applied configuration:docker run --rm grafana/loki:2.4.2 -config.file=/etc/loki/local-config.yaml -frontend.instance-interface-names=myiface -print-config-stderr
-
Observe in the printed configuration the
frontend.instance_interface_names
list. -
Observe that the list has
myiface
appended to the bottom of the existing defaults instead of being set exclusively.
Expected behavior
I expected that the -frontend.instance-interface-names
CLI argument (and any other argument affecting lists) sets the relevant list completely from the value given instead of appending to any existing list of values.
Moreover, if I pass multiple values, i.e. comma-separated, I expect each of them to be set (in order) to the relevant list as individual items.
For example:
$ docker run --rm grafana/loki:2.4.2 -config.file=/etc/loki/local-config.yaml -frontend.instance-interface-names=myiface -print-config-stderr
(...)
frontend:
(...)
instance_interface_names:
- myiface
(...)
Environment:
- Infrastructure: plain Loki binary in bare-metal or Docker container
- Deployment tool: N/A
Activity