metrics-thread


License

License

MIT
Categories

Categories

Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

com.github.gchudnov
ArtifactId

ArtifactId

metrics-thread_2.13
Last Version

Last Version

0.9.1
Release Date

Release Date

Type

Type

jar
Description

Description

metrics-thread
metrics-thread
Project URL

Project URL

https://github.com/gchudnov/metrics-thread
Project Organization

Project Organization

com.github.gchudnov
Source Code Management

Source Code Management

https://github.com/gchudnov/metrics-thread

Download metrics-thread_2.13

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.1
io.dropwizard.metrics : metrics-core jar 4.1.1

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.13 jar 3.0.8

Project Modules

There are no modules declared in this project.

metrics-thread

Capture thread states in metrics.


Usage

Add the following dependency to your build.sbt:

libraryDependencies += "com.github.gchudnov" %% "metrics-thread" % "0.9.1"

Optionally, add github credentials and package repository resolver to build.sbt:

credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
resolvers += Resolver.url("GitHub Package Registry", url("https://maven.pkg.github.com/gchudnov/metrics-thread"))

// cat ~/.sbt/.credentials
// realm=GitHub Package Registry
// host=maven.pkg.github.com
// user=USER
// password=TOKEN

To start capturing thread states, create an implicit instance of MetricRegistry and invoke ThreadScanner.start:

import com.codahale.metrics.MetricRegistry
import scala.concurrent.duration._

implicit val metricRegistry: MetricRegistry = new MetricRegistry()

ThreadScanner.start(1.second)

API

ThreadScanner.start(pollDuration: FiniteDuration, pattern: String = ".*")

where:

  • pollDuration - time inverval to poll for thread state change
  • pattern - reegular expression pattern used to match with thread names (by default all threads).

Contact

Grigorii Chudnov

License

Distributed under the The MIT License (MIT).

Versions

Version
0.9.1
0.9.0