Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

1.0.0b2

Compare
Choose a tag to compare
@owais owais released this 09 Sep 18:20
· 28 commits to master since this release

Features

Propagating trace context to outgoing requests or lambda response

The library ships a helper function to inject tracing context headers into a dictionary like object. The function accepts two arguments. First argument must be a dictionary like object that the trace context is injected into. The second argument is optional and must be a OpenTracing span context. If one is not provided, the function uses the currently active span. Example:

Before

import signalfx_lambda

@signalfx_lambda.is_traced()
def handler(event, context):
    request = urllib.request.Request('http://some-service', headers={...})
    response = urllib.request.urlopen(request)

    # handle response

After

import signalfx_lambda

@signalfx_lambda.is_traced()
def handler(event, context):
    headers = {...}

    # inject trace context into the headers dictionary
    signalfx_lambda.tracing.inject(headers)

    request = urllib.request.Request('http://some-service', headers=headers)
    response = urllib.request.urlopen(request)

    # handle response