This file contains hidden or 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
| public class ValidationProblemDetails : ProblemDetails | |
| { | |
| public ValidationProblemDetails() : base() | |
| { | |
| } | |
| public ValidationProblemDetails( | |
| ModelStateDictionary modelStateDictionary) | |
| : base() | |
| { |
This file contains hidden or 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
| public class ProblemDetails | |
| { | |
| public ProblemDetails() | |
| { | |
| } | |
| [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "type")] | |
| public string Type { get; set; } | |
| [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "title")] |
This file contains hidden or 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
| #tool "nuget:?package=OctopusTools" | |
| #addin nuget:?package=Cake.SemVer | |
| #addin nuget:?package=semver&version=2.0.4 | |
| using System; | |
| using System.Net.Http; | |
| using Newtonsoft.Json; | |
| using System.IO; | |
| var target = Argument("target", "Build"); |
This file contains hidden or 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
| public void Configure( | |
| IApplicationBuilder app, | |
| IHostingEnvironment env) | |
| { | |
| app.UseHealthChecks("/health/status"); | |
| // rest of the pipeline | |
| } |
This file contains hidden or 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
| { | |
| "requests": [ | |
| { | |
| "q": "avg:myapp.app.ishealthy{$environment}", | |
| "type": "bars", | |
| "style": { | |
| "palette": "dog_classic", | |
| "type": "solid", | |
| "width": "normal" | |
| }, |
This file contains hidden or 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
| { "series" : | |
| [ | |
| { | |
| "metric":"myapp.app.ishealthy", | |
| "points":[[1545526632, 1]], | |
| "type":"count", | |
| "tags":"Environment:Production" | |
| } | |
| ] | |
| } |
This file contains hidden or 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
| namespace Microsoft.Extensions.Diagnostics.HealthChecks | |
| { | |
| public enum HealthStatus | |
| { | |
| Unhealthy = 0, | |
| Degraded = 1, | |
| Healthy = 2 | |
| } |
This file contains hidden or 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
| { | |
| "Entries": | |
| { | |
| "SQL Server": | |
| { | |
| "Data":{}, | |
| "Description":null, | |
| "Duration":"00:00:00.0208580", | |
| "Exception":null, | |
| "Status":2 |
This file contains hidden or 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
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddDbContext<PeriodContext>(options => | |
| options.UseSqlServer( | |
| Configuration.GetConnectionString("DbConnectionString"), | |
| builderOptions => | |
| builderOptions.EnableRetryOnFailure(3)), | |
| ServiceLifetime.Scoped); | |
| services.AddHealthChecks() |
This file contains hidden or 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
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.Extensions.Diagnostics.HealthChecks; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| public class DatabaseHealthCheck : IHealthCheck | |
| { | |
| private readonly DbContext dbContext; | |
| public DatabaseHealthCheck(DbContext context) |