CK.Monitoring.Metrics
0.3.3
dotnet add package CK.Monitoring.Metrics --version 0.3.3
NuGet\Install-Package CK.Monitoring.Metrics -Version 0.3.3
<PackageReference Include="CK.Monitoring.Metrics" Version="0.3.3" />
<PackageVersion Include="CK.Monitoring.Metrics" Version="0.3.3" />
<PackageReference Include="CK.Monitoring.Metrics" />
paket add CK.Monitoring.Metrics --version 0.3.3
#r "nuget: CK.Monitoring.Metrics, 0.3.3"
#:package CK.Monitoring.Metrics@0.3.3
#addin nuget:?package=CK.Monitoring.Metrics&version=0.3.3
#tool nuget:?package=CK.Monitoring.Metrics&version=0.3.3
CK.Monitoring.Metrics
Integrates CK.Metrics with CK.Monitoring
by providing a GrandOutputHandler that writes metrics to a high-performance FasterLog.
Important: This package does not work on its own. The
MetricsLogHandlerrequires a FasterLog instance to be injected at runtime. Use CK.AppIdentity.Monitoring.Metrics which providesMetricsFeatureDriverthat manages the FasterLog lifecycle and injects it into the handler automatically.
Overview
This package provides:
- MetricsLogHandler: A sealed
IGrandOutputHandlerthat receives metrics from the GrandOutput pipeline and writes them to FasterLog - MetricsLogDispatcher: A parser for metrics log entries that dispatches to typed callbacks
The handler acts as a producer only - it writes metrics entries to FasterLog but does not consume them. Consumers are implemented separately (see CK.AppIdentity.Monitoring.Metrics).
Configuration
Add the handler to GrandOutput configuration:
{
"CK-Monitoring": {
"GrandOutput": {
"Handlers": {
"MetricsLogHandler, CK.Monitoring.Metrics": {
"CommitRate": 1
}
}
}
}
}
Or simply enable with defaults:
{
"CK-Monitoring": {
"GrandOutput": {
"Handlers": {
"MetricsLogHandler, CK.Monitoring.Metrics": true
}
}
}
}
Configuration Options
| Property | Type | Default | Description |
|---|---|---|---|
CommitRate |
int | 1 | Multiplier of GrandOutput.TimerDuration (default 500ms) between FasterLog commits. A value of 1 commits every 500ms, 2 every 1 second, etc. |
How It Works
- The handler receives log entries tagged with
DotNetMetrics.MetricsTagfrom the GrandOutput pipeline - Each entry is written to FasterLog with a timestamp prefix (8 bytes DateTime binary + ASCII text)
- FasterLog provides durability and supports multiple named consumers via persisted iterators
FasterLog Injection
The handler does not create or own the FasterLog instance. Instead, the FasterLog must be injected at runtime
by calling MetricsLogHandler.SetFasterLog(FasterLog). Without this injection, the handler silently ignores all metrics entries.
Recommended approach: Use CK.AppIdentity.Monitoring.Metrics
which provides MetricsFeatureDriver. This feature driver:
- Creates and manages the FasterLog instance
- Automatically injects it into the handler via
SetMetricsFasterLogAction(aGrandOutputHandlersAction) - Handles consumer registration and log truncation
- Cleans up orphaned consumers on shutdown
This design allows:
- The handler to be configured via standard GrandOutput configuration
- The FasterLog lifecycle to be managed externally (by AppIdentity or custom code)
- Multiple consumers to share the same FasterLog instance
Entry Format
Each FasterLog entry contains:
- 8 bytes: DateTime as binary (via
DateTime.ToBinary()) - Remaining bytes: ASCII-encoded metrics text
The text format follows the CK.Metrics log format for meters, instruments, and measurements.
Related Packages
- CK.Metrics - Core metrics collection
- CK.AppIdentity.Monitoring.Metrics - AppIdentity integration with consumer support
- CK.AppIdentity.Monitoring.Metrics.Csv - CSV export consumer
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- CK.Metrics (>= 0.3.3)
- CK.Monitoring (>= 25.1.0)
- Microsoft.FASTER.Core (>= 2.6.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CK.Monitoring.Metrics:
| Package | Downloads |
|---|---|
|
CK.AppIdentity.Monitoring.Metrics
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.