tree: 979473997f2ca9e81c316d59ea773edd7459cfbd [path history] [tgz]
  1. src/
  2. build.gradle
  3. README.md
contrib/observability_ready_util/README.md

OpenCensus Observability Ready Util for Java

Build Status Windows Build Status

The OpenCensus Observability Ready Util for Java allows users to use OpenCensus easily.

It provides a wrapper that

  • Enables Basic RPC views
  • Sets Probabilistic sampling rate to 0.0001
  • Creates and Registers OCAgent Exporter to collect traces and metrics

Quickstart

Add the dependencies to your project

For Maven add to your pom.xml:

<dependencies>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-contrib-observability-ready-util</artifactId>
    <version>0.25.0</version>
  </dependency>
</dependencies>

For Gradle add to your dependencies:

compile 'io.opencensus:opencensus-contrib-observability-ready-util:0.25.0'

Enable OpenCensus:

import io.opencensus.contrib.observability.ready.util.BasicSetup;

public class YourClass {
  public static void main(String[] args) {
    // It is recommended to call this method before doing any RPC call to avoid missing stats.
    BasicSetup.enableOpenCensus("with-service-name");
  }
}

If Agent is not yet up and running, Exporter will just retry connection.

And deploy OpenCensus Agent:

It will require you to deploy the OpenCensus-Agent in order to export and examine the stats and traces. The OpenCensus Agent exporter aka “ocagent-exporter” enables your applications to send the observability that they’ve collected using OpenCensus to the OpenCensus Agent.