Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create SDK extension format for AWS SDK Extension #1189

Closed

Conversation

NathanielRN
Copy link
Contributor

Description

Right now, you can configure OTel to trace with custom Resource definitions, and (soon) will be able to trace with custom IdsGenerator implementations.

In addition to the defaults provided by the OTel SDK, this PR hopes to add a format to include SDK Extensions. SDK Extensions are similar to instrumentation/ packages in that they are optional packages that a customer can pull in to provide additional functionality. The sdk-extension/ packages would each individually provide a set of pre-built interface implementations to run OTel "differently". An OTel which runs "differently" can now support tracing in a necessarily specific way, which if traced under the default implementations would provide traces that were undesirable.

Specifically, this is a solution for services like the AWS X-Ray backend service, which requires IDs to be generated in the AWS X-Ray Trace ID Format. Having this opentelemetry-sdk-extension-aws package makes it easy to import the necessary AWSXrayIdsGenerator class and create a TracerProvider which sends IDs in the correct format right at the start. (Which will be important for downstream propagation and finally arrival at the X-Ray backend service).

The goal is to be able to do something like the following:

pip install opentelemetry-sdk-extension-aws

and subsequently,

from opentelemetry import trace
from opentelemetry.sdk.extension.aws.trace import AWSXrayIdsGenerator

trace.set_tracer_provider(TracerProvider(ids_generator=AWSXrayIdsGenerator()))
tracer = trace.get_tracer(__name__)

if __name__ == '__main__':
    with tracer.start_span('my_first_span', kind=SpanKind.SERVER):
        with tracer.start_span('my_second_span', parent=trace.get_current_span(), kind=SpanKind.SERVER):
            print('Hello, world!')

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

The following tests also implicity test that importing an sdk-extension/ package works properly.

  • Added unit test to test that generated of AWS X-Ray IDs is valid
  • Added unit test to test that generated AWS X-Ray IDs correctly use 24 bits to record the time the trace ID was created (which must be within the last 30 days)

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@NathanielRN NathanielRN force-pushed the sdk-extension-aws branch 2 times, most recently from 88ec892 to 64d4692 Compare October 1, 2020 07:35
@NathanielRN
Copy link
Contributor Author

Need to confirm that the new tests under sdk-extension/ run as part of the test suite.

@NathanielRN
Copy link
Contributor Author

Closing in favor of putting this in the Contrib repo: NathanielRN/opentelemetry-python-contrib#1

srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
@NathanielRN NathanielRN deleted the sdk-extension-aws branch November 3, 2020 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant