OpenCensus is being archived! Read the blog post to learn more

Jaeger

Introduction

The OpenCensus Service allows one to export traces to Jaeger by sending traces to Jaeger’s collector endpoint.

Configuration

In the Service’s YAML configuration file, under section “exporters” and sub-section “jaeger” configure fields:

Format

exporters:
  jaeger:
    service-name: "<service_name>"
    collector-endpoint: "<endpoint_url_of_the_jaeger_server>"
    username: "<the_optional_username_to_access_your_collector>"
    password: "<the_optional_password_to_access_your_collector>"

Example

exporters:
  jaeger:
    service-name: "agent_j"
    collector-endpoint: "http://localhost:14268/api/traces"

End to end example

In this end-to-end example, we’ll have OpenCensus Service running and a couple of Go applications that use the Go ocagent-exporter to send over traces to OpenCensus Service and then to Jaeger.

Running Jaeger

First, we need to get Jaeger running

For assistance setting up Jaeger, Click here for a guided codelab.

With Jaeger running, we are ready to proceed with running the demo.

Running OpenCensus Service

The OpenCensus Service will run with Jaeger as the only exporter, but receive traffic from ocagent-exporter-using applications.

On starting the OpenCensus Service with the configuration below:

exporters:
  jaeger:
    service_name: "opencensus"
    collector_endpoint: "http://localhost:14268/api/traces"

On running the OpenCensus Service:

{"level":"info","ts":1550129670.73966,"caller":"config/config.go:424","msg":"Trace Exporter enabled","exporter":"jaeger"}

Running Application Code

And then running the ocagent-go-exporter main.go application

The ocagent.WithAddress can be changed in main.go to point to the OpenCensus Collector directly if desired.

$ GO111MODULE=on go run example/main.go
#0: LineLength: 669By
Latency: 123.240ms
#0: LineLength: 779By
#1: LineLength: 740By
Latency: 578.215ms
#0: LineLength: 420By
#1: LineLength: 932By
#2: LineLength: 363By
#3: LineLength: 5By
Latency: 10346.675ms

Results

On navigating to the Jaeger UI at http://localhost:16686

All traces

Single trace detail

References

Resource URL
Jaeger project home https://www.jaegertracing.io
Go ocagent-exporter demo ocagent-demo