Distributed Tracing ¶
As a microservice, IDLive Doc Server supports providing correlation ID and tracing ID fields in request header which can be use for distributed tracing.
Here's an example of a liveness check request done using curl
utility providing the session-id
and correlation-id
headers:
$ (echo -n '{
"image": "'; base64 image.png; echo '",
"pipelines": [
{"pipeline_name": "default-sr"}
]
}') | \
curl -H "x-api-key: <API-key>" \
-H "Content-Type: application/json" \
-H "session-id: 123456" \
-H "correlation-id:98765" \
-X POST -d @- https://idlivedoc-rest-api.idrnd.net/check_liveness
Here's how it will look in the container's logs:
2024-04-23T11:04:47.108Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-1] [][]o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 2024-04-23T11:04:48.006Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-3] '[123456][98765] 'net.idrnd.idlivedoc.web.LivenessApi : Liveness check composition performed for 29495219-3fb4-44df-893d-ccc5b13f10c2 file, ibis-sr pipeline, LivenessCheckOptions{calibration=SOFT, errorsToIgnore=[]} options with LivenessResponse{score=5.171455, probability=0.9999796, quality_warnings=[]} in 551 ms 2024-04-23T11:04:48.012Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-3] '[123456][98765] 'net.idrnd.idlivedoc.web.LivenessApi : Liveness check composition performed for 29495219-3fb4-44df-893d-ccc5b13f10c2 file, hawk-sd pipeline, LivenessCheckOptions{calibration=REGULAR, errorsToIgnore=[]} options with LivenessResponse{score=5.4988723, probability=0.99893844, quality_warnings=[]} in 551 ms 2024-04-23T11:04:48.012Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-3] '[123456][98765] 'net.idrnd.idlivedoc.web.LivenessApi : Liveness check composition performed for 29495219-3fb4-44df-893d-ccc5b13f10c2 file, ibis-sr-soft pipeline, LivenessCheckOptions{calibration=REGULAR, errorsToIgnore=[]} options with LivenessResponse{score=3.08952, probability=0.999998, quality_warnings=[]} in 551 ms
The output format of IDs can be changed by setting the LOGGING_PATTERN_CORRELATION
environment variable, e.g --env LOGGING_PATTERN_CORRELATION='[session-id=%X{session-id:-}, correlation-id=%X{correlation-id:-}] '
:
2024-04-23T10:53:50.353Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-1] [session-id=, correlation-id=] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 2024-04-23T10:53:51.264Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-3] '[session-id=123456, correlation-id=98765] 'net.idrnd.idlivedoc.web.LivenessApi : Liveness check composition performed for 3e816551-244c-490e-811f-4adb3fac7d3d file, ibis-sr pipeline, LivenessCheckOptions{calibration=SOFT, errorsToIgnore=[]} options with LivenessResponse{score=5.171455, probability=0.9999796, quality_warnings=[]} in 570 ms 2024-04-23T10:53:51.274Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-3] '[session-id=123456, correlation-id=98765] 'net.idrnd.idlivedoc.web.LivenessApi : Liveness check composition performed for 3e816551-244c-490e-811f-4adb3fac7d3d file, hawk-sd pipeline, LivenessCheckOptions{calibration=REGULAR, errorsToIgnore=[]} options with LivenessResponse{score=5.4988723, probability=0.99893844, quality_warnings=[]} in 570 ms 2024-04-23T10:53:51.275Z INFO 1 --- [IDLive Doc Server] [nio-8080-exec-3] '[session-id=123456, correlation-id=98765] 'net.idrnd.idlivedoc.web.LivenessApi : Liveness check composition performed for 3e816551-244c-490e-811f-4adb3fac7d3d file, ibis-sr-soft pipeline, LivenessCheckOptions{calibration=REGULAR, errorsToIgnore=[]} options with LivenessResponse{score=3.08952, probability=0.999998, quality_warnings=[]} in 570 ms