https://github.com/lightstep/lightstep-metrics-java
https://github.com/lightstep/lightstep-metrics-java
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lightstep/lightstep-metrics-java
- Owner: lightstep
- License: mit
- Archived: true
- Created: 2020-04-14T23:49:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-07T22:40:22.000Z (over 4 years ago)
- Last Synced: 2023-07-26T22:22:17.018Z (almost 3 years ago)
- Language: Java
- Size: 99.6 KB
- Stars: 0
- Watchers: 54
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lightstep Java Metrics Reporter
[ ](http://search.maven.org/#search%7Cga%7C1%7Ccom.lightstep.tracer%20java-metrics-reporter) [](https://circleci.com/gh/lightstep/lightstep-metrics-java)
This library automatically reports a set of predefined host metrics
(such as CPU and memory usage) to the Lightstep backend.
Java 8 or newer is required. When running Java 7, no metrics reporting
will be performed.
Note: Using this artifact requires tracing being done in the same process
and sharing the same service name/version and access token. If not done,
the reported metrics will be ignored at the backend.
### Maven
```xml
com.lightstep.tracer
java-metrics-reporter
VERSION
```
### Usage
```java
import com.lightstep.tracer.metrics.Metrics;
import com.lightstep.tracer.metrics.OkHttpSender;
import com.lightstep.tracer.metrics.Sender;
...
// Done once, at application initialization.
Sender,?> sender = new OkHttpSender(
"MyServiceName", // Service/Component name.
"MyAccessToken", // Access Token. Nullable
"1.2.3", // Service version. Nullable
"https://" // Metrics url
30000 // connect timeout in milliseconds
);
// Metrics inherits from Thread.
Metrics metrics = new Metrics(
sender,
30 // sample period in seconds
);
metrics.setDaemon(true);
metrics.start();
// Done at application/reporter shutdown.
metrics.close();
```