android13/external/opencensus-java/exporters/stats/signalfx/README.md

2.0 KiB

OpenCensus SignalFx Stats Exporter

The OpenCensus SignalFx Stats Exporter is a stats exporter that exports data to SignalFx, a real-time monitoring solution for cloud and distributed applications. SignalFx ingests that data and offers various visualizations on charts, dashboards and service maps, as well as real-time anomaly detection.

Quickstart

Prerequisites

To use this exporter, you must have a SignalFx account and corresponding data ingest token.

Java versions

This exporter requires Java 7 or above.

Add the dependencies to your project

For Maven add to your pom.xml:

<dependencies>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-api</artifactId>
    <version>0.16.1</version>
  </dependency>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-exporter-stats-signalfx</artifactId>
    <version>0.16.1</version>
  </dependency>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-impl</artifactId>
    <version>0.16.1</version>
    <scope>runtime</scope>
  </dependency>
</dependencies>

For Gradle add to your dependencies:

compile 'io.opencensus:opencensus-api:0.16.1'
compile 'io.opencensus:opencensus-exporter-stats-signalfx:0.16.1'
runtime 'io.opencensus:opencensus-impl:0.16.1'

Register the exporter

public class MyMainClass {
  public static void main(String[] args) {
    // SignalFx token is read from Java system properties.
    // Stats will be reported every second by default.
    SignalFxStatsExporter.create(SignalFxStatsConfiguration.builder().build());
  }
}

If you want to pass in the token yourself, or set a different reporting interval, use:

// Use token "your_signalfx_token" and report every 5 seconds.
SignalFxStatsExporter.create(
    SignalFxStatsConfiguration.builder()
        .setToken("your_signalfx_token")
        .setExportInterval(Duration.create(5, 0))
        .build());