cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The dt.trace_id value is often null in application log

giger85
Visitor

Hi, all

Our team application use spring cloud gateway (spring webflux, project reactor) and log4j2.
I enabled log enrichment and configured log4j2 pattern layout.

<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%X{dt.trace_id},%X{dt.span_id}] [%thread] %-5level %logger{0} - %msg%n"/>


The user request traffic flow is below.
  - user -> gateway -> api -> gateway -> user

Almost request logs before calling api have dt.trace_id value.
[2023-05-04T14:41:55.840+0900] [162f131e885aec3f7f6ea84d1b21f05a,65c16306c336ed63] [reactor-http-epoll-4] INFO LoggingRequestDecorator - [ea4bd16c-181749] Request started: POST /v1/foo/search

But sometimes, a few request log before calling api does not have dt.trace_id value
[2023-05-04T14:36:28.592+0900] [,] [reactor-http-epoll-3] INFO LoggingRequestDecorator - [ea4bd16c-181749] Request started: POST /v1/foo/search

Since I use OneAgent Java SDK library, I am able to refer to dt.trace_id at response logging time and able to find every trace using that dt.trace_id at dynatrace UI.

My questions are below.
1. Why the value of dt.trace_id is null ?
2. How to debug OneAgent log enrichment fucntion ?

1 REPLY 1

ChadTurner
DynaMight Legend
DynaMight Legend

@giger85 have you gotten any clarity on this? if so, could you please share with us your findings?

-Chad

Featured Posts