Skip to content

Commit 6d4cc55

Browse files
authored
Merge pull request #9065 from panchagnula/sisirap-metricsDeprecated
webapp: Marking Get-AzWebAppMetrics, Get-AzWebAppSlotMetrics and Get-AzAppServicPlanMetrics as deprecated
2 parents d455130 + 4e8ecc3 commit 6d4cc55

File tree

13 files changed

+10
-224
lines changed

13 files changed

+10
-224
lines changed

src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ public void TestRemoveAppServicePlan()
6666
WebsitesController.NewInstance.RunPsTest(_logger, "Test-RemoveAppServicePlan");
6767
}
6868

69-
[Fact(Skip = "Needs investigation. Fails running playback")]
70-
[Trait(Category.AcceptanceType, Category.CheckIn)]
71-
public void TestGetAppServicePlanMetrics()
72-
{
73-
WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetAppServicePlanMetrics");
74-
}
75-
7669
[Fact(Skip = "TODO #5594: This test requires a pre-set AppService Environment with specific settings.")]
7770
[Trait(Category.AcceptanceType, Category.CheckIn)]
7871
public void TestCreateNewAppServicePlanInAse()

src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.ps1

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -319,59 +319,6 @@ function Test-RemoveAppServicePlan
319319
}
320320
}
321321

322-
<#
323-
.SYNOPSIS
324-
Tests retrieving app service plan metrics
325-
#>
326-
function Test-GetAppServicePlanMetrics
327-
{
328-
# Setup
329-
$rgname = Get-ResourceGroupName
330-
$location = Get-Location
331-
$appServicePlanName = Get-WebHostPlanName
332-
$tier = "Standard"
333-
$apiversion = "2015-08-01"
334-
$resourceType = "Microsoft.Web/sites"
335-
336-
try
337-
{
338-
#Setup
339-
New-AzResourceGroup -Name $rgname -Location $location
340-
$serverFarm = New-AzAppServicePlan -ResourceGroupName $rgname -Name $appServicePlanName -Location $location -Tier $tier
341-
342-
$endTime = Get-Date
343-
$startTime = $endTime.AddHours(-3)
344-
345-
$metricnames = @('CPU', 'Requests')
346-
347-
# Get app service plan metrics
348-
$metrics = Get-AzAppServicePlanMetrics -ResourceGroupName $rgname -Name $appServicePlanName -Metrics $metricnames -StartTime $startTime -EndTime $endTime -Granularity PT1M
349-
350-
$actualMetricNames = $metrics | Select -Expand Name | Select -Expand Value
351-
352-
foreach ($i in $metricsnames)
353-
{
354-
Assert-True { $actualMetricsNames -contains $i}
355-
}
356-
357-
# Get app service plan metrics via pipeline obj
358-
$metrics = $serverFarm | Get-AzAppServicePlanMetrics -Metrics $metricnames -StartTime $startTime -EndTime $endTime -Granularity PT1M
359-
360-
$actualMetricNames = $metrics | Select -Expand Name | Select -Expand Value
361-
362-
foreach ($i in $metricsnames)
363-
{
364-
Assert-True { $actualMetricsNames -contains $i}
365-
}
366-
}
367-
finally
368-
{
369-
# Cleanup
370-
Remove-AzAppServicePlan -ResourceGroupName $rgname -Name $appServicePlanName -Force
371-
Remove-AzResourceGroup -Name $rgname -Force
372-
}
373-
}
374-
375322
<#
376323
.SYNOPSIS
377324
Tests creating a new Web Hosting Plan.

src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ public void TestGetWebAppSlot()
5252
WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppSlot");
5353
}
5454

55-
[Fact(Skip = "Needs investigation. Fails running playback")]
56-
[Trait(Category.AcceptanceType, Category.CheckIn)]
57-
public void TestGetWebAppSlotMetrics()
58-
{
59-
WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppSlotMetrics");
60-
}
61-
6255
[Fact]
6356
[Trait(Category.AcceptanceType, Category.CheckIn)]
6457
public void TestWebAppSlotPublishingProfile()

src/Websites/Websites.Test/ScenarioTests/WebAppSlotTests.ps1

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -91,83 +91,6 @@ function Test-GetWebAppSlot
9191
}
9292
}
9393

