def inject_header()

in aws_xray_sdk/ext/boto_utils.py [0:0]


def inject_header(wrapped, instance, args, kwargs):
    # skip tracing for SDK built-in centralized sampling pollers
    url = args[0].url
    if 'GetCentralizedSamplingRules' in url or 'SamplingTargets' in url:
        return wrapped(*args, **kwargs)

    headers = args[0].headers
    # skip if the recorder is unable to open the subsegment
    # for the outgoing request
    subsegment = None
    try:
        subsegment = xray_recorder.current_subsegment()
    except SegmentNotFoundException:
        pass
    if subsegment:
        inject_trace_header(headers, subsegment)
    return wrapped(*args, **kwargs)