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

feat: Provide capability to define default custom labels #1613

Merged
merged 6 commits into from
Apr 28, 2021

Conversation

tomkerkhove
Copy link
Owner

@tomkerkhove tomkerkhove commented Apr 28, 2021

Fixes #1608

Example

Assuming this configuration:

version: v1
azureMetadata:
  tenantId: c8819874-9e56-4e3f-b1a8-1c0325138f27
  subscriptionId: 0f9d7fea-99e8-4768-8672-06a28514f77e
  resourceGroupName: promitor
metricDefaults:
  aggregation:
    interval: 00:05:00
  labels:
    geo: china
    environment: dev
  scraping:
    # Every minute
    schedule: "0 * * ? * *"
metrics:
- name: promitor_demo_function_memory_discovery
  description: "Average memory for an Azure Function App"
  resourceType: FunctionApp
  azureMetricConfiguration:
    metricName: MemoryWorkingSet
    aggregation:
      type: Average
  resourceDiscoveryGroups:
  - name: function-app-landscape
- name: promitor_demo_servicebus_messagecount_discovered
  description: "Average percentage of memory usage on an Azure App Plan"
  resourceType: ServiceBusNamespace
  labels:
    geo: europe
    app: promitor
  azureMetricConfiguration:
    metricName: ActiveMessages
    aggregation:
      type: Average
  resourceDiscoveryGroups:
  - name: service-bus-landscape

It generates the following input:

# HELP promitor_demo_function_memory_discovery Average memory for an Azure Function App
# TYPE promitor_demo_function_memory_discovery gauge
promitor_demo_function_memory_discovery{resource_group="promitor-sources",subscription_id="0f9d7fea-99e8-4768-8672-06a28514f77e",resource_uri="subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/promitor-sources/providers/Microsoft.Web/sites/promitor-function-app",instance_name="promitor-function-app",slot_name="production",geo="china",environment="dev"} 40055547.66101695 1619636185372
# HELP promitor_demo_servicebus_messagecount_discovered Average percentage of memory usage on an Azure App Plan
# TYPE promitor_demo_servicebus_messagecount_discovered gauge
promitor_demo_servicebus_messagecount_discovered{resource_group="keda-demos",subscription_id="0f9d7fea-99e8-4768-8672-06a28514f77e",resource_uri="subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/keda-demos/providers/Microsoft.ServiceBus/namespaces/keda-demos",instance_name="keda-demos",entity_name="orders",geo="europe",app="promitor",environment="dev"} 0 1619636186009

Hence that the metric-level label for geo wins over the default one.

Signed-off-by: Tom Kerkhove <[email protected]>
Signed-off-by: Tom Kerkhove <[email protected]>
Signed-off-by: Tom Kerkhove <[email protected]>
@tomkerkhove tomkerkhove marked this pull request as ready for review April 28, 2021 18:59
@tomkerkhove tomkerkhove merged commit 1721d5b into master Apr 28, 2021
@tomkerkhove tomkerkhove deleted the default-labels branch April 28, 2021 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide capability to define default custom labels
1 participant