| commit | d18ff00b33537dc402e22efaf1547f3733293594 | [log] [tgz] |
|---|---|---|
| author | Hailong Wen <youxiabsyw@gmail.com> | Mon Jan 22 10:23:51 2018 -0800 |
| committer | GitHub <noreply@github.com> | Mon Jan 22 10:23:51 2018 -0800 |
| tree | 1e1525e31f923f7331b9701daeb25cc3f1d120f8 | |
| parent | 916e10eda91fe4c9bc484c16d195fa680b90de11 [diff] |
Rename trace exporters that have inconsistent naming. (#942) * Rename trace exporters [Logging|Stackdriver|Zipkin]Exporter to [Logging|Stackdriver|Zipkin]TraceExporter. * Add old [Logging|Stackdriver|Zipkin]Exporter back and deprecate them to maintain compatibility. * Implement old trace exporters using renamed ones.
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.
Integrating OpenCensus with a new library means recording stats or traces and propagating context.
For Maven add to your pom.xml:
<dependencies> <dependency> <groupId>io.opencensus</groupId> <artifactId>opencensus-api</artifactId> <version>0.10.1</version> </dependency> </dependencies>
For Gradle add to your dependencies:
compile 'io.opencensus:opencensus-api:0.10.1'
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."); // ... } }
TODO
Besides recording tracing/stats events the application also need to link the implementation, setup exporters, and debugging Z-Pages.
For Maven add to your pom.xml:
<dependencies> <dependency> <groupId>io.opencensus</groupId> <artifactId>opencensus-api</artifactId> <version>0.10.1</version> </dependency> <dependency> <groupId>io.opencensus</groupId> <artifactId>opencensus-impl</artifactId> <version>0.10.1</version> <scope>runtime</scope> </dependency> </dependencies>
For Gradle add to your dependencies:
compile 'io.opencensus:opencensus-api:0.10.1' runtime 'io.opencensus:opencensus-impl:0.10.1'
If the application owner wants to export in-process tracing and stats data via HTML debugging pages see this link.