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

Add OpenCensus trace bridge/shim #3210

Merged
merged 5 commits into from
Mar 17, 2023

Conversation

aabmass
Copy link
Member

@aabmass aabmass commented Mar 3, 2023

Description

Implements the OpenCensus tracing shim/bridge. See issue for more details. For now, users must import and call install_shim() for the shim to take effect.

Part of #3203

Caveats

  • SpanKind and Links cannot be translated with the shim. OpenCensus Tracer.start_span() only accepts span name, while OTel only allows setting those properties in start_span(); there is no way to set them after the fact with a pure API bridge.
  • This PR does not bridge Context APIs. This will be needed for instrumentations which set the span context from extracted propagation headers.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added many tests for mapping logic and interaction with OpenTelemetry. There are test for the "OpenTelemetry sandwich" problem, where OpenCensus and OpenTelemetry instrumentation should interoperate.

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • Yes. - Link to PR:

  • No.

Checklist:

@aabmass aabmass changed the title Implementation of OpenCensus trace bridge/shim Add OpenCensus trace bridge/shim Mar 3, 2023
@aabmass aabmass marked this pull request as ready for review March 3, 2023 06:56
@aabmass aabmass requested a review from a team as a code owner March 3, 2023 06:56
@aabmass aabmass mentioned this pull request Mar 6, 2023
6 tasks
@aabmass
Copy link
Member Author

aabmass commented Mar 7, 2023

Thanks for reviews everyone. I just realized we probably need to bridge the Context APIs as well for instrumentations which extract a Context with propagators e.g. opencensus-ext-flask.

I'll work on this in a separate PR and track it in the issue.

Copy link

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looking at this for OC compatibility compliance.

Tests cover everything I'd expect to see. Also to confirm, this does NOT include the bridge for propagation right?

@srikanthccv srikanthccv requested review from jeremydvoss and lzchen and removed request for jeremydvoss March 14, 2023 18:29
@aabmass
Copy link
Member Author

aabmass commented Mar 15, 2023

Also to confirm, this does NOT include the bridge for propagation right?

Correct. I updated #3203 to track it.

@srikanthccv
Copy link
Member

@jeremydvoss PTAL.

@srikanthccv srikanthccv enabled auto-merge (squash) March 17, 2023 05:25
@srikanthccv srikanthccv merged commit f40be51 into open-telemetry:main Mar 17, 2023
@aabmass aabmass deleted the opencensus-trace-shim branch March 17, 2023 15:12
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

6 participants