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

How to add custom dimensions to a trace #1771

Closed
martijnburgers opened this issue Jun 26, 2021 · 4 comments
Closed

How to add custom dimensions to a trace #1771

martijnburgers opened this issue Jun 26, 2021 · 4 comments

Comments

@martijnburgers
Copy link

martijnburgers commented Jun 26, 2021

I am running a Java Quarkus application with applicationinsights-agent-3.1.1.jar .

The applications logs in json format

{"timestamp":"2021-06-26T20:50:58.833+02:00","sequence":1440,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"someservice.service 1.0.0-SNAPSHOT on JVM (powered by Quarkus 1.13.7.Final) started in 8.270s. Listening on: http://localhost:8080","threadName":"Quarkus Main Thread","threadId":95,"hostName":"someHostName","processName":"someservice.service-dev.jar","processId":91912}
{"timestamp":"2021-06-26T20:50:58.844+02:00","sequence":1441,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"Profile dev activated. Live Coding activated.","threadName":"Quarkus Main Thread","threadId":95,"hostName":"someHostName","processName":"someservice.service-dev.jar","processId":91912}
{"timestamp":"2021-06-26T20:50:58.844+02:00","sequence":1442,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus","level":"INFO","message":"Installed features: [cdi, mutiny, quarkiverse-logging-json, resteasy, resteasy-jackson, resteasy-jaxb, resteasy-multipart, resteasy-mutiny, smallrye-context-propagation, smallrye-openapi, swagger-ui]","threadName":"Quarkus Main Thread","threadId":95,"hostName":"someHostName","processName":"someservice.service-dev.jar","processId":91912}
{"timestamp":"2021-06-26T20:56:09.483+02:00","sequence":1446,"loggerClassName":"org.slf4j.impl.Slf4jLogger","loggerName":"nl.somecompany.someService.service.Service","level":"INFO","message":"rocess incoming request","threadName":"executor-thread-1","threadId":101,"ndc":"f45a16d5-6c16-4040-92a5-0b8388752823","hostName":"someHostName","processName":"someService.service-dev.jar","processId":91912,"properties":{"requestId":"f45a16d5-6c16-4040-92a5-0b8388752823","scenarioName":null}}

The last line also includes custom properties created with the following line of code:

logger.info("Process incoming request", kv("properties", context));

Application Insights shows every log line (trace) as shown above but the customDimensions never include the custom properties. It only shows:

LoggerName
nl.somecompany.someservice.service.someservice

LoggingLevel
INFO

SourceType
Logger

How can we add custom dimensions to application insights from Java logging?

@trask
Copy link
Member

trask commented Jun 30, 2021

hey @martijnburgers! What logging framework are you using?

@martijnburgers
Copy link
Author

Quarkus is using JBoss Log Manager and the JBoss Logging facade: org.jboss.logging.Logger

@trask
Copy link
Member

trask commented Jul 14, 2022

hi @martijnburgers! we have added MDC support for jboss logging so that MDC key/value paris are added as custom dimensions to the trace. Here's a SNAPSHOT release if you are able to test it out:

https://github.com/microsoft/ApplicationInsights-Java/suites/7346755937/artifacts/297833967

@ghost
Copy link

ghost commented Jul 21, 2022

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@ghost ghost closed this as completed Jul 28, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 27, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants