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

Filtering by dimensions which include / in name does not work in generic scraper #1273

Merged
merged 8 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions config/promitor/scraper/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ metrics:
type: Total
resourceDiscoveryGroups:
- name: service-bus-landscape
- name: promitor_demo_app_insights
- name: promitor_demo_app_insights_dependency_duration
description: "Average dependency duration per dependency type"
resourceType: Generic
azureMetricConfiguration:
Expand All @@ -139,4 +139,15 @@ metrics:
type: Average
resources:
- resourceUri: Microsoft.Insights/Components/docker-hub-metrics
resourceGroupName: 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'
5 changes: 5 additions & 0 deletions src/Promitor.Core.Scraping/ResourceTypes/GenericScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@ protected override string BuildResourceUri(string subscriptionId, ScrapeDefiniti
{
return string.Format(ResourceUriTemplate, subscriptionId, scrapeDefinition.ResourceGroupName, resource.ResourceUri);
}

protected override string DetermineMetricFilter(GenericAzureResourceDefinition resourceDefinition)
{
return resourceDefinition.Filter;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ private IWithMetricsQueryExecute CreateMetricsQuery(AggregationType metricAggreg

if (string.IsNullOrWhiteSpace(metricFilter) == false)
{
metricQuery.WithOdataFilter(metricFilter);
var filter = metricFilter.Replace("/", "%2F");
metricQuery.WithOdataFilter(filter);
}

if (string.IsNullOrWhiteSpace(metricDimension) == false)
Expand Down