Cimfu.Suave.Healthcheck


Cimfu.Suave.Healthcheck

A pluggable healthcheck endpoint for the Suave functional web server. Based on the healthcheck.spec specification, with a modification that allows a message to be recorded on health checks that pass.

The Cimfu.Suave.Healthcheck library can be installed from NuGet:
PM> Install-Package Cimfu.Suave.Healthcheck

Example

This example demonstrates attaching the main server switch healthcheck to a Suave WebPart.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
#r "Suave.dll"
#r "NodaTime.dll"
#r "Cimfu.Suave.Healthcheck.dll"
open Suave.Http
open Cimfu.Suave.Healthcheck

let myApp = RequestErrors.NOT_FOUND "Not here"

let hcMap = Map.ofList ["main", Checks.serverMain]

let app =
  myApp
  |> prefixWithHealthcheck hcMap

Samples & documentation

For additional documentation, see our tutorial and API reference. The source is also well-documented.

  • Tutorial contains a few examples of how you can use the healthcheck features provided by this library.

  • API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.

Versioning

This project is versioned following SemVer v2.0 conventions. The library is currently in a pre-version-1.0 state, which means that minor version increments may contain breaking changes. Once version 1.0 is released, the package will be versioned such that breaking changes are only introduced with a major version increment. Minor version increments indicate new functionality, and patch increments indicate bug fixes or minor internal changes.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.

The library is available under the Apache v2 license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.

Build status

This project is automatically built by Travis CI and AppVeyor. The current status of the master branch:

  • AppVeyor (Windows): Build status

  • Travis CI (Mono on Linux): Build Status

namespace Suave
module Http

from Suave
namespace Cimfu
namespace Cimfu.Suave
module Healthcheck

from Cimfu.Suave
val myApp : Suave.WebPart.WebPart<HttpContext>

Full name: Index.myApp
val hcMap : Map<string,Healthcheck>

Full name: Index.hcMap
Multiple items
module Map

from Microsoft.FSharp.Collections

--------------------
type Map<'Key,'Value (requires comparison)> =
  interface IEnumerable
  interface IComparable
  interface IEnumerable<KeyValuePair<'Key,'Value>>
  interface ICollection<KeyValuePair<'Key,'Value>>
  interface IDictionary<'Key,'Value>
  new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
  member Add : key:'Key * value:'Value -> Map<'Key,'Value>
  member ContainsKey : key:'Key -> bool
  override Equals : obj -> bool
  member Remove : key:'Key -> Map<'Key,'Value>
  ...

Full name: Microsoft.FSharp.Collections.Map<_,_>

--------------------
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
val ofList : elements:('Key * 'T) list -> Map<'Key,'T> (requires comparison)

Full name: Microsoft.FSharp.Collections.Map.ofList
module Checks

from Cimfu.Suave.Healthcheck
val serverMain : Healthcheck

Full name: Cimfu.Suave.Healthcheck.Checks.serverMain
val app : Suave.WebPart.WebPart<HttpContext>

Full name: Index.app
val prefixWithHealthcheck : hcMap:Map<string,Healthcheck> -> app:Suave.WebPart.WebPart<HttpContext> -> Suave.WebPart.WebPart<HttpContext>

Full name: Cimfu.Suave.Healthcheck.prefixWithHealthcheck
F# Project
Fork me on GitHub