Skip to content
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

Add Logback integration #166

Open
CraftyFella opened this issue Sep 16, 2022 · 11 comments
Open

Add Logback integration #166

CraftyFella opened this issue Sep 16, 2022 · 11 comments
Assignees
Labels
type: enhancement New feature or request

Comments

@CraftyFella
Copy link

CraftyFella commented Sep 16, 2022

Logs missing from traces in open telemetry

Hi there,

I'm getting somewhere with open telemetry and micronaut, while I’m seeing the traces and spans propagate to our open telemetry endpoint, we are not seeing the logs propagate. Our endpoint, in this case, is New Relic.

I have an example app which reproduces the issue here:

https://github.com/CraftyFella/micronaut-opentelemetry

Questions I have on this issue:

Should logs be published with the open telemetry otlp option in micronaut?

Is there anything I'm doing wrong in the above repo?

What's the best way to debug the open telemetry code so I can help myself?

@graemerocher
Copy link
Contributor

@n0tl3ss could you take a look?

@CraftyFella CraftyFella changed the title Missing logs and metric when using open telemetry Missing logs when using open telemetry Sep 16, 2022
@n0tl3ss
Copy link
Member

n0tl3ss commented Sep 16, 2022

Hi @CraftyFella. Did you manage to make exporting metrics work? Right now there isn't support for opentelemetry logging yet, but you might try to do it yourself.

https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-appender-1.0/library

About metrics, I need to test them, but because we are using the autoconfigure SDK I would expect that metrics work out of the box because Micrometer is supported. Here are libraries that Opentelemetry supports:

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md

@CraftyFella
Copy link
Author

CraftyFella commented Sep 16, 2022

Hi @CraftyFella. Did you manage to make exporting metrics work? Right now there isn't support for opentelemetry logging yet, but you might try to do it yourself.

https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/logback/logback-appender-1.0/library

Thanks for the confirmation... I nearly have something working now using the appender you pointed me to. It's coming back with a 404 from New Relic now.. so i'll try and work that out.. annoyingly it's using okhttp3 which doesn't respect the proxy java settings so its hard to see what it's actually sending.

@CraftyFella
Copy link
Author

@n0tl3ss where in the tracing and metric exporters is it actually making the http requests.. as Id like to compare the logging exporter to the working tracing exporter so I can play spot the difference.

@CraftyFella
Copy link
Author

CraftyFella commented Sep 23, 2022

Managed to get it all working.. traces, logs and metrics now being sent to New Relic.. thanks for your help.. I can close this issue now.

I've also updated the repo above.

@graemerocher
Copy link
Contributor

@CraftyFella if there is something we can improve in the documentation let us know, otherwise PRs are also welcome

@graemerocher graemerocher added the type: bug Something isn't working label Nov 9, 2022
@CraftyFella
Copy link
Author

After speaking with the team, we really would like to avoid having to write any code to make logging work, so I'm re-opening the issue so that it can be closed when the support is there for logging.

@CraftyFella CraftyFella reopened this Nov 17, 2022
@graemerocher
Copy link
Contributor

@CraftyFella can you post the code you had to use to make it work

@CraftyFella
Copy link
Author

CraftyFella commented Nov 17, 2022

@CraftyFella can you post the code you had to use to make it work

@graemerocher Sure.. here is how we got it to work https://github.com/CraftyFella/micronaut-opentelemetry/blob/main/src/main/java/com/example/opentelemetry/WireUp.java

That code has been made into a library by the company I work for currently..

It only works for logback though.

@graemerocher graemerocher changed the title Missing logs when using open telemetry Add Logback integration Nov 17, 2022
@graemerocher graemerocher added type: enhancement New feature or request and removed type: bug Something isn't working labels Nov 17, 2022
@scprek
Copy link

scprek commented Jun 2, 2023

@n0tl3ss @CraftyFella

I got this working with eventually with
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/logback/logback-mdc-1.0/library/README.md

But I wasn't seeing otel stuff in logs because the span was invalid. This is happening on HttpClient calls that return a connect error (was trying to force an error to happen)

$Intercepted] executed with error: Client <name>: : Connect Error, "logger_name":"io.micronaut.retry.intercept.RecoveryInterceptor",

@scprek
Copy link

scprek commented Jun 5, 2023

I opened a PR for doc updates open-telemetry/opentelemetry-java-instrumentation#8638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants