tagless-metrics-core


License

License

Categories

Categories

Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

org.novelfs
ArtifactId

ArtifactId

tagless-metrics-core_2.13
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

tagless-metrics-core
tagless-metrics-core
Project URL

Project URL

https://github.com/TheInnerLight/tagless-metrics
Project Organization

Project Organization

org.novelfs
Source Code Management

Source Code Management

https://github.com/TheInnerLight/tagless-metrics

Download tagless-metrics-core_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/org.novelfs/tagless-metrics-core_2.13/ -->
<dependency>
    <groupId>org.novelfs</groupId>
    <artifactId>tagless-metrics-core_2.13</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.novelfs/tagless-metrics-core_2.13/
implementation 'org.novelfs:tagless-metrics-core_2.13:0.2.1'
// https://jarcasting.com/artifacts/org.novelfs/tagless-metrics-core_2.13/
implementation ("org.novelfs:tagless-metrics-core_2.13:0.2.1")
'org.novelfs:tagless-metrics-core_2.13:jar:0.2.1'
<dependency org="org.novelfs" name="tagless-metrics-core_2.13" rev="0.2.1">
  <artifact name="tagless-metrics-core_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.novelfs', module='tagless-metrics-core_2.13', version='0.2.1')
)
libraryDependencies += "org.novelfs" % "tagless-metrics-core_2.13" % "0.2.1"
[org.novelfs/tagless-metrics-core_2.13 "0.2.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.1

Project Modules

There are no modules declared in this project.

tagless-metrics-core

Maven Central

Defines a core tagless dsl for incrementing/decrementing/etc metrics.

As of version 0.2.0, tagless-metrics supports Kamon 2.x for Scala 2.12 and 2.13.

Kamon 1.x is supported by version 0.1.0 of tagless-metrics and is availale for Scala 2.11 and 2.12 ... see below for further details.

tagless-metrics-kamon

Maven Central

Defines kamon-integration via the dsl.

Include

Add dependencies to built.sbt

libraryDependencies += "org.novelfs" %% "tagless-metrics-core" % "0.2.1"
libraryDependencies += "org.novelfs" %% "tagless-metrics-kamon" % "0.2.1"

Usage

You can import the instances individually if you wish, or simply:

import org.novelfs.taglessmetrics.kamon.implicits._

Import the metrics to be used

import org.novelfs.taglessmetrics.kamon.Counter

Counter usage:

val helloWorldCounter = Counter("hello-world-counter")

def printAndIncrementMetric[F[_] : Sync : IncrementMeric[?[_], Counter]] : F[Unit] =
  for {
    _ <- IncrementMetric[F, Counter].increment(helloWorldCounter.withTag("status", "before"))
    _ <- Sync[F].delay { println("Hello world" }
    _ <- IncrementMetric[F, Counter].increment(helloWorldCounter.withTag("status", "after"))
  } yield ()

Older versions

Kamon 1.x is supported by version 0.1.0 of tagless-metrics and is availale for Scala 2.11 and 2.12. Inclusion and usage are as above, but note that syntax follows the earlier Kamon release with refine used in place of withTag. Consequently the preceding example would be written,

val helloWorldCounter = Counter("hello-world-counter")

def printAndIncrementMetric[F[_] : Sync : IncrementMeric[?[_], Counter]] : F[Unit] =
  for {
    _ <- IncrementMetric[F, Counter].increment(helloWorldCounter.refine("status" -> "before"))
    _ <- Sync[F].delay { println("Hello world" }
    _ <- IncrementMetric[F, Counter].increment(helloWorldCounter.refine("status" -> "after"))
  } yield ()

Versions

Version
0.2.1
0.2.0