94-
<#
95-
.SYNOPSIS
96-
Tests retrieving website metrics
97-
#>
98-
function Test-GetWebAppSlotMetrics
99-
{
100-
# Setup
101-
$rgname = Get-ResourceGroupName
102-
$appname = Get-WebsiteName
103-
$slotname = "staging"
104-
$location = Get-Location
105-
$planName = Get-WebHostPlanName
106-
$tier = "Standard"
107-
$apiversion = "2015-08-01"
108-
$resourceType = "Microsoft.Web/sites"
109-
110-
try
111-
{
112-
#Setup
113-
New-AzResourceGroup -Name $rgname -Location $location
114-
$serverFarm = New-AzAppServicePlan -ResourceGroupName $rgname -Name $planName -Location $location -Tier $tier
115-
116-
# Create new web app
117-
$webapp = New-AzWebApp -ResourceGroupName $rgname -Name $appname -Location $location -AppServicePlan $planName
118-
119-
# Assert
120-
Assert-AreEqual $appname $webapp.Name
121-
Assert-AreEqual $serverFarm.Id $webapp.ServerFarmId
122-
123-
# Create new deployment slot
124-
$slot = New-AzWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $slotname -AppServicePlan $planName
125-
$appWithSlotName = "$appname/$slotname"
126-
127-
# Assert
128-
Assert-AreEqual $appWithSlotName $slot.Name
129-
Assert-AreEqual $serverFarm.Id $slot.ServerFarmId
130-
131-
for($i = 0; $i -lt 10; $i++)
132-
{
133-
PingWebApp $slot
134-
}
135-
136-
$endTime = Get-Date
137-
$startTime = $endTime.AddHours(-3)
138-
139-
$metricnames = @('CPU', 'Requests')
140-
141-
# Get web app metrics
142-
$metrics = Get-AzWebAppSlotMetrics -ResourceGroupName $rgname -Name $appname -Slot $slotname -Metrics $metricnames -StartTime $startTime -EndTime $endTime -Granularity PT1M
143-
144-
$actualMetricNames = $metrics | Select -Expand Name | Select -Expand Value
145-
146-
foreach ($i in $metricnames)
147-
{
148-
Assert-True { $actualMetricNames -contains $i}
149-
}
150-
151-
# Get web app metrics via pipeline obj
152-
$metrics = $slot | Get-AzWebAppSlotMetrics -Metrics $metricnames -StartTime $startTime -EndTime $endTime -Granularity PT1M
153-
154-
$actualMetricNames = $metrics | Select -Expand Name | Select -Expand Value
155-
156-
foreach ($i in $metricnames)
157-
{
158-
Assert-True { $actualMetricNames -contains $i}
159-
}
160-
}
161-
finally
162-
{
163-
# Cleanup
164-
Remove-AzWebAppSlot -ResourceGroupName $rgname -Name $appname -Slot $slotname -Force
165-
Remove-AzWebApp -ResourceGroupName $rgname -Name $appname -Force
166-
Remove-AzAppServicePlan -ResourceGroupName $rgname -Name $planName -Force
167-
Remove-AzResourceGroup -Name $rgname -Force
168-
}
169-
}
170-
17194
<#
17295
.SYNOPSIS
17396
Start stop restart web app

src/Websites/Websites.Test/ScenarioTests/WebAppTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,6 @@ public void TestGetWebApp()
8080
WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebApp");
8181
}
8282

83-
[Fact(Skip = "Needs investigation. Fails running playback")]
84-
[Trait(Category.AcceptanceType, Category.CheckIn)]
85-
public void TestGetWebAppMetrics()
86-
{
87-
WebsitesController.NewInstance.RunPsTest(_logger, "Test-GetWebAppMetrics");
88-
}
89-
9083
[Fact]
9184
[Trait(Category.AcceptanceType, Category.CheckIn)]
9285
public void TestWebAppPublishingProfile()

src/Websites/Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -92,73 +92,6 @@ function Test-GetWebApp
9292
}
9393
}
9494

