Skip to content

permutive-engineering/prometheus4cats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

691 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functional Prometheus Metrics API for Scala

This library is designed to provide a tasteful Scala API for exposing Prometheus metrics using Cats-Effect. It is a mix between Permutive's internal library and Epimetheus. See the design page for more information.

Features

Quickstart Usage

This library is currently available for Scala binary versions 2.12 and 2.13 and 3.2.

For detailed code examples see the metrics DSL documentation.

To use the latest version, include the following in your build.sbt:

libraryDependencies ++= Seq(
  "com.permutive" %% "prometheus4cats" % "6.0.0-RC3",
  "com.permutive" %% "prometheus4cats-java" % "6.0.0-RC3"
)
import cats.effect.IO

import prometheus4cats.MetricFactory
import prometheus4cats.javaclient.JavaMetricRegistry

val counterResource =
  for {
    registry <- JavaMetricRegistry.Builder[IO]().build
    factory = MetricFactory.builder.build(registry)
    counter <- factory.counter("my_counter_total")
                 .help("My Counter")
                 .label[String]("some_label")
                 .build
  } yield counter

counterResource.use { counter => counter.inc(1.0, "Some label value") }

If you want to know more about all the library's features, please head on to its website where you will find much more information.

Contributors for this project

janstenpickle alejandrohdezma TimWSpence kidonm hgdyeo gruffyn Oliver-Taylor
janstenpickle alejandrohdezma TimWSpence kidonm hgdyeo gruffyn Oliver-Taylor
sideeffffect bastewart desbo
sideeffffect bastewart desbo

About

Functional Prometheus Metrics API for Scala

Topics

Resources

License

Code of conduct

Contributing

Stars

19 stars

Watchers

7 watching

Forks

Contributors