How do I use a tracer with Auto Configuration?

32 Views Asked by At

I am following the tutorial Manual instrumentation for OpenTelemetry Java, trying to make Auto Configuration to work. After a few tries I managed to see the metrics sent to an OTel Collector.

Unfortunately I am not able to see the traces.

I tried to debug with VS Code and found out that a tracer doesn't get created because of this line of code

List<Integer> result = new Dice(1, 6).rollTheDice(rolls.get());

which should be instead

List<Integer> result = new Dice(1, 6, openTelemetry).rollTheDice(rolls.get());

This last one contains the initializazion of the tracer.

How should I modify the code in order to be able to pass the openTelemetry object? Only in the second case the tracer is invoked, but I am not able to provide the openTelemetry object from the method that contains Dice() (Springboot index.)

0

There are 0 best solutions below