Open rfratto opened 2 months ago
To be clear you are wanting them to be read/write?
No, read only.
Apologies, I misinterpreted I would like to be able to not have to hard-code the listen address into my configuration files, and use an expression instead.
seems totally fine to me.
How would you feel about starting off with a subset of these?
Eg. I can't see how someone could use the value of flags.disable_reporting
or flags.extra_args
to configure a component and I'm wary that someone will try to use these in a 'smart' way to pass values around instead of grafana/alloy#308 or grafana/agent#2772
How would you feel about starting off with a subset of these?
I think it's a worthwhile discussion to have. Normally I prefer consistency, where exposing every flag would achieve that. Exposing a subset of flags also runs the risk of asking users to wait for future releases if someone does identify a use case for a flag value we chose not to expose initially.
This issue has not had any activity in the past 30 days, so the needs-attention
label has been added to it.
If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue.
The needs-attention
label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!
Request
I want to expose all command-line flag values to the standard library.
I'm not sure where the best place for this would be, and more discussion is needed. To kickstart discussions, this proposal will use a new top-level value called
flags
, a counterpart toconstants
:flags.server.http.enable_pprof
: Set to the value of--server.http.enable-pprof
flags.server.http.memory_addr
: Set to the value of--server.http.memory-addr
flags.server.http.listen_addr
: Set to the value of--server.http.listen-addr
flags.server.http.ui_path_prefix
: Set to the value of--server.http.ui-path-prefix
flags.storage.path
: Set to the value of--storage.path
flags.disable_reporting
: Set to the value of--disable-reporting
flags.cluster.enabled
: Set to the value of--cluster.enabled
flags.cluster.node_name
: Set to the value of--cluster.node-name
flags.cluster.join_addresses
: Set to the value of--cluster.join-addresses
flags.cluster.discover_peers
: Set to the value of--cluster.discover-peers
flags.cluster.rejoin_interval
: Set to the value of--cluster.rejoin-interval
flags.cluster.advertise_address
: Set to the value of--cluster.advertise-address
flags.cluster.advertise_interfaces
: Set to the value of--cluster.advertise-interfaces
flags.cluster.max_join_peers
: Set to the value of--cluster.max-join-peers
flags.cluster.name
: Set to the value of--cluster.name
flags.config.format
: Set to the value of--config.format
flags.config.bypass_conversion_errors
: Set to the value of--config.bypass-conversion-errors
flags.extra_args
: Set to the value of--config.extra-args
flags.stability.level
: Set to the value of--stability.level
Here, the flag names are transformed so that
-
is replaced with_
to be useable as an Alloy syntax identifier.I initially proposed adding these as a sub-key in
options
(options.settings.FLAG_PATH
) but the names were very unwieldy.Use case
I deploy Alloy on my systems with a non-default listen port (usually
12380
) to not collide with local development. I would like to be able to not have to hard-code the listen address into my configuration files, and use an expression instead. Normally I'd be able to usealloy.internal:12345
, but even that is configurable, and doesn't work in all cases (see #603).While I personally really only need
constants.options.server.http.listen_addr
andconstants.options.server.http.memory_addr
, I do think it would be generally a good idea to expose all of the command-line flags, as I'm sure use cases would arise where other values are useful (I can imagineconstants.options.stability.level
becoming more useful over time in modules to enable different behaviour at runtime within a module source).