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

Opencensus compatibility specification #1332

Merged
merged 14 commits into from
Feb 22, 2021

Conversation

jsuereth
Copy link
Contributor

Fixes #766

Changes

Provide a specification of OpenCensus migration to open telemetry.

  • Specifies shims for TRACE that can be implemented per-langauage.
  • Specifies overarching goals for migration
  • ONLY accounts for specification<->specification issues and calls out possible incompatibility issues for unspecified behavior.
  • Does not specify Metric compatibility as that will wait for Metrics to be declared GA / stable.

A few notes for discussion:

  1. This spec calls for semantic-name mapping so that users of an OpenCensus bridge will get OpenTelemetry-looking metrics even from OpenCensus instrumented libraries. The expectation is this eases the migration from OC => OTel, but that labels may "break" from OC-only implementation, and won't break as OC instrumented lirbaries are migrated to OTel.
  2. This attempts to identify all known incompatibilites we've found between OpenCensus + OpenTelemetry APIs from the Java + Go implementations, as well as directly comparing the Specifications. . Unfortunately, a lot of incompatibilities are due to unspecified API, SDK or other behaviors, and cannot be (fully) addressed in this Specification. Instead a set of principles for how to make tradeoffs are proposed up-front for implementors of OpenCensus-bridge components.
  3. The specification is expected to evolve with known incompatibilities as needed, in an attempt to keep language-specific design decisions around unspecified behavior as uniform as possible.

@jsuereth jsuereth requested review from a team January 11, 2021 19:27
specification/compatibility/opencensus.md Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Show resolved Hide resolved
@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 22, 2021
Base automatically changed from master to main January 27, 2021 21:16
@jsuereth jsuereth changed the title Wip opencensus compatibility Opencensus compatibility specification Jan 28, 2021
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
@jsuereth
Copy link
Contributor Author

@anuraaga Looks like i had a dropped commit when rebasing that lost all the committed suggestions from upstream, trying to recollect those now.

@jsuereth jsuereth mentioned this pull request Jan 29, 2021
Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Just a few smaller points but this seems to be good, thanks!

specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
This adapter MUST use an OpenTelemetry `TextMapPropagator` to implement the
OpenCensus `TextFormat`.

This adapter SHOULD use configured OpenTelemetry `TextMapPropagator` on the
Copy link
Contributor

@anuraaga anuraaga Jan 30, 2021

Choose a reason for hiding this comment

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

Just checking, is this something Java can't do but other languages may? For example, we have explicit extension points for B3 and W3C

https://github.com/open-telemetry/opentelemetry-java/blob/main/opencensus-shim/src/main/java/io/opentelemetry/opencensusshim/OpenTelemetryPropagationComponentImpl.java#L28

So it seems like it wouldn't ever make sense to use the OTel configured propagator instead of directly exposing the correct implementations for this sort of interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can clarify this. I actually wanted to specify it so that OpenCensus shim will use the globallly configured propogator (see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/api-propagators.md#get-global-propagator). Right now the implementation DOES NOT do this, but I'd like to fix it. Happy to hear thoughts/.copncerns.

My main reasoning for this shift from the Java impl is because I'd like to give OTel configuration the ability to control the impl of the propogator. One of the "principles" here is when adopting the shim, OTEL configuration should override OC, always.

Copy link
Member

Choose a reason for hiding this comment

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

Probably you may want to state this principal somewhere.

This adapter SHOULD use configured OpenTelemetry `TextMapPropagator` on the
OpenTelemetry `TraceProvider` for text format propagation.

This adapter MUST provide a default `W3CTraceContextPropagator` in lieu of a
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what this sentence means. Is it the same as my above point, where we actually don't want to use the configured provider? More concretely, this line of code in Java?

https://github.com/open-telemetry/opentelemetry-java/blob/main/opencensus-shim/src/main/java/io/opentelemetry/opencensusshim/OpenTelemetryPropagationComponentImpl.java#L34

Copy link
Contributor Author

Choose a reason for hiding this comment

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

