Add IntervalBucket and tests. (#537)

5 files changed
tree: 9e836cb7c76c3889a3146785c4e06f6d56b98f50
  1. .github/
  2. all/
  3. api/
  4. benchmarks/
  5. buildscripts/
  6. contrib/
  7. core/
  8. core_impl/
  9. core_impl_android/
  10. core_impl_java/
  11. examples/
  12. exporters/
  13. gradle/
  14. impl/
  15. impl_core/
  16. impl_lite/
  17. testing/
  18. .gitignore
  19. .gitmodules
  20. .travis.yml
  21. appveyor.yml
  22. AUTHORS
  23. build.gradle
  24. check-git-history.py
  25. CONTRIBUTING.md
  26. findbugs-exclude.xml
  27. gradlew
  28. gradlew.bat
  29. LICENSE
  30. README.md
  31. RELEASING.md
  32. settings.gradle
README.md

OpenCensus - A stats collection and distributed tracing framework

Build Status Build status Maven Central

OpenCensus is a toolkit for collecting application performance and behavior data. It currently includes 3 apis: stats, tracing and tags.

The library is in alpha stage and the API is subject to change.

Please join gitter for help or feedback on this project.

Instrumentation Quickstart

Integrating OpenCensus with a new library means recording stats or traces and propagating context.

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.6.0</version>
  </dependency>
</dependencies>

For Gradle add to your dependencies:

compile 'io.opencensus:opencensus-api:0.6.0'

Hello "OpenCensus" trace events

Here's an example of creating a Span and record some trace annotations. Notice that recording the annotations is possible because we propagate scope. 3rd parties libraries like SLF4J can integrate the same way.

public final class MyClassWithTracing {
  public static void doWork() {
    // Create a child Span of the current Span.
    try (Scope ss = tracer.spanBuilder("MyChildWorkSpan").startScopedSpan()) {
      doInitialWork();
      tracer.getCurrentSpan().addAnnotation("Finished initial work");
      doFinalWork();
    }
  }
  
  private static void doInitialWork() {
    // ...
    tracer.getCurrentSpan().addAnnotation("Important.");
    // ...
  }
  
  private static void doFinalWork() {
    // ...
    tracer.getCurrentSpan().addAnnotation("More important.");
    // ...
  }
}

Hello "OpenCensus" stats events

TODO

Quickstart for Applications

Besides recording tracing/stats events the application also need to link the implementation, setup exporters, and debugging Z-Pages.

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.6.0</version>
  </dependency>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-impl</artifactId>
    <version>0.6.0</version>
    <scope>runtime</scope>
  </dependency>
</dependencies>

For Gradle add to your dependencies:

compile 'io.opencensus:opencensus-api:0.6.0'
runtime 'io.opencensus:opencensus-impl:0.6.0'

How to setup exporters?

Trace exporters

Stats exporters

  • TODO

How to setup debugging Z-Pages?

If the application owner wants to export in-process tracing and stats data via HTML debugging pages see this link.