diff --git a/docs/configuration/v1.x/runtime.md b/docs/configuration/v1.x/runtime.md index 194f816fd..850fe7016 100644 --- a/docs/configuration/v1.x/runtime.md +++ b/docs/configuration/v1.x/runtime.md @@ -7,7 +7,9 @@ This article covers an overview of all the knobs that you can tweak to align the Promitor runtime is configured by mounting a volume to `/config/runtime.yaml`. -Here is a complete example: +We provide the capability to override te runtime YAML via [environment variables](#overriding-configuration-with-environment-variables), if you have the need for it. + +Here is a complete example of the runtime YAML: ```yaml server: @@ -143,4 +145,24 @@ telemetry: defaultVerbosity: error # Optional. Default: error ``` +# Overriding configuration with environment variables + +In certain scenarios you'd like to override what was configured in the runtime YAML. Therefor we provide the capability to override them via environment variables. + +Every environment variable should be prefixed with `PROMITOR_YAML_OVERRIDE_` followed by the YAML hierarchy where every level is replaced with `__` rather than a tab. Environment variables are not case sensitive. + +Our runtime configuration API endpoint allows you to verify if it was overriden and returns what will be used to run Promitor. + +> :warning: Depending on the configuration that is changed it may be required to restart Promitor, for example changing the HTTP port. + +## Example + +Let's say we want to override the following HTTP port: +```yaml +server: + httpPort: 80 +``` + +An environment variable called `PROMITOR_YAML_OVERRIDE_server__httpPort` can be provided which specifies the new port. + [← back](/) diff --git a/docs/index.md b/docs/index.md index cc3607460..9dc444255 100644 --- a/docs/index.md +++ b/docs/index.md @@ -52,6 +52,7 @@ And there is more on the way - Check our [backlog](https://github.com/tomkerkhov - [Logging & External Providers](configuration/v0.x/#logging) - **Operations** - [Azure Resource Manager API - Consumption & Throttling](operations#azure-resource-manager-api---consumption--throttling) + - [Configuration REST APIs](operations#configuration-rest-apis) - [Health](operations#health) - **Walkthroughs** - [Deploying Promitor, Prometheus, and Grafana on an AKS Cluster](/walkthrough) diff --git a/docs/operations/index.md b/docs/operations/index.md index cd0e61c9d..458f40d5c 100644 --- a/docs/operations/index.md +++ b/docs/operations/index.md @@ -33,4 +33,19 @@ Metric provides following labels: You can read more about the Azure Resource Manager limitations on [docs.microsoft.com](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits). +# Configuration REST APIs +In order to run Promitor certain aspects have to be configured. Once up & running, you typically do not touch or open the configuration anymore and just intereact with Promitor. + +For some scenarios it can be useful to know what was configured: +- Metrics are not showing up in the scraping endpoint, was it configured correctly? +- We don't see telemetry in our sink, was it turned on? +- ... + +Therefor we provide the following REST APIs: + +- **Get Metrics Declaration** - Provides a list of metrics that are being scraped +- **Get Runtime Configuration** - Provides an overview of how the runtime is configured + +For security reasons, some sections of the configuration might be sanitized in the response to avoid leaking secrets. + [← back](/) diff --git a/src/Promitor.Core/EnvironmentVariables.cs b/src/Promitor.Core/EnvironmentVariables.cs index 7c50b1dd1..69fa49285 100644 --- a/src/Promitor.Core/EnvironmentVariables.cs +++ b/src/Promitor.Core/EnvironmentVariables.cs @@ -4,8 +4,8 @@ public class EnvironmentVariables { public class Authentication { - public const string ApplicationId = "PROMITOR_AUTH_APPID"; - public const string ApplicationKey = "PROMITOR_AUTH_APPKEY"; + public const string ApplicationId = "AUTH_APPID"; + public const string ApplicationKey = "AUTH_APPKEY"; } } } \ No newline at end of file diff --git a/src/Promitor.Scraper.Host/Program.cs b/src/Promitor.Scraper.Host/Program.cs index 67f5b2731..82410ced1 100644 --- a/src/Promitor.Scraper.Host/Program.cs +++ b/src/Promitor.Scraper.Host/Program.cs @@ -45,7 +45,8 @@ private static IConfigurationRoot CreateConfiguration() .SetBasePath(Directory.GetCurrentDirectory()) .AddYamlFile("/config/runtime.yaml", optional: false, reloadOnChange: true) .AddEnvironmentVariables() - .AddEnvironmentVariables(prefix: "PROMITOR:") + .AddEnvironmentVariables(prefix: "PROMITOR_") // Used for all environment variables for Promitor + .AddEnvironmentVariables(prefix: "PROMITOR_YAML_OVERRIDE_") // Used to overwrite runtime YAML .Build(); return configuration;