Skip to content

Conversation

natemcmaster
Copy link

As a part of dotnet/aspnetcore#3598, this merges the source code and history for two HealthChecks projects into this repo.

Nate McMaster and others added 30 commits September 26, 2016 13:37
- aspnet/Testing#248
- xUnit no longer supports .NET 4.5.1
- build tests for desktop .NET only on Windows

Address existing issues
- work around test failures, including #350
  - skip tests mentioned in #350
  - reorder xunit and xunit.runner.visualstudio; setup fails for .NET Core otherwise
- skip all tests using LocalDB on Linux and OSX
  - `[FrameworkSkipCondition(RuntimeFrameworks.Mono)]` now redundant
- correct AppVeyor image

nits:
- let VS add the test `<Service>`
- use `[ConditionalFact]` when there's no test data
aspnetci and others added 24 commits September 2, 2018 12:09
[auto-updated: dependencies]
[auto-updated: dependencies]
[auto-updated: dependencies]
* Use options for registering health checks

This change pivots to use options for registering health checks. We get
a few pretty nice things out of this, and it unblocks some of our
requirements.

Now all registration methods support the application developer
configuring the name, failure-status, and tags for each health check.
This is a requirment, that we weren't really satisfying - which is what
led to this redesign. In support of this health checks now return pass/fail,
and the service is responsible for assigning the status.

----

Health check authors that need configuration data (connection string as
an example) now have three ways to do this depending on their
requirements.
1. Create an instance and register that (easiest)
2. Use Type Activation and pass parameters (middle)
3. Use named options (richest)

We expect most health checks to need/want some kind of configuration -
which 1) works pretty well to solve. However many other health checks
will need DI + configuration. It was also a gap that we didn't have a
good way to use named options, when it's such a good fit for our
scenarios.

Added new registration methods for type activation that allow you to
pass parameters for 2).

Added a context type that allows the running health check access to its
registration for 3).

----

Redesigned and renamed how status gets reported. Health checks return
pass/fail result, but the overall HealthReport includes entries of a
different type. This seems fine because there isn't really a way to
consume a HealthCheckResult directly - the service is the only consumer.

----

Added support for tags. This was easy to add now that we have a separate
registration type, and it's quite handy for building filters (see
sample).

* HARDER BETTER STRONGER FASTER
[auto-updated: dependencies]
- Add logging of description/data
- Add logging for aggregate begin/end
* Added execution time duration into HealthReportEntry and TotalDuration on HealthReport

* review PR feedback from @rynowak.

* added the same duration into HealthReportEntry and log when the health check throw
[auto-updated: dependencies]
IHealthCheckPublisher allows you to configure and run health checks
regularly inside an application, and push the notifications elsewhere.

All publishers are part of a single queue with a configurable period and
timeout.
Fixes aspnet/Diagnostics#511 and aspnet/Diagnostics#514

It's really confusing to people that we use Map. Users expect that the
URL they provide for the health check middleware will only process
exact matches. The way it behaves when using map is not optimal for some
of the common patterns.
- Renamed the property for configuration response caching headers
- Renamed the options class to avoid conflicts with other type names

Fixes aspnet/Diagnostics#509
* Redesign HealthStatus (again)

This change brings back the ability to return Healthy/Degraded/Unhealthy
in a HealthCheckResult. We tried making this pass/fail in 2.2.0-preview3
and folks writing health checks for their own use pointed out (rightly
so) that it was too limited.

It's still possible for the app developer to configure the failure
status of a health check, but it requires the health check author to
cooperate.

I also got rid of HealthStatus.Failed since it raises more questions
than it answers. It's really not clear that it's valuable for a health
check for behave different when throwing an unhandled exception.

We would still recommend that a health check library handle exceptions
that they know about and return `context.Registration.FailureStatus`.
Copy link

@ryanbrandenburg ryanbrandenburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@natemcmaster natemcmaster merged commit 47a4cce into release/2.2 Nov 21, 2018
@natemcmaster natemcmaster deleted the namc/diagnostics branch November 21, 2018 19:19
@natemcmaster natemcmaster mentioned this pull request Nov 21, 2018
@ghost ghost locked as resolved and limited conversation to collaborators May 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.