Skip to content

viacheslave/prometh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometh

This is a .NET library that parses Prometheus metrics output.

The library targets:

  • .NET Standard 2.0
  • .NET 5

Usage

Text payload:

# HELP kafka_consumer_lag Provides kafka consumer lag
# TYPE kafka_consumer_lag gauge
kafka_consumer_lag{groupId="gr0",topic="mytopic",partition="18"} 4

Parse metrics:

var payload = "...";
var metrics = Prometh.Metrics.Parse(payload);

Get particular metric value:

var payload = "...";

var name = "kafka_consumer_lag";
var labels = new Dictionary<string, string>
{
  ["groupId"] = "gr0",
  ["topic"] = "mytopic",
  ["partition"] = "18",
};

var value = Prometh.Metrics.Parse(payload, name, labels);
// value is 4

NuGet

The library is available as a NuGet package.

About

A .NET parser for Prometheus metrics output.

Topics

Resources

License

Stars

Watchers

Forks

Languages