Open ResDiaryLewis opened 3 years ago
Odd because I don't use it myself: https://github.com/tomkerkhove/promitor/blob/master/config/promitor/scraper/metrics.yaml
I'll try to reproduce and see what is causing this.
Odd because I don't use it myself: https://github.com/tomkerkhove/promitor/blob/master/config/promitor/scraper/metrics.yaml
I'll try to reproduce and see what is causing this.
Thanks! I'll actually get back to you with some more info soon - I'm in the process of upgrading from version 1.x
and I've found that only specific metrics throw this error, so I should be able to isolate it.
We're using a custom Helm configuration because we wrote our own when we first adopted Promitor a while ago. The way that it builds up metric definitions can result in definitions where resources
is an empty array []
. I think that's what causes this error message. Here's some examples:
Promitor starts as expected:
version: v1
azureMetadata:
tenantId: "tenant"
subscriptionId: "sub"
resourceGroupName: "group"
metricDefaults:
aggregation:
interval: "00:05:00"
scraping:
schedule: "*/1 * * * *"
metrics:
# SQL Database metrics, for each aggregation and metric combination
- name: "azure_sql_cpu_percent_average"
description: "'cpu_percent' with aggregation 'Average'"
resourceType: "Generic"
labels:
component: "sql-database"
azureMetricConfiguration:
metricName: "cpu_percent"
aggregation:
type: "Average"
resources:
# Ignore vCoreModel databases for the dtu_consumption_percent metric
- resourceGroupName: "group"
resourceUri: "Microsoft.Sql/servers/server/databases/db"
# Loadbalancer metrics, for each aggregation and metric combination
- name: "azure_lb_VipAvailability_average"
description: "'VipAvailability' with aggregation 'Average'"
resourceType: "Generic"
labels:
component: "load-balancer"
azureMetricConfiguration:
metricName: "VipAvailability"
aggregation:
type: "Average"
resources:
- resourceGroupName: "group"
resourceUri: "Microsoft.Network/loadBalancers/lb"
We get a useful error message: Error 25:3: Either 'resources' or 'resourceDiscoveryGroups' must be specified.
version: v1
azureMetadata:
tenantId: "tenant"
subscriptionId: "sub"
resourceGroupName: "group"
metricDefaults:
aggregation:
interval: "00:05:00"
scraping:
schedule: "*/1 * * * *"
metrics:
# SQL Database metrics, for each aggregation and metric combination
- name: "azure_sql_cpu_percent_average"
description: "'cpu_percent' with aggregation 'Average'"
resourceType: "Generic"
labels:
component: "sql-database"
azureMetricConfiguration:
metricName: "cpu_percent"
aggregation:
type: "Average"
resources: []
# Loadbalancer metrics, for each aggregation and metric combination
- name: "azure_lb_VipAvailability_average"
description: "'VipAvailability' with aggregation 'Average'"
resourceType: "Generic"
labels:
component: "load-balancer"
azureMetricConfiguration:
metricName: "VipAvailability"
aggregation:
type: "Average"
resources: []
Promitor gives the error message mentioned above in the OP.
version: v1
azureMetadata:
tenantId: "tenant"
subscriptionId: "sub"
resourceGroupName: "group"
metricDefaults:
aggregation:
interval: "00:05:00"
scraping:
schedule: "*/1 * * * *"
metrics:
# SQL Database metrics, for each aggregation and metric combination
- name: "azure_sql_cpu_percent_average"
description: "'cpu_percent' with aggregation 'Average'"
resourceType: "Generic"
labels:
component: "sql-database"
azureMetricConfiguration:
metricName: "cpu_percent"
aggregation:
type: "Average"
resources:
# Ignore vCoreModel databases for the dtu_consumption_percent metric
- resourceGroupName: "group"
resourceUri: "Microsoft.Sql/servers/server/databases/db"
# Loadbalancer metrics, for each aggregation and metric combination
- name: "azure_lb_VipAvailability_average"
description: "'VipAvailability' with aggregation 'Average'"
resourceType: "Generic"
labels:
component: "load-balancer"
azureMetricConfiguration:
metricName: "VipAvailability"
aggregation:
type: "Average"
resources: []
So this is more of my fault than yours Tom, maybe there's an argument for the error message not being very helpful but that's an aside! I'll leave you to close this issue if you want to. Thanks for bearing with me!
Ha interesting, but I don't really understand what caused it, because the exception message is indeed not really helpful.
Can you clarify the cause of it please?
If it helps, as I was migrating to 2.x
I saw this error again after forgetting to change ServiceBusQueue
to ServiceBusNamespace
for a declaration.
Ha interesting, but I don't really understand what caused it, because the exception message is indeed not really helpful.
Can you clarify the cause of it please?
I guess that having an empty resources
list counts as a malformed configuration, but I'm unsure why the error message changes when one metric declaration is fine and another is not.
If it helps, as I was migrating to
2.x
I saw this error again after forgetting to changeServiceBusQueue
toServiceBusNamespace
for a declaration.
I can reproduce this again by having one "good" metric declaration and another "bad" one (where the resource type isn't valid as it's ServiceBusQueue
). So I'm guessing that the validation isn't evaluating every declaration.
Very odd, thanks for letting me know - I'll look at it!
Another case that triggered this:
metrics:
- name: promitor_demo_cdn_requests_declared
description: "Amount of requests at the origin of our Azure CDN"
resourceType: Cdn
azureMetricConfiguration:
metricName: OriginRequestCount
aggregation:
type: Total
resources:
- - name: promitor-testing-resource-us-cdn
+ - cdnName: promitor-testing-resource-us-cdn
resourceGroupName: promitor-testing-infrastructure-us
Report
In the docs here, it mentions this:
However I receive various when this field is omitted.
Expected Behavior
If a metric is missing a scraping schedule, the metric default schedule should be used.
Actual Behavior
If the
scraping
block is omitted entirely from a metric, this error is thrown:I've not found a way to omit this, instead I'm just duplicating the default to each metric like this:
I've tried to set
scraping
to~
or{}
too.Steps to Reproduce the Problem
metrics-declaration.yaml
config file.scraping
field from a metric, e.g.:Component
Scraper
Version
2.3.0
Configuration
Configuration:
Logs
Platform
Microsoft Azure
Contact Details
lewis.jackson@resdiary.com