From dc82fa66dc77d29fd80fc39d1361fcf1ef163843 Mon Sep 17 00:00:00 2001 From: Tom Kerkhove Date: Tue, 8 Sep 2020 08:42:58 +0200 Subject: [PATCH 1/6] Apply filter Signed-off-by: Tom Kerkhove --- src/Promitor.Core.Scraping/ResourceTypes/GenericScraper.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Promitor.Core.Scraping/ResourceTypes/GenericScraper.cs b/src/Promitor.Core.Scraping/ResourceTypes/GenericScraper.cs index 5ec944d8b..ce97b902d 100644 --- a/src/Promitor.Core.Scraping/ResourceTypes/GenericScraper.cs +++ b/src/Promitor.Core.Scraping/ResourceTypes/GenericScraper.cs @@ -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; + } } } \ No newline at end of file From 4ad1941aacb71b8de0f61ebe29c8f08d72198a57 Mon Sep 17 00:00:00 2001 From: Tom Kerkhove Date: Tue, 8 Sep 2020 08:43:16 +0200 Subject: [PATCH 2/6] Temporarly add request Signed-off-by: Tom Kerkhove --- request.json | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 request.json diff --git a/request.json b/request.json new file mode 100644 index 000000000..9d0833ec7 --- /dev/null +++ b/request.json @@ -0,0 +1,30 @@ +{ + "requests": [{ + "content": [{ + "id": "/subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/microsoft.insights/components/docker-hub-metricsdependencies/duration#avg#Summary", + "parameters": { + "aggregation": "avg", + "filter": "((dependency/resultCode eq '500'))", + "metricId": "dependencies/duration", + "orderby": "avg desc", + "timespan": "2020-09-06T15:30:00.000Z/2020-09-07T15:30:00.000Z", + "top": 10 + } + }, { + "id": "/subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/microsoft.insights/components/docker-hub-metricsdependencies/duration#avg#Series", + "parameters": { + "aggregation": "avg", + "filter": "((dependency/resultCode eq '500'))", + "interval": "PT5M", + "metricId": "dependencies/duration", + "orderby": "avg desc", + "timespan": "2020-09-06T15:25:00.000Z/2020-09-07T15:30:00.000Z", + "top": 30 + } + } + ], + "httpMethod": "POST", + "relativeUrl": "/subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/microsoft.insights/components/docker-hub-metrics/metrics?useKusto=true&useMDM=false&prefer=ai.include-metadata,ai.ignoreInvalidFilterDimensions=true&api-version=2018-04-20" + } + ] +} From 21194c091642d8f4c7865347f888307e53cfa6f1 Mon Sep 17 00:00:00 2001 From: Tom Kerkhove Date: Wed, 9 Sep 2020 16:43:03 +0200 Subject: [PATCH 3/6] Replace / Signed-off-by: Tom Kerkhove --- src/Promitor.Integrations.AzureMonitor/AzureMonitorClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Promitor.Integrations.AzureMonitor/AzureMonitorClient.cs b/src/Promitor.Integrations.AzureMonitor/AzureMonitorClient.cs index 6efa719e8..e30a41646 100644 --- a/src/Promitor.Integrations.AzureMonitor/AzureMonitorClient.cs +++ b/src/Promitor.Integrations.AzureMonitor/AzureMonitorClient.cs @@ -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) From 083937dd0201cb36290e64f04fa7fc9637be2581 Mon Sep 17 00:00:00 2001 From: Tom Kerkhove Date: Wed, 9 Sep 2020 17:42:11 +0200 Subject: [PATCH 4/6] Update config Signed-off-by: Tom Kerkhove --- config/promitor/scraper/metrics.yaml | 15 +++++++++++++-- config/promitor/scraper/runtime.yaml | 5 ----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/config/promitor/scraper/metrics.yaml b/config/promitor/scraper/metrics.yaml index a30605b0d..1d683695e 100644 --- a/config/promitor/scraper/metrics.yaml +++ b/config/promitor/scraper/metrics.yaml @@ -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: @@ -139,4 +139,15 @@ metrics: type: Average resources: - resourceUri: Microsoft.Insights/Components/docker-hub-metrics - resourceGroupName: docker-hub-metrics \ No newline at end of file + 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' \ No newline at end of file diff --git a/config/promitor/scraper/runtime.yaml b/config/promitor/scraper/runtime.yaml index 0a99dba85..e63cd9c7a 100644 --- a/config/promitor/scraper/runtime.yaml +++ b/config/promitor/scraper/runtime.yaml @@ -9,11 +9,6 @@ metricSinks: host: graphite port: 8125 metricPrefix: promitor. - atlassianStatuspage: - pageId: y79z9b78ybgs - systemMetricMapping: - - id: nfkgnrwpn545 - promitorMetricName: promitor_demo_appplan_percentage_cpu metricsConfiguration: absolutePath: /config/metrics-declaration.yaml telemetry: From cd2ca4c36bf2f2b2c90e2d1d2eda6988bd299618 Mon Sep 17 00:00:00 2001 From: Tom Kerkhove Date: Wed, 9 Sep 2020 17:43:58 +0200 Subject: [PATCH 5/6] Re-add Signed-off-by: Tom Kerkhove --- config/promitor/scraper/runtime.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/promitor/scraper/runtime.yaml b/config/promitor/scraper/runtime.yaml index e63cd9c7a..0a99dba85 100644 --- a/config/promitor/scraper/runtime.yaml +++ b/config/promitor/scraper/runtime.yaml @@ -9,6 +9,11 @@ metricSinks: host: graphite port: 8125 metricPrefix: promitor. + atlassianStatuspage: + pageId: y79z9b78ybgs + systemMetricMapping: + - id: nfkgnrwpn545 + promitorMetricName: promitor_demo_appplan_percentage_cpu metricsConfiguration: absolutePath: /config/metrics-declaration.yaml telemetry: From dec72dc643affe7fa8c83a3be9ee3950ebb60e83 Mon Sep 17 00:00:00 2001 From: Tom Kerkhove Date: Wed, 9 Sep 2020 17:44:19 +0200 Subject: [PATCH 6/6] Remove temp file Signed-off-by: Tom Kerkhove --- request.json | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 request.json diff --git a/request.json b/request.json deleted file mode 100644 index 9d0833ec7..000000000 --- a/request.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "requests": [{ - "content": [{ - "id": "/subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/microsoft.insights/components/docker-hub-metricsdependencies/duration#avg#Summary", - "parameters": { - "aggregation": "avg", - "filter": "((dependency/resultCode eq '500'))", - "metricId": "dependencies/duration", - "orderby": "avg desc", - "timespan": "2020-09-06T15:30:00.000Z/2020-09-07T15:30:00.000Z", - "top": 10 - } - }, { - "id": "/subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/microsoft.insights/components/docker-hub-metricsdependencies/duration#avg#Series", - "parameters": { - "aggregation": "avg", - "filter": "((dependency/resultCode eq '500'))", - "interval": "PT5M", - "metricId": "dependencies/duration", - "orderby": "avg desc", - "timespan": "2020-09-06T15:25:00.000Z/2020-09-07T15:30:00.000Z", - "top": 30 - } - } - ], - "httpMethod": "POST", - "relativeUrl": "/subscriptions/0f9d7fea-99e8-4768-8672-06a28514f77e/resourceGroups/docker-hub-metrics/providers/microsoft.insights/components/docker-hub-metrics/metrics?useKusto=true&useMDM=false&prefer=ai.include-metadata,ai.ignoreInvalidFilterDimensions=true&api-version=2018-04-20" - } - ] -}