Logo Orsak

EffectDiagnostics Module

OpenTelemetry-compatible diagnostics for effect endpoints. MapEffectEndpoints instruments every endpoint with an activity (span) per request, and a histogram of handler durations and a counter of running handlers. They are only recorded when something listens, e.g. OpenTelemetry configured with SourceName and MeterName.

Example

 builder.Services
     .AddOpenTelemetry()
     .WithTracing(fun t -> t.AddSource(EffectDiagnostics.SourceName) |> ignore)
     .WithMetrics(fun m -> m.AddMeter(EffectDiagnostics.MeterName) |> ignore)
 |> ignore
val ignore: value: 'T -> unit

Functions and values

Function or value Description

EffectDiagnostics.MeterName

Full Usage: EffectDiagnostics.MeterName

Returns: string

The name of the Meter of the endpoints' metrics: the histogram orsak.effect.duration, in milliseconds, and, on .NET 7 and later, the counter orsak.effect.active.

Returns: string

EffectDiagnostics.SourceName

Full Usage: EffectDiagnostics.SourceName

Returns: string

The name of the ActivitySource of the endpoints' activities, named effect.execute, with the tags orsak.route, http.request.method and http.response.status_code.

Returns: string

EffectDiagnostics.durations

Full Usage: EffectDiagnostics.durations

Returns: Histogram<int64>
Returns: Histogram<int64>

EffectDiagnostics.eventCounter

Full Usage: EffectDiagnostics.eventCounter

Returns: Counter<int64>
Returns: Counter<int64>

EffectDiagnostics.instrument route verb inner

Full Usage: EffectDiagnostics.instrument route verb inner

Parameters:
    route : string - The route template, recorded as orsak.route
    verb : string - The HTTP method, recorded as http.request.method
    inner : RequestDelegate - The request delegate to instrument

Returns: RequestDelegate

Wraps a request delegate with the endpoint diagnostics. MapEffectEndpoints does this for every endpoint; use it for request delegates mapped some other way.

route : string

The route template, recorded as orsak.route

verb : string

The HTTP method, recorded as http.request.method

inner : RequestDelegate

The request delegate to instrument

Returns: RequestDelegate

EffectDiagnostics.workers

Full Usage: EffectDiagnostics.workers

Returns: UpDownCounter<int64>
Returns: UpDownCounter<int64>

Type something to start searching.