Workable / orka

8 stars 2 forks source link

Improved Logging and Header Propagation in Orka #339

Closed nikostoulas closed 11 months ago

nikostoulas commented 11 months ago

Description

The main focus is on improving logging and header propagation. Non json logger is improved to log all propagated headers. Messages in RabbitMQ by default now propagated all headers. Configuration is updated and istioTraceContextHeaders is merged with headerPropagation into a new more generic property: propagatedHeaders This is not backwards compatible so a major release will need to follow when merging this pr.

Best reviewed commit by commit.

Aoart from propagated headers 3 new headers are introduced: x-depth -> increased by 1 every time headers are propagated (e.g. to a rabbitmq publish or http call) x-parent-id -> is the previous traceHeaderName id. The new traceHeaderName id is a new random one and this happens every 2 hops x-initiator-id -> when a x-parent-id id replaced the initial traceHeaderName is added in the context here so that we can search with the initial id and find all changes

Changes

Jira tickets

Before

Screenshot 2023-10-03 at 3 24 04 PM

Performance

Screenshot 2023-10-03 at 7 21 27 PM

After

Screenshot 2023-10-03 at 3 27 04 PM

Performance

Screenshot 2023-10-03 at 7 22 47 PM

Example tests were run: npx nodemon examples/request-context-example/app.js

Way of running performance tests: ab -k -n 100000 -c 1 -H 'x-orka-request-id: bar' localhost:2121/log

Performance impact is not insignificant but would be negligible part of an http endpoint that accesses IO operations (e.g. database/ network)

manoskouvarakis commented 11 months ago

@nikostoulas Should we maybe add the breaking changes on readme or it will be a part of another PR?

nikostoulas commented 11 months ago

@nikostoulas Should we maybe add the breaking changes on readme or it will be a part of another PR?

You mean the orka's version changelog? Yes it will be part of another one