-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide scrapers for App Services (App Plan, Web App, Function) (#820)
* Provide docs for new scrapers * Provide app service scrapers Signed-off-by: Tom Kerkhove <[email protected]> * Support slots for Azure Function App Signed-off-by: Tom Kerkhove <[email protected]> * Provide better support for slots Signed-off-by: Tom Kerkhove <[email protected]>
- Loading branch information
1 parent
95295b8
commit 1965793
Showing
34 changed files
with
1,146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
layout: default | ||
title: Azure App Plan Declaration | ||
--- | ||
|
||
## Azure App Plan - ![Availability Badge](https://img.shields.io/badge/Available%20Starting-v1.2-green.svg) | ||
|
||
You can declare to scrape an Azure App Plan via the `AppPlan` resource | ||
type. | ||
|
||
The following fields need to be provided: | ||
|
||
- `appPlanName` - The name of the Azure App Plan | ||
|
||
All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftwebserverfarms). | ||
|
||
Example: | ||
|
||
```yaml | ||
name: azure_app_plan_percentage_memory | ||
description: "Average percentage of memory usage on an Azure App Plan" | ||
resourceType: AppPlan | ||
azureMetricConfiguration: | ||
metricName: MemoryPercentage | ||
aggregation: | ||
type: Average | ||
resources: | ||
- appPlanName: promitor-app-plan | ||
``` | ||
<!-- markdownlint-disable MD033 --> | ||
[← back to metrics declarations](/configuration/v1.x/metrics)<br /> | ||
[← back to introduction](/) | ||
<!-- markdownlint-enable --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
layout: default | ||
title: Azure Function App Declaration | ||
--- | ||
|
||
## Azure Function App - ![Availability Badge](https://img.shields.io/badge/Available%20Starting-v1.2-green.svg) | ||
|
||
You can declare to scrape an Azure Function App via the `FunctionApp` resource | ||
type. | ||
|
||
The following fields need to be provided: | ||
|
||
- `functionAppName` - The name of the Azure Function App | ||
|
||
All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftwebsites-functions). | ||
|
||
The following scraper-specific metric label will be added: | ||
|
||
- `slot_name` - Name of the deployment slot. If none is specified, `production` will be used. | ||
|
||
Example: | ||
|
||
```yaml | ||
name: azure_function_requests | ||
description: "Amount of requests for an Azure Function App" | ||
resourceType: FunctionApp | ||
azureMetricConfiguration: | ||
metricName: Requests | ||
aggregation: | ||
type: Total | ||
resources: | ||
- functionAppName: promitor-function-app | ||
``` | ||
<!-- markdownlint-disable MD033 --> | ||
[← back to metrics declarations](/configuration/v1.x/metrics)<br /> | ||
[← back to introduction](/) | ||
<!-- markdownlint-enable --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
layout: default | ||
title: Azure Web App Declaration | ||
--- | ||
|
||
## Azure Web App - ![Availability Badge](https://img.shields.io/badge/Available%20Starting-v1.2-green.svg) | ||
|
||
You can declare to scrape an Azure Web App via the `WebApp` resource | ||
type. | ||
|
||
The following fields need to be provided: | ||
|
||
- `webAppName` - The name of the Azure Web App | ||
- `slotName` - The name of the deployment slot *(optional)* | ||
|
||
All supported metrics are documented in the official [Azure Monitor documentation](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftwebsites-excluding-functions). | ||
|
||
The following scraper-specific metric label will be added: | ||
|
||
- `slot_name` - Name of the deployment slot. If none is specified, `production` will be used. | ||
|
||
Example: | ||
|
||
```yaml | ||
name: azure_web_app_requests | ||
description: "Amount of requests for an Azure Web App" | ||
resourceType: WebApp | ||
azureMetricConfiguration: | ||
metricName: Requests | ||
aggregation: | ||
type: Total | ||
resources: | ||
- webAppName: promitor-web-app | ||
slot: staging | ||
- webAppName: promitor-web-app | ||
slot: production | ||
``` | ||
<!-- markdownlint-disable MD033 --> | ||
[← back to metrics declarations](/configuration/v1.x/metrics)<br /> | ||
[← back to introduction](/) | ||
<!-- markdownlint-enable --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...itor.Core.Scraping/Configuration/Model/Metrics/ResourceTypes/AppPlanResourceDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes | ||
{ | ||
public class AppPlanResourceDefinition : AzureResourceDefinition | ||
{ | ||
public AppPlanResourceDefinition(string resourceGroupName, string appPlanName) | ||
: base(ResourceType.AppPlan, resourceGroupName) | ||
{ | ||
AppPlanName = appPlanName; | ||
} | ||
|
||
/// <summary> | ||
/// The name of the Azure App Plan to get metrics for. | ||
/// </summary> | ||
public string AppPlanName { get; set; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
....Core.Scraping/Configuration/Model/Metrics/ResourceTypes/FunctionAppResourceDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes | ||
{ | ||
public class FunctionAppResourceDefinition : AzureResourceDefinition | ||
{ | ||
public FunctionAppResourceDefinition(string resourceGroupName, string functionAppName) | ||
: base(ResourceType.FunctionApp, resourceGroupName) | ||
{ | ||
FunctionAppName = functionAppName; | ||
} | ||
|
||
/// <summary> | ||
/// The name of the Azure Function App to get metrics for. | ||
/// </summary> | ||
public string FunctionAppName { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the deployment slot. | ||
/// </summary> | ||
public string SlotName { get; set; } | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...mitor.Core.Scraping/Configuration/Model/Metrics/ResourceTypes/WebAppResourceDefinition.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Promitor.Core.Scraping.Configuration.Model.Metrics.ResourceTypes | ||
{ | ||
public class WebAppResourceDefinition : AzureResourceDefinition | ||
{ | ||
public WebAppResourceDefinition(string resourceGroupName, string webAppName, string slotName) | ||
: base(ResourceType.WebApp, resourceGroupName) | ||
{ | ||
WebAppName = webAppName; | ||
SlotName = slotName; | ||
} | ||
|
||
/// <summary> | ||
/// The name of the Azure Web App. | ||
/// </summary> | ||
public string WebAppName { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the deployment slot. | ||
/// </summary> | ||
public string SlotName { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...tor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/AppPlanResourceV1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes | ||
{ | ||
/// <summary> | ||
/// Contains the configuration required to scrape a app plan. | ||
/// </summary> | ||
public class AppPlanResourceV1 : AzureResourceDefinitionV1 | ||
{ | ||
/// <summary> | ||
/// The name of the Azure App Plan to get metrics for. | ||
/// </summary> | ||
public string AppPlanName { get; set; } | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/FunctionAppResourceV1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes | ||
{ | ||
/// <summary> | ||
/// Contains the configuration required to scrape an Azure Function App. | ||
/// </summary> | ||
public class FunctionAppResourceV1 : AzureResourceDefinitionV1 | ||
{ | ||
/// <summary> | ||
/// The name of the Azure Function App to get metrics for. | ||
/// </summary> | ||
public string FunctionAppName { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the deployment slot. | ||
/// </summary> | ||
public string SlotName { get; set; } | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...itor.Core.Scraping/Configuration/Serialization/v1/Model/ResourceTypes/WebAppResourceV1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes | ||
{ | ||
/// <summary> | ||
/// Contains the configuration required to scrape an Azure Web App. | ||
/// </summary> | ||
public class WebAppResourceV1 : AzureResourceDefinitionV1 | ||
{ | ||
/// <summary> | ||
/// The name of the Azure Web App. | ||
/// </summary> | ||
public string WebAppName { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the deployment slot. | ||
/// </summary> | ||
public string SlotName { get; set; } | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Promitor.Core.Scraping/Configuration/Serialization/v1/Providers/AppPlanDeserializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Promitor.Core.Scraping.Configuration.Serialization.v1.Model; | ||
using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes; | ||
using YamlDotNet.RepresentationModel; | ||
|
||
namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Providers | ||
{ | ||
public class AppPlanDeserializer : ResourceDeserializer | ||
{ | ||
private const string AppPlanNameTag = "appPlanName"; | ||
|
||
public AppPlanDeserializer(ILogger<AppPlanDeserializer> logger) : base(logger) | ||
{ | ||
} | ||
|
||
protected override AzureResourceDefinitionV1 DeserializeResource(YamlMappingNode node) | ||
{ | ||
var appPlanName = node.GetString(AppPlanNameTag); | ||
|
||
return new AppPlanResourceV1 | ||
{ | ||
AppPlanName= appPlanName | ||
}; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...romitor.Core.Scraping/Configuration/Serialization/v1/Providers/FunctionAppDeserializer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Promitor.Core.Scraping.Configuration.Serialization.v1.Model; | ||
using Promitor.Core.Scraping.Configuration.Serialization.v1.Model.ResourceTypes; | ||
using YamlDotNet.RepresentationModel; | ||
|
||
namespace Promitor.Core.Scraping.Configuration.Serialization.v1.Providers | ||
{ | ||
public class FunctionAppDeserializer : ResourceDeserializer | ||
{ | ||
private const string FunctionAppNameTag = "functionAppName"; | ||
private const string SlotNameTag = "slotName"; | ||
|
||
public FunctionAppDeserializer(ILogger<FunctionAppDeserializer> logger) : base(logger) | ||
{ | ||
} | ||
|
||
protected override AzureResourceDefinitionV1 DeserializeResource(YamlMappingNode node) | ||
{ | ||
var functionAppName = node.GetString(FunctionAppNameTag); | ||
var slotName = node.GetString(SlotNameTag); | ||
|
||
return new FunctionAppResourceV1 | ||
{ | ||
FunctionAppName = functionAppName, | ||
SlotName = slotName | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.