This repository has been archived by the owner on Mar 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from AppMetrics/dev
1.1.0 Release
- Loading branch information
Showing
6 changed files
with
168 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[*] | ||
end_of_line = crlf | ||
|
||
[*.xml] | ||
indent_style = space | ||
|
||
[*.cs] | ||
dotnet_sort_system_directives_first = true |
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
43 changes: 43 additions & 0 deletions
43
src/App.Metrics.Health.Checks.AzureServiceBus/ServiceBusHealthChecks.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,43 @@ | ||
// <copyright file="ServiceBusHealthChecks.cs" company="App Metrics Contributors"> | ||
// Copyright (c) App Metrics Contributors. All rights reserved. | ||
// </copyright> | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using App.Metrics.Health.Logging; | ||
using Microsoft.Azure.ServiceBus.Management; | ||
|
||
namespace App.Metrics.Health.Checks.AzureServiceBus | ||
{ | ||
internal static class ServiceBusHealthChecks | ||
{ | ||
internal static Func<ValueTask<HealthCheckResult>> CheckDeadLetterQueueCount(ILog logger, string entityPath, string name, Func<Task<MessageCountDetails>> getMessageCount, long deadLetterWarningThreshold, long? deadLetterErrorThreshold) | ||
{ | ||
return async () => | ||
{ | ||
var deadLetteredMessages = 0L; | ||
try | ||
{ | ||
deadLetteredMessages = (await getMessageCount()).DeadLetterMessageCount; | ||
} | ||
catch (Exception ex) | ||
{ | ||
logger.ErrorException($"{name} failed.", ex); | ||
|
||
return HealthCheckResult.Unhealthy(ex); | ||
} | ||
|
||
if (deadLetterErrorThreshold.HasValue && deadLetteredMessages >= deadLetterErrorThreshold) | ||
{ | ||
return HealthCheckResult.Unhealthy($"Unhealthy. '{entityPath}' has {deadLetteredMessages} dead letter messages."); | ||
} | ||
else if (deadLetteredMessages >= deadLetterWarningThreshold) | ||
{ | ||
return HealthCheckResult.Degraded($"Degraded. '{entityPath}' has {deadLetteredMessages} dead letter messages."); | ||
} | ||
|
||
return HealthCheckResult.Healthy($"OK. {entityPath} has {deadLetteredMessages} dead letter messages."); | ||
}; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<!-- This file may be overwritten by automation. --> | ||
<Project> | ||
<PropertyGroup> | ||
<VersionPrefix>1.0.0</VersionPrefix> | ||
<VersionPrefix>1.1.0</VersionPrefix> | ||
<VersionSuffix></VersionSuffix> | ||
</PropertyGroup> | ||
</Project> |