jaegertracing / jaeger-client-java

🛑 This library is DEPRECATED!
https://jaegertracing.io/
Other
490 stars 232 forks source link

Enable MDCScopeManager via env variable #753

Closed c-koell closed 2 years ago

c-koell commented 4 years ago

Requirement - what kind of business use case are you trying to solve?

We are using Microprofile openTracing on OpenLiberty with jaeger as implementation. It would be great to enable the MDCScopeManager via env variable because we have no ability to configure it via Microprofile openTracing Spec.

yurishkuro commented 4 years ago

Similar to #734

brngylni commented 3 years ago

Hey, I want to work on that. Can you please give me a few tips? @yurishkuro

jpkrohling commented 3 years ago

You can find more information about the MDC Scope Manager here: https://github.com/jaegertracing/jaeger-client-java/blob/master/jaeger-core/README.md#log-correlation

This ticket would be about using it when a specific env var is set. Let me know if you get blocked and need further clarification.

brngylni commented 3 years ago

You can find more information about the MDC Scope Manager here: https://github.com/jaegertracing/jaeger-client-java/blob/master/jaeger-core/README.md#log-correlation

This ticket would be about using it when a specific env var is set. Let me know if you get blocked and need further clarification.

I think I need to add a constant in Configuration.java and edit the getTracerBuilder method. I have made some changes but I am not sure about them. How can I test them ?

jpkrohling commented 3 years ago

I guess the easiest would be to build a sample application that would use log4j configured to print out the trace ID to the logs. If you can see the trace IDs when setting the env var, and not see that trace ID when not setting the env var, your change then worked :-)

yurishkuro commented 3 years ago

But also just implement unit tests that assert the correct context manager is used.

brngylni commented 3 years ago

Indeed, I am pretty disoriented. I have watched the tutorials but, don't know what to do now. How can I use the Jaeger that I changed the source files.

jpkrohling commented 3 years ago

You might want to refer to the Gradle documentation, but once you run the build and install tasks (./gradlew build install), you can reference the locally built artifact by its version (1.6.0 for instance).

brngylni commented 3 years ago

You might want to refer to the Gradle documentation, but once you run the build and install tasks (./gradlew build install), you can reference the locally built artifact by its version (1.6.0 for instance).

I am trying to build it but I think there are some problems. Here is the output :

 Task :jaeger-thrift:compileJava FAILED
warning: [options] bootstrap class path not set in conjunction with -source 1.6
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:21: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Log;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:22: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.SpanRef;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:23: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.SpanRefType;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:24: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Tag;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:25: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.TagType;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:36: error: package io.jaegertracing.thriftjava does not exist
  public static io.jaegertracing.thriftjava.Span convertSpan(JaegerSpan jaegerSpan) {
                                           ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:61: error: cannot find symbol
  static List<SpanRef> buildReferences(List<Reference> references) {
              ^
  symbol:   class SpanRef
  location: class JaegerThriftSpanConverter
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:73: error: cannot find symbol
  static List<Log> buildLogs(List<LogData> logs) {
              ^
  symbol:   class Log
  location: class JaegerThriftSpanConverter
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:94: error: cannot find symbol
  public static List<Tag> buildTags(Map<String, ?> tags) {
                     ^
  symbol:   class Tag
  location: class JaegerThriftSpanConverter
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:106: error: cannot find symbol
  static Tag buildTag(String tagKey, Object tagValue) {
         ^
  symbol:   class Tag
  location: class JaegerThriftSpanConverter
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/reporters/protocols/JaegerThriftSpanConverter.java:124: error: cannot find symbol
  static void buildStringTag(Tag tag, Object tagValue) {
                             ^
  symbol:   class Tag
  location: class JaegerThriftSpanConverter
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/UdpSender.java:17: error: package io.jaegertracing.agent.thrift does not exist
import io.jaegertracing.agent.thrift.Agent;
                                    ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/UdpSender.java:20: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Batch;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/UdpSender.java:21: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Process;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/ThriftSender.java:22: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Process;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/UdpSender.java:34: error: package Agent does not exist
  @ToString.Exclude private volatile Agent.Client agentClient;
                                          ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/UdpSender.java:65: error: package Agent does not exist
  private Agent.Client getAgentClient() throws TTransportException {
               ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/UdpSender.java:82: error: package io.jaegertracing.thriftjava does not exist
  public void send(Process process, List<io.jaegertracing.thriftjava.Span> spans) throws SenderException {
                                                                    ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/ThriftSender.java:35: error: package io.jaegertracing.thriftjava does not exist
  @ToString.Exclude private List<io.jaegertracing.thriftjava.Span> spanBuffer;
                                                            ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/ThriftSender.java:92: error: package io.jaegertracing.thriftjava does not exist
  protected int calculateSpanSize(io.jaegertracing.thriftjava.Span span) throws SenderException {
                                                             ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/ThriftSender.java:104: error: package io.jaegertracing.thriftjava does not exist
  public abstract void send(Process process, List<io.jaegertracing.thriftjava.Span> spans) throws SenderException;
                                                                             ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/HttpSender.java:18: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Batch;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/HttpSender.java:19: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Process;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/HttpSender.java:20: error: package io.jaegertracing.thriftjava does not exist
import io.jaegertracing.thriftjava.Span;
                                  ^
/home/ghost/Desktop/jaeger-client-java/jaeger-thrift/src/main/java/io/jaegertracing/thrift/internal/senders/HttpSender.java:55: error: cannot find symbol
  public void send(Process process, List<Span> spans) throws SenderException {
                                         ^
  symbol:   class Span
  location: class HttpSender
25 errors
yurishkuro commented 3 years ago

Make sure you initialize the git submodule git submodule init && git submodule update

brngylni commented 3 years ago

I have built it and added the jars to my project's class path but I am getting different errors repeatedly. I think it would be better to anyone else solve it. Thanks.

jpkrohling commented 3 years ago

Alright, that's fine @brngylni. Thank you anyway for investing time in this!