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

Define OTLP protocol driver registration mechanism #3722

Closed
wants to merge 8 commits into from

Conversation

pellared
Copy link
Member

@pellared pellared commented Oct 17, 2023

Fixes #3721

I do not see it as a breaking change. Reasoning here.

@pellared pellared changed the title OTLP exporter: Describe protocol registration mechanism OTLP exporter: define protocol driver registration mechanism Oct 17, 2023
@pellared
Copy link
Member Author

@yurishkuro Do you think such changes would make the specification better? It is a draft because I would first would like you to review it.

@pellared pellared changed the title OTLP exporter: define protocol driver registration mechanism Define OTLP protocol driver registration mechanism Oct 17, 2023
@pellared
Copy link
Member Author

Based on @yurishkuro initial review I think this it is ready for wider feedback. "Undrafting"

@pellared pellared marked this pull request as ready for review October 17, 2023 20:24
@pellared pellared requested review from a team October 17, 2023 20:24
yurishkuro
yurishkuro previously approved these changes Oct 18, 2023
@tigrannajaryan
Copy link
Member

Important: this is a "Stable" document. The proposed changes seem to be breaking from end user perspective. The now must do something they previously were not required (register a "driver"). Breaking changes to "Stable" documents are not allowed. Maybe see if you can rephrase it so that it is not a breaking change.

Minor: I am not sure we use the term "driver" anywhere else. Do we need to introduce it? Can we use "implementation" instead?

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

Blocking since I think it is a breaking change. Will lift the block once we clarify it is not breaking.

@pellared
Copy link
Member Author

pellared commented Oct 18, 2023

@tigrannajaryan

Important: this is a "Stable" document. The proposed changes seem to be breaking from end user perspective. The now must do something they previously were not required (register a "driver"). Breaking changes to "Stable" documents are not allowed. Maybe see if you can rephrase it so that it is not a breaking change.

How is it breaking? See #3722 (comment).

Maybe this would be better: #3722 (comment)

Minor: I am not sure we use the term "driver" anywhere else. Do we need to introduce it? Can we use "implementation" instead?

I can do it, but I think a "driver" is a good term (abstraction) for it. We have a driver for a protocol like we have database drivers or hardware drivers.

If no configuration is provided the default transport SHOULD be `http/protobuf`
unless SDKs have good reasons to choose `grpc` as the default (e.g. for backward
compatibility reasons when `grpc` was already the default in a stable SDK
release).

The exporter SHOULD NOT depend on any transport protocol driver.
The exporter SHOULD have a mechanism to register transport protocol driver.
The caller SHOULD explicitly register the driver for the default transport protocol if one wants to support it.
Copy link
Member Author

@pellared pellared Oct 18, 2023

Choose a reason for hiding this comment

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

@tigrannajaryan @yurishkuro would this be better?

Suggested change
The caller SHOULD explicitly register the driver for the default transport protocol if one wants to support it.
By default, no driver SHOULD be registered. The exporter SHOULD require the caller to explicitly register the driver for the default transport protocol if the caller wants to support it.

@pellared
Copy link
Member Author

Blocking since I think it is a breaking change. Will lift the block once we clarify it is not breaking.

@tigrannajaryan, I updated the description and gave a reference to a comment where I explain why I do not see it as a breaking change.

@tigrannajaryan
Copy link
Member

In a stable SDK release, the properties described above can be different for backward compatibility reasons.

This assumes it is OK to make breaking changes to the "Stable" spec as long as we don't require stable SDKs to implement them. I don't think we discussed in the past and I am not sure we want to allow it.

@open-telemetry/specs-approvers I think we need to have a position on this: are breaking changes to the spec's "Stable" document allowed provided that we don't require stable SDK implementations to adopt such changes? My first thought is that this should not be allowed and a slippery slope, but I think it is worth discussing.

If we allow it then possibly we need to:

  • Mark every spec change with a version number in which it was introduced.
  • Label every SDK implementation with the version number of the spec it implements.

This may be doable but introduces complexity which I am not sure we want.

There are probably also other approaches to handle such changes.

Thoughts?

@pellared
Copy link
Member Author

pellared commented Oct 18, 2023

In a stable SDK release, the properties described above can be different for backward compatibility reasons.

This assumes it is OK to make breaking changes to the "Stable" spec as long as we don't require stable SDKs to implement them. I don't think we discussed in the past and I am not sure we want to allow it.

Just for reference I think it already happened before (but it was not clearly described). See #3717.

Label every SDK implementation with the version number of the spec it implements.

Whatever the decision is. I think it would be a good practice anyway as I have found out that SDKs are not always keeping up with the specification.

I think the specification should recommend some design decisions that are based on "lessons learned" from existing SDKs to make new implementations better if the differences between "old" and "new" are reasonable and worth adoption in new implementations.

Also it is worth to notice that, in my opinion, most SDKs do not follow the OTLP exporter specification as I described under #3721

Most of these languages have additional (separate) "configurator" components that enable the creation of exporters selected via environmental variables (for instance, OTEL_TRACES_EXPORTER and OTEL_EXPORTER_OTLP_PROTOCOL).

The specification says that it is the exporter that has to support OTEL_EXPORTER_OTLP_PROTOCOL.

EDIT: I would say that only OTLP exporters in Erlang and Rust have a potential to be compliant with the current specification as these are the only languages that support all OTEL_EXPORTER_OTLP*PROTOCOL env vars directly in the exporter. It is possible that other languages could even add the "driver" implementation as described in the PR without introducing a breaking change. This is something I want to do in Go as part of open-telemetry/opentelemetry-go#4641 and open-telemetry/opentelemetry-go#4642.

