spring-cloud-sleuth icon indicating copy to clipboard operation
spring-cloud-sleuth copied to clipboard

Is it possible to rename traceId and spanId to custom names

Open achuou1 opened this issue 4 years ago • 4 comments

In the microservice system we have in production, we call our correlation-Id transactionId . We are planning to use spring-sleuth. Is it possible to rename traceId as transactionId?

achuou1 avatar May 23 '22 10:05 achuou1

What do you mean rename? Rename what exactly?

marcingrzejszczak avatar May 23 '22 10:05 marcingrzejszczak

Can you please answer all the required questions described in the issue template? For your convenience let me paste it here

Describe the bug Please provide details of the problem, including the version of Spring Cloud that you are using.

Sample If possible, please provide a test case or sample application that reproduces the problem. This makes it much easier for us to diagnose the problem and to verify that we have fixed it.

marcingrzejszczak avatar May 23 '22 10:05 marcingrzejszczak

Spring-boot: 2.6.7 Spring-cloud-sleuth: 3.1.2

I see the traceId and spanId in the log as below which is not according to the standards we have in our organization. So my question is if it is possible to rename traceId in the log to something else.

(traceId=39713c83aa7a6bae, spanId=39713c83aa7a6bae)

To

(transactionId=39713c83aa7a6bae, spanId=39713c83aa7a6bae)

achuou1 avatar May 23 '22 10:05 achuou1

I have no idea who and how sets it in your logs. You can define the logging format in whatever way you please

marcingrzejszczak avatar May 23 '22 12:05 marcingrzejszczak