NO, this is related to selecting the W3C propagatoor off the global (see: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/api-propagators.md#get-global-propagator) and if there is none available, providing a default.

I'll take a stab at rewording this, need to think about a better phrasing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Take look at the rewording, hopefully it's more clear.

@github-actions github-actions bot removed the Stale label Jan 30, 2021
Bogdan Drutu and others added 3 commits February 5, 2021 18:36
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Some minor comments, LGTM

specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
specification/compatibility/opencensus.md Outdated Show resolved Hide resolved
Comment on lines +126 to +128
Some OpenCensus APIs support "debug" and "defer" tracing flags in additon to
"sampled". In this case, the OpenCensus bridge will do its best to support
and translate unspecified flags into the closest OpenTelemetry equivalent.
Copy link
Member

Choose a reason for hiding this comment

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

facepalm :)))

Copy link
Member

Choose a reason for hiding this comment

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

This adapter MUST use an OpenTelemetry `TextMapPropagator` to implement the
OpenCensus `TextFormat`.

This adapter SHOULD use configured OpenTelemetry `TextMapPropagator` on the
Copy link
Member

Choose a reason for hiding this comment

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

Probably you may want to state this principal somewhere.

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Please add a status

@jsuereth
Copy link
Contributor Author

@bogdandrutu for "status" do you mean the stable, experimental etc? I'll go look up the rules and annotate sections accordingly.

@bogdandrutu
Copy link
Member

@jsuereth yes what we call the document status (e.g. experimental, stable, etc.)

@bogdandrutu
Copy link
Member

@jsuereth ping :)

1 similar comment
@bogdandrutu
Copy link
Member

@jsuereth ping :)

@jsuereth
Copy link
Contributor Author

@bogdandrutu Will get to this later today/tomorrow. Sorry for delays, had a lot of urgent things / Scala.Love conference prep to do last week.

@jsuereth
Copy link
Contributor Author

@bogdandrutu Ok, so I updated stability guarantees. Here's the plan:

  • This document declares "Trace" as Experimental, but "feature frozen". We won't do any additional mapping beyond what's outlined in this document.
  • If we discover more issues in "Trace" as we implement (or adapt) the compatibility shims in languages, we have room to fix the specification.
  • Once we have N languages implemented against the specification we mark "Trace" as "Stable, Feature Freeze".
    • At least ONE dynamic language (Python, Node, etc. missing today)
    • At least ONE statically typed language (Java, Go, C#)
    • Note: Today we have shim prototypes in Go + Java
  • We follow with Metric definition in similar fashion once metrics are stable in the OTEL spec.

Sound reasonable?

#### Known Incompatibilities

Below are listed known incompatibilities between OpenTelemetry and OpenCensus
specifications. Applications leveraging unspecified behavior from OpenCensus
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
specifications. Applications leveraging unspecified behavior from OpenCensus
specifications. Applications leveraging unspecified behavior from OpenCensus

Copy link
Member

Choose a reason for hiding this comment

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

There are other places in the doc that also have 3 SPCs.

details of the OpenTelemetry SDK.

More specifically, the intention is to allow OpenCensus instrumentation to be
recorded using OpenTelemetry. This Shim Layer MUST NOT publicly expose any
Copy link
Member

Choose a reason for hiding this comment

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

Might need to clarify where the shim should go - in OpenTelemetry project or OpenCensus project.

https://github.com/open-telemetry/opentelemetry-specification/blob/9047c91412d3d4b7f28b0f7346d8c5034b509849/specification/versioning-and-stability.md#a-note-on-replacing-signals

OpenTelemetry already supports two tracing APIs: OpenTelemetry and OpenTracing. We invented a new tracing API, but continue to support the old one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do. In practice, we've actually released new OpenCensus versions that expose hooks for the shim, and the shim lives on the OTEL side (as that's where you configure your pipeline).

As an FYI for you, I expect we might have to do something similar in Python/JavaScript if we run into similar issues as what we found in Go/Java.

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM as "Experimental".

@bogdandrutu
Copy link
Member

@jsuereth please fix the build 👯

@jsuereth
Copy link
Contributor Author

@bogdandrutu fixed :) Sorry, for some reason can't run that check locally.

@bogdandrutu bogdandrutu merged commit 0a0ef44 into open-telemetry:main Feb 22, 2021
@jsuereth jsuereth deleted the wip-opencensus-compatibility branch February 22, 2021 22:38
Copy link
Contributor

@jmacd jmacd left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Add a section on compatibility with OpenCensus to Compatibility doc
5 participants