@carlosalberto
Copy link
Contributor

Just want to voice that a few SIGs offer this as separate artifacts/packages, e.g. oltp/http and otlp/grpc, and these environment variables make more sense for agents specifically, such as the Java or DotNet, which include both transports. Other SIGs only support one of them even, I think? (cc @dyladan) . Let's present this in the next maintainers call.

@dyladan
Copy link
Member

dyladan commented Oct 18, 2023

JS provides gRPC, http/protobuf, and http/JSON for all signals. We were the first and may still be the only, aside from the collector, to support all 3 "drivers". Each signal/driver pair has a separate package that must be installed if you want to use it in order to reduce dependencies.

@tigrannajaryan
Copy link
Member

Just for reference I think it already happened before (but it was not clearly described). See #3717.

Are you referring to #3719 ?

I don't think that one is a breaking change. Looks like a clarification of what "still supported" means.

@yurishkuro
Copy link
Member

@pellared this was discussed at the TC meeting. The consensus was that we do not want that specific wording that allows stable SDKs to opt-out of the requirement, as this would lead to bifurcation of capabilities in different SDKs in the long term and set a negative precedent. Instead, it was noted that the current phrasing of the spec is intentionally vague such that it does not require supporting every flavor that can be specified in the config. As an example, Zipkin/Jaeger exporters were cited which are required to be supported but not so that they always have to be statically linked. The proposal is to find a phrasing that double-clicks into this gray area to clarify that SDKs are allowed to implement support for different capabilities via opt-in model (as some already do), but are not required to do so.

@pellared
Copy link
Member Author

I am changing this PR to a draft.

@pellared
Copy link
Member Author

Closing in favor of #3730

@pellared pellared closed this Oct 25, 2023
@pellared pellared deleted the patch-4 branch October 25, 2023 15:05
@pellared pellared restored the patch-4 branch October 25, 2023 15:05
carlosalberto pushed a commit that referenced this pull request Oct 30, 2023
…er, SDK, or separate component (#3730)

Fixes
#3721

## Why

The Go SIG is working towards stabilizing the OTLP metrics exporter.

The Go SIG would prefer to manage the exporter environment variables
through a distinct package:
https://pkg.go.dev/go.opentelemetry.io/contrib/exporters/autoexport.
This approach is akin to [Java
Autoconfigure](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure).
The rationale behind this decision is as follows:

1. If users aim to utilize the `OTEL_EXPORTER_OTLP_PROTOCOL` and
`OTEL_TRACES_EXPORTER`, we aim to support all the values documented in
the specification. We want to ensure that users are not prone to
encountering runtime errors if a protocol driver hasn't been registered
in the code.
2. Simultaneously, we wish to avoid applications to depend on all
exporter implementations defined in the specification.

Currently, it is not clear of such design is in compliance with the
specification.

## What

Define that **configuration options MAY be implemented by exporter, SDK,
or separate component**.

While this PR may be seen as a breaking change, because of the way how
the languages adopted the specification I would say that this is a
"clarification" or "adopting to the reality".

Here is how different languages currently implement the OTLP
configuration options.

### .NET

Configuration options implemented by exporter.
Side note: Per-signal endpoint configuration options are not
implemented.

Source code: 
-
https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol

### C++

Most configuration options implemented by exporter.
However, the `*_PROTOCOL` env vars are not implemented at all. See:
open-telemetry/opentelemetry-cpp#971.

Source code: 
-
https://github.com/open-telemetry/opentelemetry-cpp/tree/main/exporters/otlp

### Erlang

Configuration options implemented by exporter.

Source code:
-
https://github.com/open-telemetry/opentelemetry-erlang/tree/main/apps/opentelemetry_exporter

### Go

Most configuration options implemented by exporter.
However, the `*_PROTOCOL` env vars are implemented by a separate
component (autoexport)

Source code (package docs):
- https://pkg.go.dev/go.opentelemetry.io/contrib/exporters/autoexport
- https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace

### Java

Configuration options implemented by an autoconfigure component.

Source code:
-
https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure
-
https://github.com/open-telemetry/opentelemetry-java/tree/main/exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp

### JavaScript

Most configuration options implemented by exporter.
However, the `*_PROTOCOL` env vars are implemented by a separate
component (opentelemetry-sdk-node)

Source code:
-
https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node
-
https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-trace-otlp-http

### PHP

Configuration options implemented by exporter.

Source code:
-
https://github.com/open-telemetry/opentelemetry-php/tree/main/src/Contrib/Otlp

### Python

Most configuration options implemented by exporter.
However, the `*_PROTOCOL` env vars are implemented by the SDK.

Source code:
-
https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
-
https://github.com/open-telemetry/opentelemetry-python/tree/main/exporter

### Ruby

Most configuration options implemented by exporter.
However, the `*_PROTOCOL` env vars are implemented by the SDK.

Source code:
-
https://github.com/open-telemetry/opentelemetry-ruby/blob/main/sdk/lib/opentelemetry/sdk/configurator.rb
-
https://github.com/open-telemetry/opentelemetry-ruby/tree/main/exporter/otlp-http

### Rust

Configuration options implemented by exporter.

Source code:
-
https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-otlp

### Swift

Env vars not supported.

### Previous work and discussions

-
#3721
-
#3722
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.

Clarify if the OTLP exporter has to support all protocol related env vars
6 participants