tree: 319f932249aea60e6fa2fef368cee7f74d06405c [path history] [tgz]
  1. src/
  2. build.gradle
  3. README.md
contrib/spring_starter/README.md

OpenCensus Spring Starter

Build Status Windows Build Status Maven Central

The OpenCensus Spring Starter for Java is a starter package that includes packages required to enable tracing using opencensus when working with Spring Web.

This version is compatible with Spring Boot 2.0.

Servlet and AsyncRestTemplate Tracing

Enable tracing on RestController (server side) and AysncRestTemplate (client side) by simply including opencensus-contrib-spring-starter in your dependencies and initializing exporter. It automatically traces your http request and collects stats associated with the request.

It does require to register exporter and views.

Depedencies

Maven

<dependencies>
    <dependency>
        <groupId>io.opencensus</groupId>
        <artifactId>opencensus-contrib-spring-starter</artifactId>
        <version>0.23.0</version>
    </dependency>
</dependencies>

Gradle

dependencyManagement {
    imports {
        mavenBom "io.opencensus:opencensus-contrib-spring-starter:0.23.0"
    }
}
dependencies {
	compile 'io.opencensus:opencensus-contrib-spring:0.23.0'
}

Tracing Properties

Optionally configure one or more Tracing Properties in application.properties file.

PublicEndpoint

If a servlet is serving publicEndpoints (untrusted boundary) then set this property to true. When set to true incoming trace context is added as a parent link instead of as a parent. By default it is set to false. When set to false it uses incoming trace context as a parent.

opencensus.spring.trace.publicEndpoint = true

Propagation

opencensus.spring.trace.propagation = TRACE_PROPAGATION_B3

By default it is set to TRACE_PROPAGATION_TRACE_CONTEXT which uses W3C Tracecontext propagator to propagate trace context. To use B3 format set the property to TRACE_PROPAGATION_B3

opencensus.spring.trace.propagation = TRACE_PROPAGATION_B3

Java Versions

Java 6 or above is required for using this artifact.