Giter VIP home page Giter VIP logo

lightstep-census-java's Introduction

Circle CI Released Version Apache-2.0 license

LightStep OpenCensus Trace Exporter

The LightStep OpenCensus Trace Exporter is a trace exporter that exports data to LightStep.

Installation

pom.xml

<dependency>
    <groupId>com.lightstep.opencensus</groupId>
    <artifactId>lightstep-opencensus-exporter</artifactId>
    <version>VERSION</version>
</dependency>

<dependency>
    <groupId>io.opencensus</groupId>
    <artifactId>opencensus-impl</artifactId>
    <version>0.19.0</version>
    <scope>runtime</scope>
</dependency>

Also add dependencies required for LightStep tracer

Usage

Initialization

// Instantiate LightStep tracer
JRETracer jreTracer = ... 

// Register the exporter
LightStepTraceExporter.createAndRegister(jreTracer);

// Optionally configure 100% sample rate, otherwise, few traces will be sampled
TraceConfig traceConfig = Tracing.getTraceConfig();
    traceConfig.updateActiveTraceParams(
        traceConfig.getActiveTraceParams()
            .toBuilder()
            .setSampler(Samplers.probabilitySampler(1))
            .build());

Shutdown

// To shutdown the exporter
Tracing.getExportComponent().shutdown();

// Close the tracer, so that it'll flush queued traces
jreTracer.close();

Example

There is an example which demonstrate basic usage of the exporter.

License

Apache 2.0 License.

lightstep-census-java's People

Contributors

carlosalberto avatar dependabot[bot] avatar iredelmeier avatar malafeev avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightstep-census-java's Issues

java.lang.IllegalStateException: LightStep exporter is not registered.

I'm using this together with https://github.com/lightstep/lightstep-tracer-java-common.

With this in my pom...

    <dependency>
      <groupId>com.lightstep.tracer</groupId>
      <artifactId>tracer-okhttp</artifactId>
      <version>0.20.0</version>
    </dependency>

... I get this when calling LightStepTraceExporter.unregister():

java.lang.IllegalStateException: LightStep exporter is not registered.
	at com.lightstep.opencensus.exporter.LightStepTraceExporter.unregister(LightStepTraceExporter.java:54)

With tracer-okhttp 0.19.3, the same code works fine.

Is LightStepTraceExporter.unregister() working for you with tracer-okhttp 0.20.0?

This is somewhat related to #12, since shutting down isn't really documented.

publish artifacts to maven

Hi,

Would it be possible to have these build artifacts published to maven central? I did some local testing with this library and it seems to working as expected, I can see my opencensus traces in Lightstep!

Thanks

Docs: Error logging example

Hi!

I want to tag a span as failing, with a stack trace and an exception class, as described here:
https://github.com/opentracing/specification/blob/master/semantic_conventions.md#log-fields-table

The best way I have come up with so far for the logging part is to use an annotation:

    Tracing.getTracer()
        .getCurrentSpan()
        .addAnnotation(
            Annotation.fromDescriptionAndAttributes(
                "I don't want this string in the Lightstep UI",
                Collections.singletonMap("error.kind", AttributeValue.stringAttributeValue(e.getClass().getSimpleName()))));

It works, but it also clutters the Lightstep UI with the I don't want this string in the Lightstep UI string.

What is the recommended way to do this? How do I do it if I don't want the I don't want this string in the Lightstep UI string in the Lightstep UI?

Related to #12; both issues are about documenting how to use this package.

Compilation error due to 1.6 syntax error

I'm getting this error while building:

lightstep-census-java/src/main/java/com/lightstep/opencensus/exporter/LightStepExporterHandler.java:[92,52] diamond operator is not supported in -source 1.6

Once this is solved, we can publish to Maven Central ;)

Shutdown example?

Hi!

I tried to make a simple example just creating an exporter, making an OpenCensus span and reporting it.

It didn't work until I added a number of Thread.sleep() statements around my code.

Could you please add to the README a simple example that:

  • Sets up a working environment
  • Starts / finishes an OpenCensus span
  • Flushes outstanding data to the satellite(s)
  • Shuts down
  • After shutdown has actually reported the span so that it can be seen in your web UI

In my experiments neither LightStepTraceExporter.unregister() nor JRETracer.flush(), nor a combination thereof seem to actually flush data to your satellites, but Thread.sleep(20000) does.

Regards /Johan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.