(Optional) Override Correlation Header Method
Automatic instrumentation uses the MonitoredRequestStreamHandler
class,
which provides default logic to find a correlation header.
If you need to use a custom transport mechanism for your correlation header, you must
override the tracer’s default logic in the getCorrelationHeader()
method.
Insert your custom logic to find the inbound correlation header so the tracer can return the
inbound header.
The code snippet demonstrates how to override the getCorrelationHeader()
method:
//(Optional)Override getCorrelationHeader().
//Only override if the tracer will not be able to find a correlation header using its pre-configured logic.
@Override
public String getCorrelationHeader(InputStream input, Context context) {
//Logic to find the inbound header goes here, so the inbound header can be returned
return "correlation-header";