Skip to content

Commit

Permalink
feat: Provide capability to limit the amount of resources to query wh…
Browse files Browse the repository at this point in the history
…en using filters/dimensions (#1619)

* Provide docs & changelog

Signed-off-by: Tom Kerkhove <[email protected]>

* Validate default metric limit

Signed-off-by: Tom Kerkhove <[email protected]>

* Update configs

Signed-off-by: Tom Kerkhove <[email protected]>

* Update sample

Signed-off-by: Tom Kerkhove <[email protected]>

* Cleanup
  • Loading branch information
tomkerkhove authored May 4, 2021
1 parent 03c8de6 commit d3bae65
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 152 deletions.
1 change: 1 addition & 0 deletions changelog/content/experimental/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version:
#### Scraper

- {{% tag added %}} Provide capability to transform metric labels in Prometheus ([docs](https://promitor.io/configuration/v2.x/runtime/scraper#prometheus-scraping-endpoint)
- {{% tag added %}} Provide capability to limit the amount of resources to query when using filters/dimensions ([docs](https://promitor.io/configuration/v2.x/metrics)
| [#1596](https://github.com/tomkerkhove/promitor/issues/1596))
- {{% tag added %}} Provide capability to define default custom labels ([docs](https://promitor.io/configuration/v2.x/metrics/)
| [#1608](https://github.com/tomkerkhove/promitor/issues/1608))
Expand Down
286 changes: 149 additions & 137 deletions config/promitor/scraper/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ azureMetadata:
metricDefaults:
aggregation:
interval: 00:05:00
limit: 10
labels:
geo: china
environment: dev
Expand Down Expand Up @@ -136,140 +137,151 @@ metrics:
type: Average
resources:
- namespace: promitor-messaging
# resourceDiscoveryGroups:
# - name: service-bus-landscape
# - name: promitor_demo_app_insights_dependency_duration
# description: "Average dependency duration per dependency type"
# resourceType: Generic
# azureMetricConfiguration:
# metricName: dependencies/duration
# dimension:
# name: dependency/type
# aggregation:
# type: Average
# resources:
# - resourceUri: Microsoft.Insights/Components/docker-hub-metrics
# resourceGroupName: docker-hub-metrics
# - name: promitor_demo_app_insights_dependency_duration_200_OK
# description: "Average dependency duration per dependency type"
# resourceType: Generic
# azureMetricConfiguration:
# metricName: dependencies/duration
# aggregation:
# type: Average
# resources:
# - resourceUri: Microsoft.Insights/Components/docker-hub-metrics
# resourceGroupName: docker-hub-metrics
# filter: dependency/resultCode eq '200'
# - name: promitor_demo_automation_job_count
# description: "Amount of jobs per Azure Automation account"
# resourceType: AutomationAccount
# azureMetricConfiguration:
# metricName: TotalJob
# aggregation:
# type: Total
# resourceDiscoveryGroups:
# - name: automation-accounts
# resources:
# - resourceGroupName: promitor-sources
# accountName: promitor-sandbox
# - name: promitor_demo_automation_update_deployment_runs
# description: "Amount of jobs per Azure Automation account"
# resourceType: AutomationAccount
# azureMetricConfiguration:
# metricName: TotalUpdateDeploymentRuns
# aggregation:
# type: Total
# resourceDiscoveryGroups:
# - name: automation-accounts
# resources:
# - resourceGroupName: promitor-sources
# accountName: promitor-sandbox
# - name: promitor_demo_automation_update_deployment_machine_runs
# description: "Amount of jobs per Azure Automation account"
# resourceType: AutomationAccount
# azureMetricConfiguration:
# metricName: TotalUpdateDeploymentMachineRuns
# aggregation:
# type: Total
# resourceDiscoveryGroups:
# - name: automation-accounts
# resources:
# - resourceGroupName: promitor-sources
# accountName: promitor-sandbox
# - name: promitor_demo_frontdoor_backend_health_per_backend
# description: "Health percentage for a backed in Azure Front Door"
# resourceType: FrontDoor
# labels:
# app: promitor
# azureMetricConfiguration:
# metricName: BackendHealthPercentage
# dimension:
# name: Backend
# aggregation:
# type: Average
# resources:
# - name: promitor-landscape
# resourceGroupName: promitor-landscape
# - name: promitor_demo_frontdoor_backend_health_per_backend_pool
# description: "Health percentage for a backed in Azure Front Door"
# resourceType: FrontDoor
# labels:
# app: promitor
# azureMetricConfiguration:
# metricName: BackendHealthPercentage
# dimension:
# name: BackendPool
# aggregation:
# type: Average
# resourceDiscoveryGroups:
# - name: front-door-landscape
# - name: promitor_demo_sql_elastic_pool_cpu
# description: "CPU percentage used for a Azure SQL Elastic Pool"
# resourceType: SqlElasticPool
# labels:
# app: promitor
# azureMetricConfiguration:
# metricName: cpu_percent
# aggregation:
# type: Average
# resourceDiscoveryGroups:
# - name: sql-elastic-pools
# - name: promitor_demo_sql_elastic_pool_allocated_storage
# description: "Percentage of allocated storage for a Azure SQL Elastic Pool"
# resourceType: SqlElasticPool
# labels:
# app: promitor
# azureMetricConfiguration:
# metricName: allocated_data_storage_percent
# aggregation:
# type: Average
# resourceDiscoveryGroups:
# - name: sql-elastic-pools
# - name: promitor_demo_synapse_apache_spark_apps_ended
# description: "Amount of apps ended running on Apache Spark pool in Azure Synapse"
# resourceType: SynapseApacheSparkPool
# azureMetricConfiguration:
# metricName: BigDataPoolApplicationsEnded
# aggregation:
# type: Total
# resourceDiscoveryGroups:
# - name: synapse-apache-spark-pools
# - name: promitor_demo_synapse_sql_pool_dwu_limit
# description: "Amount of DWUs defined as limit for SQL pool in Azure Synapse"
# resourceType: SynapseSqlPool
# azureMetricConfiguration:
# metricName: DWULimit
# aggregation:
# type: Maximum
# resourceDiscoveryGroups:
# - name: synapse-sql-pools
# - name: promitor_demo_synapse_workspace_builtin_sql_processed_bytes
# description: "Amount of bytes processed in Azure Synapse workspace"
# resourceType: SynapseWorkspace
# azureMetricConfiguration:
# metricName: BuiltinSqlPoolDataProcessedBytes
# aggregation:
# type: Total
# resourceDiscoveryGroups:
# - name: synapse-workspaces
- name: promitor_demo_servicebus_messagecount_limited
description: "Average percentage of memory usage on an Azure App Plan"
resourceType: ServiceBusNamespace
labels:
geo: europe
app: promitor
azureMetricConfiguration:
limit: 5
metricName: ActiveMessages
aggregation:
type: Average
resources:
- namespace: promitor-messaging
- name: promitor_demo_app_insights_dependency_duration
description: "Average dependency duration per dependency type"
resourceType: Generic
azureMetricConfiguration:
metricName: dependencies/duration
dimension:
name: dependency/type
aggregation:
type: Average
resources:
- resourceUri: Microsoft.Insights/Components/docker-hub-metrics
resourceGroupName: docker-hub-metrics
- name: promitor_demo_app_insights_dependency_duration_200_OK
description: "Average dependency duration per dependency type"
resourceType: Generic
azureMetricConfiguration:
metricName: dependencies/duration
aggregation:
type: Average
resources:
- resourceUri: Microsoft.Insights/Components/docker-hub-metrics
resourceGroupName: docker-hub-metrics
filter: dependency/resultCode eq '200'
- name: promitor_demo_automation_job_count
description: "Amount of jobs per Azure Automation account"
resourceType: AutomationAccount
azureMetricConfiguration:
metricName: TotalJob
aggregation:
type: Total
resourceDiscoveryGroups:
- name: automation-accounts
resources:
- resourceGroupName: promitor-sources
accountName: promitor-sandbox
- name: promitor_demo_automation_update_deployment_runs
description: "Amount of jobs per Azure Automation account"
resourceType: AutomationAccount
azureMetricConfiguration:
metricName: TotalUpdateDeploymentRuns
aggregation:
type: Total
resourceDiscoveryGroups:
- name: automation-accounts
resources:
- resourceGroupName: promitor-sources
accountName: promitor-sandbox
- name: promitor_demo_automation_update_deployment_machine_runs
description: "Amount of jobs per Azure Automation account"
resourceType: AutomationAccount
azureMetricConfiguration:
metricName: TotalUpdateDeploymentMachineRuns
aggregation:
type: Total
resourceDiscoveryGroups:
- name: automation-accounts
resources:
- resourceGroupName: promitor-sources
accountName: promitor-sandbox
- name: promitor_demo_frontdoor_backend_health_per_backend
description: "Health percentage for a backed in Azure Front Door"
resourceType: FrontDoor
labels:
app: promitor
azureMetricConfiguration:
metricName: BackendHealthPercentage
dimension:
name: Backend
aggregation:
type: Average
resources:
- name: promitor-landscape
resourceGroupName: promitor-landscape
- name: promitor_demo_frontdoor_backend_health_per_backend_pool
description: "Health percentage for a backed in Azure Front Door"
resourceType: FrontDoor
labels:
app: promitor
azureMetricConfiguration:
metricName: BackendHealthPercentage
dimension:
name: BackendPool
aggregation:
type: Average
resourceDiscoveryGroups:
- name: front-door-landscape
- name: promitor_demo_sql_elastic_pool_cpu
description: "CPU percentage used for a Azure SQL Elastic Pool"
resourceType: SqlElasticPool
labels:
app: promitor
azureMetricConfiguration:
metricName: cpu_percent
aggregation:
type: Average
resourceDiscoveryGroups:
- name: sql-elastic-pools
- name: promitor_demo_sql_elastic_pool_allocated_storage
description: "Percentage of allocated storage for a Azure SQL Elastic Pool"
resourceType: SqlElasticPool
labels:
app: promitor
azureMetricConfiguration:
metricName: allocated_data_storage_percent
aggregation:
type: Average
resourceDiscoveryGroups:
- name: sql-elastic-pools
- name: promitor_demo_synapse_apache_spark_apps_ended
description: "Amount of apps ended running on Apache Spark pool in Azure Synapse"
resourceType: SynapseApacheSparkPool
azureMetricConfiguration:
metricName: BigDataPoolApplicationsEnded
aggregation:
type: Total
resourceDiscoveryGroups:
- name: synapse-apache-spark-pools
- name: promitor_demo_synapse_sql_pool_dwu_limit
description: "Amount of DWUs defined as limit for SQL pool in Azure Synapse"
resourceType: SynapseSqlPool
azureMetricConfiguration:
metricName: DWULimit
aggregation:
type: Maximum
resourceDiscoveryGroups:
- name: synapse-sql-pools
- name: promitor_demo_synapse_workspace_builtin_sql_processed_bytes
description: "Amount of bytes processed in Azure Synapse workspace"
resourceType: SynapseWorkspace
azureMetricConfiguration:
metricName: BuiltinSqlPoolDataProcessedBytes
aggregation:
type: Total
resourceDiscoveryGroups:
- name: synapse-workspaces
10 changes: 5 additions & 5 deletions config/promitor/scraper/runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ metricSinks:
host: graphite
port: 8125
metricPrefix: promitor.
# atlassianStatuspage:
# pageId: y79z9b78ybgs
# systemMetricMapping:
# - id: nfkgnrwpn545
# promitorMetricName: promitor_demo_appplan_percentage_cpu
atlassianStatuspage:
pageId: y79z9b78ybgs
systemMetricMapping:
- id: nfkgnrwpn545
promitorMetricName: promitor_demo_appplan_percentage_cpu
metricsConfiguration:
absolutePath: /config/metrics-declaration.yaml
telemetry:
Expand Down
21 changes: 13 additions & 8 deletions docs/configuration/v2.x/metrics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ values are `v1`. *(Required)*

### Metric Defaults

- `metricDefaults.scraping.schedule` - A cron expression that controls
the frequency of 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. *(Required)*
- `metricDefaults.aggregation.interval` - The default interval which defines over
what period measurements of a metric should be aggregated.
a cron that fits your needs.
- `metricDefaults.limit` - The default maximum amount of resources to scrape when using dimensions
or filters.
- `metricDefaults.labels` - The default labels that will be applied to all metrics. _(starting as of v2.3)_
- `metricDefaults.scraping.schedule` - A cron expression that controls
the frequency of 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. *(Required)*

### Metrics

Expand All @@ -48,6 +50,8 @@ Every metric that is being declared needs to define the following fields:
- `resources` - An array of one or more resources to get metrics for. The fields
required vary depending on the `resourceType` being created, and are documented
for each resource.
- `azureMetricConfiguration.limit` - The maximum amount of resources to scrape when using dimensions
or filters.
- `resourceDiscoveryGroups` An array of one or more resource discovery groups that will be used to automatically
discover all resources through Promitor Resource Discovery. For every found resource, it will get the metrics and
report them. Learn more on resource discovery, in [our documentation](https://promitor.io/concepts/how-it-works#using-resource-discovery)
Expand Down Expand Up @@ -84,12 +88,13 @@ azureMetadata:
metricDefaults:
aggregation:
interval: 00:05:00
scraping:
# Every minute
schedule: "0 * * ? * *"
limit: 10
labels:
geo: china
environment: dev
scraping:
# Every minute
schedule: "0 * * ? * *"
metrics:
- name: azure_service_bus_active_messages
description: "The number of active messages on a service bus queue."
Expand All @@ -102,6 +107,7 @@ metrics:
schedule: "0 */2 * ? * *"
azureMetricConfiguration:
metricName: ActiveMessages
limit: 5
dimension:
name: <dimension-name>
aggregation:
Expand All @@ -111,7 +117,6 @@ metrics:
- namespace: promitor-messaging
queueName: orders
- namespace: promitor-messaging-dev
queueName: orders
resourceGroupName: promitor-dev
subscriptionId: ABC
resourceDiscoveryGroups:
Expand Down
Loading

0 comments on commit d3bae65

Please sign in to comment.