All Projects → census-instrumentation → Opencensus Java

census-instrumentation / Opencensus Java

Licence: apache-2.0
A stats collection and distributed tracing framework

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Opencensus Java

Opencensus Node
A stats collection and distributed tracing framework
Stars: ✭ 249 (-61.09%)
Mutual labels:  cloud, monitoring, metrics, tracing, stats, distributed-tracing, trace, zipkin, dapper
Opencensus Go
A stats collection and distributed tracing framework
Stars: ✭ 1,895 (+196.09%)
Mutual labels:  cloud, monitoring, prometheus, stats, distributed-tracing, trace, zipkin
Opencensus Csharp
Distributed tracing and stats collecting framework
Stars: ✭ 126 (-80.31%)
Mutual labels:  cloud, monitoring, metrics, tracing, stats, distributed-tracing, trace
Opencensus Web
A stats collection and distributed tracing framework
Stars: ✭ 168 (-73.75%)
Mutual labels:  cloud, monitoring, metrics, tracing, stats, distributed-tracing, trace
gateway
A proxy to buffer and forward metrics, events, and traces.
Stars: ✭ 94 (-85.31%)
Mutual labels:  metrics, prometheus, tracing, zipkin, distributed-tracing
Skywalking
APM, Application Performance Monitoring System
Stars: ✭ 18,341 (+2765.78%)
Mutual labels:  metrics, prometheus, distributed-tracing, dapper
Opencensus Erlang
A stats collection and distributed tracing framework
Stars: ✭ 131 (-79.53%)
Mutual labels:  cloud, monitoring, stats, trace
Opentelemetry Rust
OpenTelemetry API and SDK for Rust
Stars: ✭ 280 (-56.25%)
Mutual labels:  metrics, prometheus, tracing, zipkin
Kamon
Distributed Tracing, Metrics and Context Propagation for application running on the JVM
Stars: ✭ 1,280 (+100%)
Mutual labels:  monitoring, metrics, tracing, distributed-tracing
Jaeger Ui
Web UI for Jaeger
Stars: ✭ 639 (-0.16%)
Mutual labels:  monitoring, tracing, distributed-tracing, trace
Zipkin Go Opentracing
OpenTracing Bridge for Zipkin Go
Stars: ✭ 472 (-26.25%)
Mutual labels:  tracing, distributed-tracing, trace, zipkin
Zipkin Go
Zipkin tracer library for go
Stars: ✭ 435 (-32.03%)
Mutual labels:  tracing, distributed-tracing, trace, zipkin
Apm Agent Go
Official Go agent for Elastic APM
Stars: ✭ 269 (-57.97%)
Mutual labels:  monitoring, tracing, distributed-tracing
Haystack
Top level repository for Haystack, containing documentation and deployment scripts
Stars: ✭ 261 (-59.22%)
Mutual labels:  metrics, tracing, distributed-tracing
Zipkin Js
Zipkin instrumentation for Node.js and browsers
Stars: ✭ 489 (-23.59%)
Mutual labels:  tracing, distributed-tracing, zipkin
pitchfork
Convert tracing data between Zipkin and Haystack formats
Stars: ✭ 40 (-93.75%)
Mutual labels:  tracing, zipkin, distributed-tracing
Kube State Metrics
Add-on agent to generate and expose cluster-level metrics.
Stars: ✭ 3,433 (+436.41%)
Mutual labels:  monitoring, metrics, prometheus
Inspectit
inspectIT is the leading Open Source APM (Application Performance Management) tool for analyzing your Java (EE) applications.
Stars: ✭ 513 (-19.84%)
Mutual labels:  monitoring, metrics, trace
java-metrics
No description or website provided.
Stars: ✭ 31 (-95.16%)
Mutual labels:  metrics, prometheus, tracing
Prometheus.erl
Prometheus.io client in Erlang
Stars: ✭ 276 (-56.87%)
Mutual labels:  monitoring, metrics, prometheus