95-
<#
96-
.SYNOPSIS
97-
Tests retrieving website metrics
98-
#>
99-
function Test-GetWebAppMetrics
100-
{
101-
# Setup
102-
$rgname = Get-ResourceGroupName
103-
$wname = Get-WebsiteName
104-
$location = Get-WebLocation
105-
$whpName = Get-WebHostPlanName
106-
$tier = "Shared"
107-
$apiversion = "2015-08-01"
108-
$resourceType = "Microsoft.Web/sites"
109-
110-
try
111-
{
112-
#Setup
113-
New-AzResourceGroup -Name $rgname -Location $location
114-
$serverFarm = New-AzAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $tier
115-
116-
# Create new web app
117-
$webapp = New-AzWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName
118-
119-
# Assert
120-
Assert-AreEqual $wname $webapp.Name
121-
Assert-AreEqual $serverFarm.Id $webapp.ServerFarmId
122-
123-
for($i = 0; $i -lt 10; $i++)
124-
{
125-
PingWebApp $webapp
126-
}
127-
128-
$endTime = Get-Date
129-
$startTime = $endTime.AddHours(-3)
130-
131-
$metricnames = @('CPU', 'Requests')
132-
133-
# Get web app metrics
134-
$metrics = Get-AzWebAppMetrics -ResourceGroupName $rgname -Name $wname -Metrics $metricnames -StartTime $startTime -EndTime $endTime -Granularity PT1M
135-
136-
$actualMetricNames = $metrics | Select -Expand Name | Select -Expand Value
137-
138-
foreach ($i in $metricnames)
139-
{
140-
Assert-True { $actualMetricNames -contains $i}
141-
}
142-
143-
# Get web app metrics via pipeline obj
144-
$metrics = $webapp | Get-AzWebAppMetrics -Metrics $metricnames -StartTime $startTime -EndTime $endTime -Granularity PT1M
145-
146-
$actualMetricNames = $metrics | Select -Expand Name | Select -Expand Value
147-
148-
foreach ($i in $metricnames)
149-
{
150-
Assert-True { $actualMetricNames -contains $i}
151-
}
152-
}
153-
finally
154-
{
155-
# Cleanup
156-
Remove-AzWebApp -ResourceGroupName $rgname -Name $wname -Force
157-
Remove-AzAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
158-
Remove-AzResourceGroup -Name $rgname -Force
159-
}
160-
}
161-
16295
<#
16396
.SYNOPSIS
16497
Start stop restart web app

src/Websites/Websites/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Get-AzWebApp*Metrics and Get-AzAppServicePlanMetrics marked deprecated
2122

2223
## Version 1.2.0
2324
* fixes the Set-AzWebApp and Set-AzWebAppSlot to not remove the tags on execution

src/Websites/Websites/Cmdlets/AppServicePlans/GetAzureAppServicePlanMetrics.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
2323
/// <summary>
2424
/// this commandlet will let you get Azure servce plan metrics
2525
/// </summary>
26+
[CmdletDeprecation(ReplacementCmdletName = "Get-AzMetric")]
2627
[GenericBreakingChange("Get-AzAppServicePlanMetrics alias will be removed in an upcoming breaking change release", "2.0.0")]
2728
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "AppServicePlanMetric")]
2829
[OutputType(typeof(ResourceMetric))]

src/Websites/Websites/Cmdlets/DeploymentSlots/GetAzureWebAppSlotMetrics.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace Microsoft.Azure.Commands.WebApps.Cmdlets.DeploymentSlots
2323
/// <summary>
2424
/// this commandlet will let you get Azure Web App slot metrics
2525
/// </summary>
26+
[CmdletDeprecation(ReplacementCmdletName = "Get-AzMetric")]
2627
[GenericBreakingChange("Get-AzWebAppSlotMetrics alias will be removed in an upcoming breaking change release", "2.0.0")]
2728
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppSlotMetric")]
2829
[Alias("Get-AzWebAppSlotMetrics")]

src/Websites/Websites/Cmdlets/WebApps/GetAzureWebAppMetrics.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
2323
/// <summary>
2424
/// this commandlet will let you get Azure Web App metrics
2525
/// </summary>
26+
[CmdletDeprecation(ReplacementCmdletName = "Get-AzMetric")]
2627
[GenericBreakingChange("Get-AzWebAppMetrics alias will be removed in an upcoming breaking change release", "2.0.0")]
2728
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "WebAppMetric")]
2829
[OutputType(typeof(ResourceMetric))]

src/Websites/Websites/help/Get-AzAppServicePlanMetric.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.Websites.dll-Help.xml
33
Module Name: Az.Websites
44
ms.assetid: 0AC0C4F9-4138-49EA-88CB-DC220DE7E9F4
@@ -178,7 +178,7 @@ Accept wildcard characters: False
178178
```
179179
180180
### CommonParameters
181-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
181+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
182182
183183
## INPUTS
184184

src/Websites/Websites/help/Get-AzWebAppMetric.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.Websites.dll-Help.xml
33
Module Name: Az.Websites
44
ms.assetid: 513BE097-EB4A-4C49-9F7F-42A2BED09022
@@ -179,7 +179,7 @@ Accept wildcard characters: False
179179
```
180180
181181
### CommonParameters
182-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
182+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
183183
184184
## INPUTS
185185

src/Websites/Websites/help/Get-AzWebAppSlotMetric.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.Websites.dll-Help.xml
33
Module Name: Az.Websites
44
ms.assetid: 3BCEADF3-15DC-4033-A94A-4C8B4F5E7340
@@ -193,7 +193,7 @@ Accept wildcard characters: False
193193
```
194194
195195
### CommonParameters
196-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
196+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
197197
198198
## INPUTS
199199

0 commit comments

Comments
 (0)