Server Tracker for Java

A client library for the Server Tracker. (http://github.com/jolira/server-tracker)

License

License

GroupId

GroupId

com.jolira
ArtifactId

ArtifactId

server-tracker-4j
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Server Tracker for Java
A client library for the Server Tracker. (http://github.com/jolira/server-tracker)
Source Code Management

Source Code Management

http://github.com/jolira/server-tracker-4j

Download server-tracker-4j

How to add to project

<!-- https://jarcasting.com/artifacts/com.jolira/server-tracker-4j/ -->
<dependency>
    <groupId>com.jolira</groupId>
    <artifactId>server-tracker-4j</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.jolira/server-tracker-4j/
implementation 'com.jolira:server-tracker-4j:1.1.1'
// https://jarcasting.com/artifacts/com.jolira/server-tracker-4j/
implementation ("com.jolira:server-tracker-4j:1.1.1")
'com.jolira:server-tracker-4j:jar:1.1.1'
<dependency org="com.jolira" name="server-tracker-4j" rev="1.1.1">
  <artifact name="server-tracker-4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.jolira', module='server-tracker-4j', version='1.1.1')
)
libraryDependencies += "com.jolira" % "server-tracker-4j" % "1.1.1"
[com.jolira/server-tracker-4j "1.1.1"]

Dependencies

compile (4)

Group / Artifact Type Version
com.google.inject : guice jar 3.0
org.slf4j : slf4j-api jar 1.6.1
com.google.code.gson : gson jar 1.7.1
net.sourceforge.findbugs : jsr305 jar 1.3.7

test (3)

Group / Artifact Type Version
junit : junit jar 4.8.2
org.slf4j : slf4j-jdk14 jar 1.6.1
com.jolira : testing-tools jar 1.2.6

Project Modules

There are no modules declared in this project.

A Server Tracker Client Library 4 Java

A java client library for the Server Tracker.

The basic function of this library is to collect arbitrary metrics and logs inside a Java application or an application server and submit these metrics to remote Server Tracker with low-overhead so the data is available for display.

This library has been build to be used with Google's Guice, but can also be run without code injection. The instructions below show how to use the abstraction stand-alone and with Guice.

Stand-Alone Usage

Here is a very simple example for how to use this library (without Guice):

// visitor IDs should identify a user as uniquely as possible
// On a browser is should be stored as a persistent cookie or in a
// HTML5 data-store.
final UUID visitorID = UUID.randomUUID();

// this identifier should remain the same for the duration of the user session
final UUID sessionID = UUID.randomUUID();

final Executor executor = Executors.newCachedThreadPool();
final MetricStore store = new MetricStoreImpl();
final ServerTracker tracker = new ServerTrackerImpl(
        "tracker1.jolira.com:3080,tracker2.jolira.com:3080,tracker3.jolira.com", 2000, store, executor);
final DemoMetric metric = new DemoMetric();
final long startTime = System.currentTimeMillis();

try {
    // Do something that needs to be measured
} finally {
    final long duration = System.currentTimeMillis() - startTime;

    metric.startTime = startTime;
    metric.duration = duration;
}

tracker.postMetric(metric);

final Map<String, Object> eventInfo = new HashMap<String, Object>();

eventInfo.put("session", sessionID);
eventInfo.put("visitor", visitorID);

// send the metric (and any other that may have been created for this thread
// to the remote server.
tracker.submit(eventInfo);

This example creates one metric that captures start time and performance of some piece of code and sends the results to the server using a background thread.

The full source code of this example can be found at Demo.java.

Metrics

This library uses GSON and can handle any metric object that can be serialized using this library. Metric should be simple and do not have to have public scope, as shown in DemoMetric.java.

class DemoMetric {
    long startTime;
    long duration;
}
com.jolira

Jolira

Versions

Version
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0
0.0.22
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.12
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1