eventtracker-common

Library to send events to collectors

License

License

Categories

Categories

Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

com.ning
ArtifactId

ArtifactId

metrics.eventtracker-common
Last Version

Last Version

4.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

eventtracker-common
Library to send events to collectors
Project Organization

Project Organization

Ning, Inc.

Download metrics.eventtracker-common

How to add to project

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

Dependencies

compile (7)

Group / Artifact Type Version
com.google.inject : guice Optional jar 3.0
com.mogwee : mogwee-executors jar 1.1.0
com.ning : metrics.serialization-common jar 2.2.0
com.ning : metrics.serialization-writer jar 2.2.0
org.skife.config : config-magic Optional jar 0.13
org.slf4j : slf4j-api jar 1.6.4
org.weakref : jmxutils jar 1.12

test (4)

Group / Artifact Type Version
com.ning : metrics.serialization-common test-jar 2.2.0
com.ning : metrics.serialization-writer test-jar 2.2.0
org.slf4j : slf4j-simple jar 1.6.4
org.testng : testng jar 6.3.1

Project Modules

There are no modules declared in this project.

Eventtracker, a Java library for the Dwarf Collector

The eventtracker library is a Java library to send events to the Collector (github.com/pierre/collector).

Please refer to the serialization library FAQ for an overview of the Event concept: pierre.github.com/dwarf/serialization/faq.html

4.x.x release

Starting with 4.0.0, the eventtracker library is now broken into submodules:

  • com.ning:metrics.eventtracker-common: common classes, not useful by itself

  • com.ning:metrics.eventtracker-http: http sender classes, not useful by itself

  • com.ning:metrics.eventtracker-scribe: Thrift/Scribe sender (functionality equivalent to pre 4.0.0)

  • com.ning:metrics.eventtracker-smile: http sender, using Json/Smile serialization protocol (uses the collector POST API)

Usage

Scribe

For Guice integration, you need to install the CollectorControllerScribeModule module. To expose JMX stats, you need to install the CollectorControllerScribeMBeanModule module.

Smile over HTTP

For Guice integration, you need to install the CollectorControllerSmileModule module. To expose JMX stats, you need to install the CollectorControllerHttpMBeanModule module.

Maven

The eventtracker library is synced to Maven Central. Simply add the dependency to your pom.xml:

<dependency>
    <groupId>com.ning</groupId>
    <!-- Pick one! -->
    <artifactId>metrics.eventtracker-{http,scribe}</artifactId>
    <version>4.0.0</version>
</dependency>

The library offers a simple method to send events. Here is a complete working example to send one Thrift event (we assume myShinyEvent is a Thrift object):

ThriftEnvelopeEvent eventToSend = ThriftToThriftEnvelopeEvent.extractEvent("MyShinyEvent", myShinyEvent);

// See the Javadocs for fine-tuning of the parameters
// There is also a Guice module which uses config-magic for parameters injection:
//        Injector injector = Guice.createInjector(new CollectorControllerModule());
//        CollectorController controller = injector.getInstance(CollectorController.class);
EventTrackerConfig eventTrackerConfig = new EventTrackerConfig();
eventTrackerConfig.setScribeHost("collector-vip.company.com");

CollectorController controller = ScribeCollectorFactory.createScribeController(eventTrackerConfig);

controller.offerEvent(eventToSend);

// Optional, see below
controller.commit();
controller.flush();

You can send any type of Event (not necessarily Thrift) via the library (see below).

How does it work?

Each event accepted via the offerEvent(Event) API is directly serialized to disk using the com.ning:metrics.serialization-writer library for persistency. Events are then de-serialized and sent to the collector periodically and/or after a certain number of events have been offered.

The library supports all Collector APIs: HTTP based and Scribe (Thrift).

The CollectorController class provides the commit() call to force a promotion from the temporary queue of events to the final queue: only events in the final queue are sent (a separate thread wakes up periodically to see if there is anything to send). The commit() call bypasses the promotion rules mentioned above.

One can force a flush to the final queue by calling flush() on the controller object. This forces all events in the queue to be sent remotely.

Serialization to disk is done using the Java Serialization mechanisms (ObjectOutputStream to file). The whole Event object is written to disk. This is not configurable.

Final serialization on the wire is configurable (e.g. Java Serialization, Thrift). You can extend your event to support your own serialization protocol by implementing getSerializedBytes(). These bytes are sent on the wire.

License (see LICENSE-2.0.txt file for full license)

Copyright 2010-2011 Ning

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
4.1.2
4.1.1
4.1.0
4.0.8
4.0.7
4.0.6
4.0.5
4.0.4
4.0.3
4.0.2
4.0.1
4.0.0-pre1
4.0.0