diff --git a/adding-a-new-scraper.md b/adding-a-new-scraper.md index 0a395026a..6fc139092 100644 --- a/adding-a-new-scraper.md +++ b/adding-a-new-scraper.md @@ -10,6 +10,7 @@ This guide walks you through the process of adding a new scraper type. ## Configuration 1. Add your new scraping type to the `Promitor.Core.Scraping.Configuration.Model.ResourceType` 2. Describe the resource for which you're creating scraping metrics by creating `MetricDefinition`and inherit from `Promitor.Core.Scraping.Configuration.Model.Metrics.MetricDefinition` - this class should go in `.\src\Promitor.Core.Scraping\Configuration\Model\Metrics\ResourceTypes` +2. Create an example entry for your scraper in `.\samples\promitor-sample.yaml` 3. Create a new Deserializer in `.\src\Promitor.Core.Scraping\Configuration\Serialization\Deserializers`. This must inherit from `AzureMetricDeserializer`. 3. Update `Promitor.Core.Scraping.Factories.MetricDeserializerFactory` to handle your new resource type by returning a new instance of the Deserializer you created in the previous step. 4. Provide a unit test in `.\src\Promitor.Scraper.Tests.Unit\Serialization\MetricsDeclaration\` that tests the deserialization based on our sample diff --git a/docs/configuration/index.md b/docs/configuration/index.md index f403fa11c..bfc0a32b3 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -1,4 +1,3 @@ ---- layout: default title: General Configuration --- @@ -15,7 +14,6 @@ Promitor automatically scrapes Azure Monitor and makes the information available The behavior of this can be configured with the following environment variables: - **PROMITOR_CONFIGURATION_PATH** - Defines the location of the YAML file that declares what Azure Monitor metrics to scrape. If nothing is specified, `/config/metrics-declaration.yaml` will be used. - **PROMITOR_SCRAPE_BASEPATH** - Controls the path where the scraping endpoint for Prometheus is being exposed. If nothing is specified, `/prometheus/scrape` will be used. -- **PROMITOR_SCRAPE_SCHEDULE** - A cron expression that controls the fequency in which all the configured metrics will be scraped from Azure Monitor. You can use [crontab-generator.org](https://crontab-generator.org/) to generate a cron that fits your needs. If nothing is configured, `*/5 * * * *` will be used. We're also providing feature flags to opt-out of certain features: - **PROMITOR_FEATURE_METRICSTIMESTAMP** - Defines whether or not a timestamp should be included when the value was scraped on Azure Monitor. Supported values are `True` to opt-in & `False` to opt-out, if nothing is configured this will be turned on. diff --git a/docs/configuration/metrics/index.md b/docs/configuration/metrics/index.md index 486e08304..fc9d6d04b 100644 --- a/docs/configuration/metrics/index.md +++ b/docs/configuration/metrics/index.md @@ -16,12 +16,18 @@ azureMetadata: metricDefaults: aggregation: interval: 00:05:00 + scraping: + # Every minute + schedule: "0 * * ? * *" metrics: - name: demo_queue_size description: "Amount of active messages of the 'myqueue' queue" resourceType: ServiceBusQueue namespace: promitor-messaging queueName: orders + scraping: + # Every 2 minutes + schedule: "0 */2 * ? * *" azureMetricConfiguration: metricName: ActiveMessages aggregation: @@ -50,6 +56,7 @@ metrics: ## Metric Defaults +- `metricDefaults.scraping.schedule` - **[REQUIRED]** A cron expression that controls the fequency in which all the configured metrics will be scraped from Azure Monitor. You can use [crontab-generator.org](https://crontab-generator.org/) to generate a cron that fits your needs. - `metricDefaults.aggregation.interval` - The default interval which defines over what period measurements of a metric should be aggregated. ## Metrics @@ -64,6 +71,10 @@ Every metric that is being declared needs to define the following fields: - `azureMetricConfiguration.aggregation.type` - The aggregation that needs to be used when querying Azure Monitor - `azureMetricConfiguration.aggregation.interval` - Overrides the default aggregation interval defined in `metricDefaults.aggregation.interval` with a new interval +Additionally, the following fields are optional: + +- `scraping.schedule` - A scraping schedule for the individual metric; overrides the the one specified in `metricDefaults` + # Supported Azure Services Every Azure service is supported and can be scraped by using the [Generic Azure Resource](generic-azure-resource).