Skip to content

yoyama/FluencyMeterRegistry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fluency-meter-registry

Actions

A Micrometer plugin for Fluency. Send metrics of Micrometer to fluentd.

How to use (Scala)

build.sbt

ThisBuild / scalaVersion     := "2.12.8"

lazy val root = (project in file("."))
  .settings(
    libraryDependencies ++= Seq(
      "io.github.yoyama" % "fluency-meter-registory_2.12" % VERSION)

example.scala

object Example {
    def main(args: Array[String]): Unit ={
        val fluency:Fluency = new FluencyBuilderForFluentd().build()
        val fconfig = new FluencyRegistryConfig {
            override def prefix(): String = "default"
            override def tag(): String = "example"
            override def step(): Duration = Duration.ofSeconds(10)
        }
        val m = FluencyMeterRegistry(fconfig, HierarchicalNameMapper.DEFAULT, Clock.SYSTEM, fluency)
        m.counter("count1").increment()
        m.summary("summary1").record(999.9)
    }
}

How to use (Java)

pom.xml

  <dependencies>
    <dependency>
      <groupId>io.github.yoyama</groupId>
      <artifactId>fluency-meter-registory_2.12</artifactId>
      <version>VERSION</version>
    </dependency>
  </dependencies>

JavaExample1

        Fluency fluency = new FluencyBuilderForFluentd().build();
        FluencyRegistryConfig fconfig = FluencyRegistryConfig.apply("example.java", "test", Duration.ofSeconds(10));
        FluencyMeterRegistry meter = FluencyMeterRegistry.apply(fconfig, HierarchicalNameMapper.DEFAULT, Clock.SYSTEM, fluency);
        meter.counter("count1").increment();
        meter.summary("summary1").record(999.9);
        Thread.sleep(30000);

About

Micrometer plugin for fluency

Resources

License

Stars

Watchers

Forks

Packages

No packages published