Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

opencensus-java

> DevOps
Open source

A stats collection and distributed tracing framework

672 stars0 likes1 views
WebsiteGitHub

About

A stats collection and distributed tracing framework

Warning

OpenCensus and OpenTracing have merged to form OpenTelemetry, which serves as the next major version of OpenCensus and OpenTracing.

OpenTelemetry has now reached feature parity with OpenCensus, with tracing and metrics SDKs available in .NET, Golang, Java, NodeJS, and Python. All OpenCensus Github repositories, except census-instrumentation/opencensus-python, will be archived on July 31st, 2023. We encourage users to migrate to OpenTelemetry by this date.

To help you gradually migrate your instrumentation to OpenTelemetry, bridges are available in Java, Go, Python, and JS. Read the full blog post to learn more.

OpenCensus - A stats collection and distributed tracing framework

Gitter chat Maven Central Javadocs Build Status Windows Build Status Coverage Status

:exclamation: The opencensus-contrib-log-correlation-log4j2 Java client library is part of the OpenCensus project. CVE-2021-44228 and CVE-2021-45046 disclosed security vulnerabilities in the Apache Log4j 2 version 2.15 or below. The recent version v0.28.3 depends on Log4j 2.11.1. A number of previous versions also depend on vulnerable Log4j versions.

:exclamation: We merged several fixes and published a release that depends on a safe version of Log4j (2.16). We strongly encourage customers who depend on the opencensus-contrib-log-correlation-log4j2 library to upgrade to the latest release (v0.30.0).

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

The library is in Beta stage and APIs are expected to be mostly stable.

Please join gitter for help or feedback on this project.

OpenCensus and OpenTracing have merged to form OpenTelemetry, which serves as the next major version of OpenCensus and OpenTracing. OpenTelemetry will offer backwards compatibility with existing OpenCensus integrations, and we will continue to make security patches to existing OpenCensus libraries for two years. Read more about the merger here.

OpenCensus Quickstart for Libraries

Integrating OpenCensus with a new library means recording stats or traces and propagating context. For application integration please see Quickstart for Applications.

The full quick start example can also be found on the OpenCensus website.

Add the dependencies to your project

For Maven add to your pom.xml:

xml

  
    io.opencensus
    opencensus-api
    0.30.0
  

For Gradle add to your dependencies:

groovy
compile 'io.opencensus:opencensus-api:0.30.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.

…

Hello "OpenCensus" stats events

Here's an example on

  • defining TagKey, Measure and View,
  • registering a view,
  • putting TagKey and TagValue into a scoped TagContext,
  • recording stats against current TagContext,
  • getting ViewData.

For the complete example, see here.

…

OpenCensus 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:

xml

  
    io.opencensus
    opencensus-api
    0.30.0
  
  
    io.opencensus
    opencensus-impl
    0.30.0
    runtime
  

For Gradle add to your dependencies:

groovy
compile 'io.opencensus:opencensus-api:0.30.0'
runtime 'io.opencensus:opencensus-impl:0.30.0'

How to setup exporters?

Trace exporters

  • Instana
  • Jaeger
  • Logging
  • Stackdriver
  • Zipkin

Stats exporters

  • Stackdriver
  • SignalFx
  • Prometheus

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.

Versioning

This library follows Semantic Versioning.

GA: Libraries defined at a GA quality level are stable, and will not introduce backwards-incompatible changes in any minor or patch releases. We will address issues and requests with the highest priority. If we were to make a backwards-incompatible changes on an API, we will first mark the existing API as deprecated and keep it for 18 months before removing it.

Beta: Libraries defined at a Beta quality level are expected to be mostly stable and we're working towards their release candidate. We will address issues and requests with a higher priority. There may be backwards incompatible changes in a minor version release, though not in a patch release. If an element is part of an API that is only meant to be used by exporters or other opencensus libraries, then there is no deprecation period. Otherwise, we will deprecate it for 18 months before removing it, if possible.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaclouddapperdistributed-tracingjava

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理