This library adds logging and monitoring capabilities to ASP.net websites. It provides:
- A simple healthcheck endpoint.
- A readiness endpoint that dynamically checks application dependencies.
- A metrics endpoint that reports application metrics using the Prometheus wire format.
First, add this library to your project:
> Install-Package Toolhouse.Monitoring
From there you'll need to configure each endpoint you'd like to add:
Metrics and readiness endpoints can optionally be secured via HTTP Basic Authentication. You can use the built-in <basicAuthentication>
and related elements in your Web.config
or add the following to your Web.config
:
<appSettings>
<add key="Toolhouse.Monitoring.Username" value="" />
<add key="Toolhouse.Monitoring.PasswordSha256" value="86a9836cfd1599012ef0e164da78f0676a227c453dd5ef76abd070e0d30e289d" />
</appSettings>
Setting | Description |
---|---|
Toolhouse.Monitoring.Username |
Basic auth username. |
Toolhouse.Monitoring.Password |
SHA-256 hash of basic auth password. Should be a 64-character hex string. |
In ASP.NET MVC applications, it may be necessary to explicitly ignore routes that are to be handled via the IHttpHandler
s provided by this library:
// In Global.asax.cs
// Ignore routes used for metrics + monitoring
RouteTable.Routes.Ignore("health");
RouteTable.Routes.IgnoreRoute("metrics");
RouteTable.Routes.IgnoreRoute("readiness");
To push a new version to Nuget:
- Update the
AssemblyInformationalVersion
attribute inAssemblyInfo.cs
. - Commit your changes.
- Tag your version:
git tag vX.X.X
and push your tags. - Run
package.cmd
to build a new package inDist/
. - Push your package via
nuget push
(seepackage.cmd
output for instructions).
To request a new feature or report a bug open an issue in Github for discussion prior to submitting a pull request. If you're willing to contribute changes/fixes mention that in the issue report or discussion. If you're reporting a bug be as specific as possible about the conditions causing the bug. If possible, attach a small sample project illustrating the issue.
One of the primary objectives of this project is to keep the library as simple and small as possible. If a proposed change is not a common use case or introduces undue complexity it may not be accepted.
Copyright 2017 Toolhouse, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.