OpenCensus - A stats collection and distributed tracing framework

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

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:

<dependencies>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-api</artifactId>
    <version>0.28.3</version>
  </dependency>
</dependencies>

For Gradle add to your dependencies:

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

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.

import io.opencensus.common.Scope;
import io.opencensus.trace.Tracer;
import io.opencensus.trace.Tracing;
import io.opencensus.trace.samplers.Samplers;

public final class MyClassWithTracing {
  private static final Tracer tracer = Tracing.getTracer();

  public static void doWork() {
    // Create a child Span of the current Span. Always record events for this span and force it to
    // be sampled. This makes it easier to try out the example, but unless you have a clear use
    // case, you don't need to explicitly set record events or sampler.
    try (Scope ss =
        tracer
            .spanBuilder("MyChildWorkSpan")
            .setRecordEvents(true)
            .setSampler(Samplers.alwaysSample())
            .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

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.

import io.opencensus.common.Scope;
import io.opencensus.stats.Aggregation;
import io.opencensus.stats.BucketBoundaries;
import io.opencensus.stats.Measure.MeasureLong;
import io.opencensus.stats.Stats;
import io.opencensus.stats.StatsRecorder;
import io.opencensus.stats.View;
import io.opencensus.stats.ViewData;
import io.opencensus.stats.ViewManager;
import io.opencensus.tags.TagKey;
import io.opencensus.tags.TagValue;
import io.opencensus.tags.Tagger;
import io.opencensus.tags.Tags;
import java.util.Arrays;
import java.util.Collections;

public final class MyClassWithStats {
  private static final Tagger tagger = Tags.getTagger();
  private static final ViewManager viewManager = Stats.getViewManager();
  private static final StatsRecorder statsRecorder = Stats.getStatsRecorder();

  // frontendKey allows us to break down the recorded data
  private static final TagKey FRONTEND_KEY = TagKey.create("myorg_keys_frontend");

  // videoSize will measure the size of processed videos.
  private static final MeasureLong VIDEO_SIZE =
      MeasureLong.create("my.org/measure/video_size", "size of processed videos", "By");

  // Create view to see the processed video size distribution broken down by frontend.
  // The view has bucket boundaries (0, 256, 65536) that will group measure values into
  // histogram buckets.
  private static final View.Name VIDEO_SIZE_VIEW_NAME = View.Name.create("my.org/views/video_size");
  private static final View VIDEO_SIZE_VIEW =
      View.create(
          VIDEO_SIZE_VIEW_NAME,
          "processed video size over time",
          VIDEO_SIZE,
          Aggregation.Distribution.create(
              BucketBoundaries.create(Arrays.asList(0.0, 256.0, 65536.0))),
          Collections.singletonList(FRONTEND_KEY));

  public static void initialize() {
    // ...
    viewManager.registerView(VIDEO_SIZE_VIEW);
  }

  public static void processVideo() {
    try (Scope scopedTags =
        tagger
            .currentBuilder()
            .put(FRONTEND_KEY, TagValue.create("mobile-ios9.3.5"))
            .buildScoped()) {
      // Processing video.
      // ...

      // Record the processed video size.
      statsRecorder.newMeasureMap().put(VIDEO_SIZE, 25648).record();
    }
  }

  public static void printStats() {
    ViewData viewData = viewManager.getView(VIDEO_SIZE_VIEW_NAME);
    System.out.println(
        String.format("Recorded stats for %s:\n %s", VIDEO_SIZE_VIEW_NAME.asString(), viewData));
  }
}

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:

<dependencies>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-api</artifactId>
    <version>0.28.3</version>
  </dependency>
  <dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-impl</artifactId>
    <version>0.28.3</version>
    <scope>runtime</scope>
  </dependency>
</dependencies>

For Gradle add to your dependencies:

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

How to setup exporters?

Trace exporters

Stats exporters

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].