Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

vmware-archive/wavefront-jaxrs-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VMware has ended active development of this project, this repository will no longer be updated.

wavefront-jaxrs-sdk-java build status Released Version

The Wavefront by VMware JAX-RS SDK for Java provides out-of-the-box trace data from JAX-RS based clients in your Java application. You can analyze the tracing data in Wavefront to better understand how your application is performing in production. If you have multiple services running, you can instrument your server-side service with our Wavefront Jersey SDK to form a complete trace.

Maven

If you are using Maven, add the following maven dependency to your pom.xml:

<dependency>
    <groupId>com.wavefront</groupId>
    <artifactId>wavefront-jaxrs-sdk-java</artifactId>
    <version>$releaseVersion</version>
</dependency>

Replace $releaseVersion with the latest version available on maven.

WavefrontJaxrsClientFilter

Follow the steps below to set up a WavefrontJaxrsClientFilter. For each client that uses a JAX-RS-compliant framework:

  1. Create an ApplicationTags instance, which specifies metadata about your application.
  2. Create a WavefrontSender for sending data to Wavefront.
  3. Create a WavefrontSpanReporter for reporting trace data to Wavefront.
  4. Create a WavefrontTracer as the tracer for generating traces and spans.
  5. Create a WavefrontJaxrsClientFilter.
  6. Register the WavefrontJaxrsClientFilter.

For the details of each step, see the sections below.

1. Set Up Application Tags

Application tags determine the metadata (point tags and span tags) that are included with every metric/histogram/span reported to Wavefront. These tags enable you to filter and query the reported data in Wavefront.

You encapsulate application tags in an ApplicationTags object. See Instantiating ApplicationTags for details.

2. Set Up a WavefrontSender

A WavefrontSender object implements the low-level interface for sending data to Wavefront. You can choose to send data to Wavefront using either the Wavefront proxy or direct ingestion.

  • If you have already set up a WavefrontSender for another SDK that will run in the same JVM, use that one. (For details about sharing a WavefrontSender instance, see Share a WavefrontSender.)

  • Otherwise, follow the steps in Set Up a WavefrontSender.

3. Set Up a WavefrontSpanReporter

A WavefrontSpanReporter reports trace data to Wavefront. To build a WavefrontSpanReporter, you specify:

  • The WavefrontSender you created above.
  • The source of the reported trace data, typically the name of the host that the code is running on.
sourceName = "mySource"; // Example - Replace value!
Reporter wfSpanReporter = new WavefrontSpanReporter.Builder().
    withSource(sourceName).build(wavefrontSender);

4. Set Up a WavefrontTracer

A WavefrontTracer creates trace data from your JAX-RS client, and sends the data to Wavefront through a WavefrontSpanReporter.

To build a WavefrontTracer, you specify the WavefrontSpanReporter and the ApplicationTags you created above.

WavefrontTracer wfTracer = new WavefrontTracer.Builder(wfSpanReporter,   
    applicationTags).build();

5. Set Up a WavefrontJaxrsClientFilter

To build the WavefrontJaxrsClientFilter, you specify:

  • The WavefrontSender, ApplicationTags and WavefrontTracer you created above.
  • The same source that you specified when creating the WavefrontSpanReporter.
sourceName = "mySource"; // Example - Replace value!
WavefrontJaxrsClientFilter filter = new WavefrontJaxrsClientFilter(wfSender,  
    applicationTags, sourceName, wfTracer);

6. Register the WavefrontJaxrsClientFilter

For any JAX-RS-compliant ClientBuilder, register your filter as follows:

clientBuilder.register(filter);