-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoinstrumentation without @NewSpan? #202
Comments
you can add the HTTP module if you want auto instrumentation of HTTP requests https://micronaut-projects.github.io/micronaut-tracing/latest/guide/#http |
Thank you for answering. We already have that, but there is only one span per http request despite within a request many functions are called. How to trace individual function calls without annotating with @newspan or @continuespan on each single one of them? |
Further to the original question, is there anything in Micronaut Tracing that's similar to Spring Cloud Sleuth that automatically adds trace and span ids to the Slf4J MDC so that they can be included in the application logs? |
Not sure where to post this but to get Span and Trace IDs to show up in the Logback logs I had to do the following:
implementation("io.micronaut.tracing:micronaut-tracing-opentelemetry-http")
runtimeOnly("io.opentelemetry.instrumentation:opentelemetry-logback-mdc-1.0") // version is pulled from micronaut tracing BOM groovy
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date{ISO8601} %-5level [%X{trace_id},%X{span_id}] [%thread] %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="OTEL" class="io.opentelemetry.instrumentation.logback.v1_0.OpenTelemetryAppender">
<appender-ref ref="STDOUT"/>
</appender>
<root level="info">
<appender-ref ref="OTEL"/>
</root>
</configuration> This was enough to get the trace and span ID to show up in the logs but then our system and integration tests started failing. I found #152 which was the same issue but still our tests were failing. In order to overcome I had to extend that fix by also resetting OTEL on public class BaseIntegrationTest {
@PreDestroy
@AfterEach()
void resetForTest() {
GlobalOpenTelemetry.resetForTest();
}
... |
@alberth-li how about this issue?, I also get the same. |
Feature description
Hello,
I am not very familiar with the project, so apologize in advance if I am asking a stupid question...
Open Telemetry has an auto instrumentation agent that works out of the box without need to change any code: https://opentelemetry.io/docs/instrumentation/java/automatic/
However, it appears that Micronaut is not supported yet: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md
So what does this project do in term of Otel support? It appears that in order for us to have multiple spans under one incoming http request on a http server running Micronaut, we need to add @NewSpan annotation to every single function in the call stack? Is this how it is suppose to be used? Or there is some out of the box usage here? I am very confused.
The text was updated successfully, but these errors were encountered: