Description
Background
Currently, SigNoz lacks a unified approach to configuration management, leading to several challenges:
- Configuration settings are scattered across different formats:
- Environment variables (e.g.,
SIGNOZ_LOCAL_DB_PATH
) - Command-line flags (e.g.,
-cluster
) - Command-line flags which require a file (e.g.,
-config=/root/config/prometheus.yml
)
- Inconsistent naming conventions:
- PascalCase (e.g.,
ClickHouseUrl
) - snake_case (e.g.,
SIGNOZ_LOCAL_DB_PATH
)
- Difficult to cleanup flags:
- Once a command line flag is added, it is notoriously difficult to deprecate it.
And as if this mix of config formats (env vars, flags, files) wasn't enough, we've got os.Getenv()
calls peppered throughout the codebase. Plus, good luck finding documentation about all the supported configurations!
We want to simplify configuration by removing these inconsistencies. This issue signals the direction for configuration management to ensure our users aren't surprised as we gradually move towards this.
The Direction
We will start supporting the following configuration formats with the ability to add more later:
- YAML Configuration Files
- Configurations will be provided via multiple YAML files using
--config
, for instance./signoz --config base.yaml --config override.yaml
- Files will be merged following a right-to-left precedence. In the above example, values in
override.yaml
will take precedence overbase.yaml
.
- Environment Variables
- All YAML configurations can be overridden (or specified) using environment variables.
- All env variables will be prefixed with
SIGNOZ_
to avoid collisions. - YAML paths will be converted to uppercase with underscores and prefixed with
SIGNOZ_
. For instanceweb.enabled: true
will becomeSIGNOZ_WEB_ENABLED: true
. - Underscores (
_
) in yaml path will translate to double underscores (__
) in the environment. For instancesqlstore.max_open_conns: 10
will becomeSIGNOZ_SQLSTORE_MAX__OPEN__CONNS: 10
- All existing command-line flags except
--config
will be deprecated.
Implementation
Work has already started in pkg/config
and the rest of the modules need to start adopting this package. A complete list of supported configuration can be found at https://github.com/SigNoz/signoz/blob/main/conf/example.yaml. The following list includes the availability of both the above listed options:
- 🚧 YAML Configuration Files
- ✅ Environment Variables (since v0.76.0)