Skip to content

Add OpenCensus trace bridge/shim - #3210

Merged
srikanthccv merged 5 commits into
open-telemetry:mainfrom
aabmass:opencensus-trace-shim
Mar 17, 2023
Merged

Add OpenCensus trace bridge/shim#3210
srikanthccv merged 5 commits into
open-telemetry:mainfrom
aabmass:opencensus-trace-shim

Conversation

@aabmass

@aabmass aabmass commented Mar 3, 2023

Copy link
Copy Markdown
Member

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 force-pushed the opencensus-trace-shim branch from eeddf41 to 1097e70 Compare March 3, 2023 06:56
@aabmass
aabmass marked this pull request as ready for review March 3, 2023 06:56
@aabmass
aabmass requested a review from a team March 3, 2023 06:56
Comment thread shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/_patch.py Outdated
Comment thread shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/_patch.py Outdated
@aabmass aabmass mentioned this pull request Mar 6, 2023
6 tasks
@aabmass

aabmass commented Mar 7, 2023

Copy link
Copy Markdown
Member Author

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.

@jsuereth jsuereth left a comment

Copy link
Copy Markdown

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

aabmass commented Mar 15, 2023

Copy link
Copy Markdown
Member Author

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

Correct. I updated #3203 to track it.

@srikanthccv

Copy link
Copy Markdown
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.

6 participants