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

update opentelemetry SDK to 1.11.2 #138

Merged
merged 7 commits into from
Jan 26, 2023
Merged

Conversation

tobert
Copy link
Collaborator

@tobert tobert commented Jan 23, 2023

Updates the OTel SDK to 1.11.2.

This upgrade forced a couple changes that need thinking through.

  • minimum go version is now 1.18
  • envvars used for config are now cleared after reading them
    • this prevents the OTel SDK from reading them directly so we have more control
    • added grpc:// URI for deterministically asking for gRPC in an endpoint config (not in the spec)
  • otel-cli does NOT support gRPC via http:// or https:// URIs (spec allows this, otel-cli does not)

Solves: #136
Supercedes: #113 #131 #132 #133

Beyond that, I reordered functions in plumbing.go so initTracer() is at the top again and added godoc to the helpers. Also beefed up localhost detection a touch to avoid a lookup for localhost, 127.0.0.1, and ::1. Also adjusted tests to not rely on config envvars showing up in otel-cli status or otel-cli exec's children.

Amy Tobey added 7 commits January 20, 2023 15:19
Build is broken at this point. Time to fix up the changes in OTel.
Updates all callsites and variable names to keep up with OTel.
The OTel spec does not support grpc:// or any way to deterministically demand
gRPC via the endpoint URI, preferring OTEL_EXPORTER_PROTOCOL to do so. This is
awkward for otel-cli so we break with the spec. otel-cli will only resolve
http(s):// to HTTP protocols, defaults bare host:port to gRPC, and supports
grpc:// to definitely use gRPC to connect out.

This commit adds grpc:// support while working out snags around URI
handling. In particular, subprocesses of otel-cli will no longer see
otel-cli configuration envvars in their environment, because they
are deleted at config time. This might be a little annoying when
otel-cli is chained, e.g. `otel-cli exec -- otel-cli status` but that
seems to be a rare usecase that can also use `otel-cli --endpoint`.

It /might/ break some folks using otel-cli to execute subtasks that also
want to access the OTel envvars. My guess is that this is rare to
nonexistent. It might not be a bad idea to add an option to propagate
envvar configs through to subprocesses, but I'm going to wait for
someone to ask.
Hoping this clears an error with one of its dependencies.
This reverts commit af79dec.
// gRPC via the endpoint URI, preferring OTEL_EXPORTER_PROTOCOL to do so. This is
// awkward for otel-cli so we break with the spec. otel-cli will only resolve
// http(s):// to HTTP protocols, defaults bare host:port to gRPC, and supports
// grpc:// to definitely use gRPC to connect out.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This func didn't change much except for this part. I was annoyed it was below the helpers it calls (they were added in a contributed PR a while ago) so I moved it back to the top.

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like no functional change at all, just added the above comment and moved the function


* bare `host:port` endpoints are assumed to be gRPC
* `grpc://` URIs are supported
* `http://` and `https://` are assumed to be HTTP _only_ (the spec reuses them for gRPC)

Choose a reason for hiding this comment

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

Can you please confirm that it's still about OTLP/gRPC and not OTLP/HTTP protocol (see OTEL_EXPORTER_OTLP_PROTOCOL).
I'm referring to the exporter specification https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options

Copy link
Contributor

@edw-eqix edw-eqix left a comment

Choose a reason for hiding this comment

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

I see there is also another comment that should be addressed before merging.

@@ -65,6 +66,7 @@ func (cs *Server) ServeGPRC(listener net.Listener) error {
// ListenAndServeGRPC starts a TCP listener then starts the GRPC server using
// ServeGRPC for you.
func (cs *Server) ListenAndServeGPRC(otlpEndpoint string) {
otlpEndpoint = strings.TrimPrefix(otlpEndpoint, "grpc://")
Copy link
Contributor

Choose a reason for hiding this comment

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

might be worth a comment here mentioning the docs/spec

// gRPC via the endpoint URI, preferring OTEL_EXPORTER_PROTOCOL to do so. This is
// awkward for otel-cli so we break with the spec. otel-cli will only resolve
// http(s):// to HTTP protocols, defaults bare host:port to gRPC, and supports
// grpc:// to definitely use gRPC to connect out.
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like no functional change at all, just added the above comment and moved the function

@tobert tobert merged commit 99c9242 into main Jan 26, 2023
@tobert tobert deleted the 2023-01-update-opentelemetry branch January 26, 2023 19:20
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.

3 participants