Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pkg/config] Standardize Configuration #6805

Open
grandwizard28 opened this issue Jan 12, 2025 · 0 comments
Open

[pkg/config] Standardize Configuration #6805

grandwizard28 opened this issue Jan 12, 2025 · 0 comments
Assignees
Labels
breaking change Changes that break backward compatibility enhancement New feature or request

Comments

@grandwizard28
Copy link
Collaborator

grandwizard28 commented Jan 12, 2025

Background

Currently, SigNoz lacks a unified approach to configuration management, leading to several challenges:

  1. 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)
  1. Inconsistent naming conventions:
  • PascalCase (e.g., ClickHouseUrl)
  • snake_case (e.g., SIGNOZ_LOCAL_DB_PATH)
  1. 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:

  1. 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 over base.yaml.
  1. 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 instance web.enabled: true will become SIGNOZ_WEB_ENABLED: true.
  • Underscores (_) in yaml path will translate to double underscores (__) in the environment. For instance sqlstore.max_open_conns: 10 will become SIGNOZ_SQLSTORE_MAX__OPEN__CONNS: 10
  1. 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.

@grandwizard28 grandwizard28 added breaking change Changes that break backward compatibility enhancement New feature or request labels Jan 12, 2025
@grandwizard28 grandwizard28 self-assigned this Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Changes that break backward compatibility enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant