After adding micrometer to the project it should start adding to log line: trace_id and span_id. These fields are goal. Since they will reflect a unique request id that finally help us do a log correlation.
Logging appender must be aligned with tracing properties:
trace-id=%mdc{traceId} span-id=%mdc{spanId} %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n
Required appenders:
STDOUT (default)
Required loggers:
spring web (be default on INFO)
project reactor (be default on INFO)
JDBC Postgres (be default on INFO)
com.iprody.inquiry (be default on INFO)
Motivation
When we pass a request through services, then we will be able to track this request from the very beginning till the end among all service it passed. It will help do analysis and error investigation, especially in distributed systems' world.
So that,
logging configured and applied
logs contain trace_id and span_id
logs contain trace_id, span_id with a respective autogenerated values
test coverage for distributed tracing (trace_id, span_id)
Prerequisites Any project must use logging and tracing for tracking a passing request over services.
For distributed tracing we will use Micrometer Tracing. Highly recommended to get through its Glossary.
After adding micrometer to the project it should start adding to log line: trace_id and span_id. These fields are goal. Since they will reflect a unique request id that finally help us do a log correlation.
A good simple example here.
Logging appender must be aligned with tracing properties: trace-id=%mdc{traceId} span-id=%mdc{spanId} %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp- %msg%n
Required appenders:
Required loggers:
Motivation When we pass a request through services, then we will be able to track this request from the very beginning till the end among all service it passed. It will help do analysis and error investigation, especially in distributed systems' world.
So that,