Skip to content

Commit

Permalink
fixing whitespace differences for ps script
Browse files Browse the repository at this point in the history
  • Loading branch information
tmasternak committed Sep 14, 2017
1 parent 375407c commit c1d5fe6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
11 changes: 5 additions & 6 deletions src/ScriptBuilder/PowerShellCounterWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,19 @@ public static void WriteScript(string scriptPath, IEnumerable<DurationDefinition
const string Template = @"
#requires -RunAsAdministrator
Function InstallNSBPerfCounters {{
$category = @{{Name=""NServiceBus""; Description=""NServiceBus statistics""}}
$counters = New-Object System.Diagnostics.CounterCreationDataCollection
$counters.AddRange(@(
{0}
))
if ([System.Diagnostics.PerformanceCounterCategory]::Exists($category.Name)) {{
foreach($counter in $counters){{
$exists = [System.Diagnostics.PerformanceCounterCategory]::CounterExists($counter.CounterName, $category.Name)
if (!$exists){{
Write-Host ""One or more counters are missing.The performance counter category will be recreated""
foreach($counter in $counters){{
$exists = [System.Diagnostics.PerformanceCounterCategory]::CounterExists($counter.CounterName, $category.Name)
if (!$exists){{
Write-Host ""One or more counters are missing.The performance counter category will be recreated""
[System.Diagnostics.PerformanceCounterCategory]::Delete($category.Name)
break
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@

#requires -RunAsAdministrator
Function InstallNSBPerfCounters {

$category = @{Name="NServiceBus"; Description="NServiceBus statistics"}
$counters = New-Object System.Diagnostics.CounterCreationDataCollection
$counters.AddRange(@(
New-Object System.Diagnostics.CounterCreationData "SLA violation countdown", "Seconds until the SLA for this endpoint is breached.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "Critical Time Average", "The time it took from sending to processing the message.", AverageTimer32
New-Object System.Diagnostics.CounterCreationData "Critical Time AverageBase", "The time it took from sending to processing the message.", AverageBase
New-Object System.Diagnostics.CounterCreationData "Critical Time", "The time it took from sending to processing the message.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "Processing Time Average", "The time it took to successfully process a message.", AverageTimer32
New-Object System.Diagnostics.CounterCreationData "Processing Time AverageBase", "The time it took to successfully process a message.", AverageBase
New-Object System.Diagnostics.CounterCreationData "Processing Time", "The time it took to successfully process a message.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "# of msgs failures / sec", "The current number of failed processed messages by the transport per second.", RateOfCountsPerSecond32
New-Object System.Diagnostics.CounterCreationData "# of msgs successfully processed / sec", "The current number of messages processed successfully by the transport per second.", RateOfCountsPerSecond32
New-Object System.Diagnostics.CounterCreationData "# of msgs pulled from the input queue /sec", "The current number of messages pulled from the input queue by the transport per second.", RateOfCountsPerSecond32
New-Object System.Diagnostics.CounterCreationData "Retries", "A message has been scheduled for retry (FLR or SLR)", RateOfCountsPerSecond32
New-Object System.Diagnostics.CounterCreationData "SLA violation countdown", "Seconds until the SLA for this endpoint is breached.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "Critical Time Average", "The time it took from sending to processing the message.", AverageTimer32
New-Object System.Diagnostics.CounterCreationData "Critical Time AverageBase", "The time it took from sending to processing the message.", AverageBase
New-Object System.Diagnostics.CounterCreationData "Critical Time", "The time it took from sending to processing the message.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "Processing Time Average", "The time it took to successfully process a message.", AverageTimer32
New-Object System.Diagnostics.CounterCreationData "Processing Time AverageBase", "The time it took to successfully process a message.", AverageBase
New-Object System.Diagnostics.CounterCreationData "Processing Time", "The time it took to successfully process a message.", NumberOfItems32
New-Object System.Diagnostics.CounterCreationData "# of msgs failures / sec", "The current number of failed processed messages by the transport per second.", RateOfCountsPerSecond32
New-Object System.Diagnostics.CounterCreationData "# of msgs successfully processed / sec", "The current number of messages processed successfully by the transport per second.", RateOfCountsPerSecond32
New-Object System.Diagnostics.CounterCreationData "# of msgs pulled from the input queue /sec", "The current number of messages pulled from the input queue by the transport per second.", RateOfCountsPerSecond32
New-Object System.Diagnostics.CounterCreationData "Retries", "A message has been scheduled for retry (FLR or SLR)", RateOfCountsPerSecond32

))

if ([System.Diagnostics.PerformanceCounterCategory]::Exists($category.Name)) {
foreach($counter in $counters){
$exists = [System.Diagnostics.PerformanceCounterCategory]::CounterExists($counter.CounterName, $category.Name)
if (!$exists){
Write-Host "One or more counters are missing. The performance counter category will be recreated"
[System.Diagnostics.PerformanceCounterCategory]::Delete($category.Name)
if ([System.Diagnostics.PerformanceCounterCategory]::Exists($category.Name)) {

foreach($counter in $counters){
$exists = [System.Diagnostics.PerformanceCounterCategory]::CounterExists($counter.CounterName, $category.Name)
if (!$exists){
Write-Host "One or more counters are missing.The performance counter category will be recreated"
[System.Diagnostics.PerformanceCounterCategory]::Delete($category.Name)

break
}
}
break
}
}
}

if (![System.Diagnostics.PerformanceCounterCategory]::Exists($category.Name)) {
if (![System.Diagnostics.PerformanceCounterCategory]::Exists($category.Name)) {
Write-Host "Creating the performance counter category"
[void] [System.Diagnostics.PerformanceCounterCategory]::Create($category.Name, $category.Description, [System.Diagnostics.PerformanceCounterCategoryType]::MultiInstance, $counters)
}
else {
Write-Host "No performance counters have to be created"
}
[void] [System.Diagnostics.PerformanceCounterCategory]::Create($category.Name, $category.Description, [System.Diagnostics.PerformanceCounterCategoryType]::MultiInstance, $counters)
}
else {
Write-Host "No performance counters have to be created"
}

[System.Diagnostics.PerformanceCounter]::CloseSharedResources()
}
InstallNSBPerfCounters
InstallNSBPerfCounters

0 comments on commit c1d5fe6

Please sign in to comment.