support environment variables in properties#1828
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an environment-variable configuration layer and standardizes property naming to snake_case while preserving backward compatibility via key normalization.
Changes:
- Introduces
PropertySourceto unify external, environment, and “regular” (system/file/classpath) properties with defined precedence. - Adds environment-variable loading (
IO_PROMETHEUS_*) and camelCase→snake_case normalization for file/system/external keys. - Updates config docs, test resources, and tests to use the new snake_case property names and new loader APIs.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1d05224 to
8ee2b21
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
i know this isn't new behavior, but I found this to be surprising that we would throw for this condition as opposed to just logging a warning. For example, if we deprecate a property and someone forgets to remove it from their config, their service will crash?
There was a problem hiding this comment.
Fail early is an idiom in this library (@fstab probably has more background info). That means that we have to be very careful with removing - probably only in a major release.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
ffd74a0 to
16923c7
Compare

Summary
No Breaking Changes. This is fully backward compatible:
Migration Guide
No migration required. However, to adopt the new features:
To use environment variables: Convert property names to uppercase with underscores
io.prometheus.exporter.httpServer.port→IO_PROMETHEUS_EXPORTER_HTTP_SERVER_PORTTo use snake_case (recommended): Update properties files
io.prometheus.metrics.exemplarsEnabled→io.prometheus.metrics.exemplars_enabledNotes