Home | History | Annotate | Download | only in signalfx
      1 # OpenCensus SignalFx Stats Exporter
      2 
      3 The _OpenCensus SignalFx Stats Exporter_ is a stats exporter that
      4 exports data to [SignalFx](https://signalfx.com), a real-time monitoring
      5 solution for cloud and distributed applications. SignalFx ingests that
      6 data and offers various visualizations on charts, dashboards and service
      7 maps, as well as real-time anomaly detection.
      8 
      9 ## Quickstart
     10 
     11 ### Prerequisites
     12 
     13 To use this exporter, you must have a [SignalFx](https://signalfx.com)
     14 account and corresponding [data ingest
     15 token](https://docs.signalfx.com/en/latest/admin-guide/tokens.html).
     16 
     17 #### Java versions
     18 
     19 This exporter requires Java 7 or above.
     20 
     21 ### Add the dependencies to your project
     22 
     23 For Maven add to your `pom.xml`:
     24 
     25 ```xml
     26 <dependencies>
     27   <dependency>
     28     <groupId>io.opencensus</groupId>
     29     <artifactId>opencensus-api</artifactId>
     30     <version>0.16.1</version>
     31   </dependency>
     32   <dependency>
     33     <groupId>io.opencensus</groupId>
     34     <artifactId>opencensus-exporter-stats-signalfx</artifactId>
     35     <version>0.16.1</version>
     36   </dependency>
     37   <dependency>
     38     <groupId>io.opencensus</groupId>
     39     <artifactId>opencensus-impl</artifactId>
     40     <version>0.16.1</version>
     41     <scope>runtime</scope>
     42   </dependency>
     43 </dependencies>
     44 ```
     45 
     46 For Gradle add to your dependencies:
     47 
     48 ```
     49 compile 'io.opencensus:opencensus-api:0.16.1'
     50 compile 'io.opencensus:opencensus-exporter-stats-signalfx:0.16.1'
     51 runtime 'io.opencensus:opencensus-impl:0.16.1'
     52 ```
     53 
     54 ### Register the exporter
     55 
     56 ```java
     57 public class MyMainClass {
     58   public static void main(String[] args) {
     59     // SignalFx token is read from Java system properties.
     60     // Stats will be reported every second by default.
     61     SignalFxStatsExporter.create(SignalFxStatsConfiguration.builder().build());
     62   }
     63 }
     64 ```
     65 
     66 If you want to pass in the token yourself, or set a different reporting
     67 interval, use:
     68 
     69 ```java
     70 // Use token "your_signalfx_token" and report every 5 seconds.
     71 SignalFxStatsExporter.create(
     72     SignalFxStatsConfiguration.builder()
     73         .setToken("your_signalfx_token")
     74         .setExportInterval(Duration.create(5, 0))
     75         .build());
     76 ```
     77