Gets the trace ID from the header.
Ensures the command message has a trace ID, using its own ID if none exists.
Adds a trace ID to the header.