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

[BLOCKED] Create SDK extension format for AWS SDK Extension #1

Open
wants to merge 524 commits into
base: master
Choose a base branch
from

Conversation

NathanielRN
Copy link
Owner

Description

Right now, you can configure OTel to trace with custom Resource definitions, and can trace with custom IdsGenerator implementations.

This PR provides an SDK Extension on the default provided by the OTel SDK.

The exact setup for importing as an extension of opentelemetry.sdk.* is being discussed in this issue.

Please read my comment on the issue to see why an extension like this would be useful for the users of OpenTelemetry Python. It mentions that Java and .NET already do provide extension on the SDK like this.

This format provides a template for future backend services to provide useful SDK Extensions that are very closely related to OpenTelemetry under the opentelemetry.sdk.extension.* namespace.

Specifically, this PR provides all the components a user needs to quickly configure their OpenTelemetry tracing to trace with the AWS X-Ray backend service. It provides:

  • ID generation to be in the AWS X-Ray Trace ID Format.
  • Propagation
  • Lamabda Instrumentation (In near the future)
  • AWS Instrumentation (In the near future)
  • Pre-built Resources (In the near future)
  • An X-Ray exporter (In the near future - it will probably live here but could live in the exporters/ directory)

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 arrive at the X-Ray backend service).

An Example is like this:

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!')

Finally, placing vendor-specific propagators in the Contrib repo has already been discussed on the specification.

In this PR, the specification was updated to say that vendor specific implementations can be supported by the vendors or by the OpenTelemetry community. The rationale given is:

  • Propagators are small pieces of code and their functionality is often publicly
    documented (unlike exporters).
  • People will often need to use propagators that are not specific to their
    tracing or metrics vendor. For example, customers of tracing vendor may still
    want to use an Cloud vendor-specific propagator for requests to the services
    of this cloud vendor.
  • Only a small number of propagators will need to exist, and this number will
    shrink as vendors and users shift to W3C TraceContext.

According to this comment, the idea that vendor specific propagators could be distributed by vendors or by the OpenTelemetry community was reinforced.

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)
  • Add unit test to test extract method of AWSXRayFormat propagator
  • Add unit test to test inject method of AWSXRayFormat propagator

Checklist:

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

@NathanielRN
Copy link
Owner Author

I just put this PR up to have something to point to in discussions we are having regarding the subject of extending the SDK!

This PR is BLOCKED and waiting for some progress on open-telemetry/opentelemetry-python#1233 first.

@NathanielRN NathanielRN changed the title Create SDK extension format for AWS SDK Extension [BLOCKED] Create SDK extension format for AWS SDK Extension Oct 14, 2020
@NathanielRN NathanielRN reopened this Oct 15, 2020
alrex and others added 25 commits October 21, 2020 21:55
* dropping support for python 3.4
* updating changelogs and version to 0.13b0
…text (#1146)

Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
* dropping support for python 3.4
* updating changelogs and version to 0.13b0
This uses the OpenTelemetry context management mechanism to store a
ScopeShim object in order to make active return the same object as the
one returned by start_active_span.
…between OpenTelemetry and OpenTracing spans (#924)
Co-authored-by: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
* dropping support for python 3.4
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