Faactory.Channels.Prometheus
0.8.0
This package is no longer supported or needed in Channels v2.x and has been marked as deprecated.
See the version list below for details.
dotnet add package Faactory.Channels.Prometheus --version 0.8.0
NuGet\Install-Package Faactory.Channels.Prometheus -Version 0.8.0
<PackageReference Include="Faactory.Channels.Prometheus" Version="0.8.0" />
<PackageVersion Include="Faactory.Channels.Prometheus" Version="0.8.0" />
<PackageReference Include="Faactory.Channels.Prometheus" />
paket add Faactory.Channels.Prometheus --version 0.8.0
#r "nuget: Faactory.Channels.Prometheus, 0.8.0"
#:package Faactory.Channels.Prometheus@0.8.0
#addin nuget:?package=Faactory.Channels.Prometheus&version=0.8.0
#tool nuget:?package=Faactory.Channels.Prometheus&version=0.8.0
Prometheus Metrics
Extends Channels by providing Prometheus metrics.
The exported metrics are:
channels_active_total: Total number of active channels.channels_bytes_received_total: Total number of bytes received.channels_bytes_sent_total: Total number of bytes sent.
The project makes use of prometheus-net.
Usage
Install the package from NuGet
dotnet add package Faactory.Channels.Prometheus
To calculate the metrics, you just need to register the metrics middleware. This can be applied to either a service or a client channel builder.
IChannelBuilder channel = ...;
channel.UsePrometheusMetrics();
To export the metrics, the easiest way is to install prometheus-net.AspNetCore package and register the pre-built middleware. If no other HTTP functionality is required, this is a good option.
IServiceCollection services = ...;
services.AddMetricServer( options =>
{
options.Port = 8081;
} );
You can find a more detailed sample project under the example folder. There are other ways to export the metrics, which can be found in the prometheus-net documentation.
Labels
By default, metrics are created just with the channelId label, which contains the channel identifier. However, it is possible to extend this and add more labels to the metrics.
To add more labels, you can add items to the channel's data dictionary. The middleware will automatically add all items with the prefix prometheus.label. to the metrics.
public class SampleIdentityHandler : ChannelHandler<IdentityInformation>
{
public override Task ExecuteAsync( IChannelContext context, IdentityInformation data )
{
// ...
/*
This adds an `uuid` label to the metrics. The label will be included in all metrics.
*/
context.Channel.Data["prometheus.label.uuid"] = data.UUId;
return Task.CompletedTask;
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Faactory.Channels.Core (>= 0.8.0)
- prometheus-net (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.0.1 | 422 | 6/10/2025 | |
| 1.0.0 | 285 | 7/2/2024 | |
| 1.0.0-preview-1 | 173 | 6/26/2024 | |
| 0.10.0 | 242 | 4/9/2024 | |
| 0.9.0 | 255 | 1/30/2024 | |
| 0.8.3 | 314 | 11/8/2023 | |
| 0.8.0 | 232 | 10/20/2023 | |
| 0.7.1 | 279 | 6/14/2023 | |
| 0.7.0-preview-1 | 235 | 6/14/2023 |