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

[client, consumer] Move client features to consumerconnection #9996

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TylerHelmuth
Copy link
Member

@TylerHelmuth TylerHelmuth commented Apr 18, 2024

Description

This PR moves client features to consumerconnection. This attempts to remove ambiguity from the name client and continues to centralizes consumer as the location for features that pass data between components.

Link to tracking issue

Related to #9818

Testing

Duplicated the unit tests

Documentation

Updated the package comments and added deprecated warnings to the old client package.

@TylerHelmuth TylerHelmuth requested a review from a team as a code owner April 18, 2024 20:46
Copy link

codecov bot commented Apr 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.78%. Comparing base (fcdfdaa) to head (bc7f2f5).
Report is 35 commits behind head on main.

❗ Current head bc7f2f5 differs from pull request most recent head ffdf862. Consider uploading reports for the commit ffdf862 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9996      +/-   ##
==========================================
+ Coverage   91.77%   91.78%   +0.01%     
==========================================
  Files         359      361       +2     
  Lines       16633    16657      +24     
==========================================
+ Hits        15265    15289      +24     
  Misses       1041     1041              
  Partials      327      327              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// receivers: [otlp]
// processors: [authprinter]
// exporters: [debug]
package consumerconnection // import "go.opentelemetry.io/collector/consumer/consumerconnection"
Copy link
Member

Choose a reason for hiding this comment

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

consumerconnection go likes shorter names, conn is a good replacement for connection.

Not sure if is not cleaner to have consumer.ConnInfo instead? OR consumerinfo.Conn and consumerinfo.AuthData?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to consumerconn for now. That gives us consumerconn.Info and consumerconn.AuthData which I like since sharing connection data is the overall theme of the package and Info and AuthData are pieces of connection data the package supports sharing.

@jpkrohling jpkrohling self-requested a review May 15, 2024 15:50
component: collector/client

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecates collector/client. Use `consumerconnection` instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
note: Deprecates collector/client. Use `consumerconnection` instead.
note: Deprecates collector/client. Use `consumerconn` instead.

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Package consumerconnection contains generic representations of clients connecting to
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Package consumerconnection contains generic representations of clients connecting to
// Package consumerconn contains generic representations of clients connecting to

@codeboten codeboten self-requested a review May 15, 2024 15:54
// receivers: [otlp]
// processors: [authprinter]
// exporters: [debug]
package consumerconn // import "go.opentelemetry.io/collector/consumer/consumerconnection"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
package consumerconn // import "go.opentelemetry.io/collector/consumer/consumerconnection"
package consumerconn // import "go.opentelemetry.io/collector/consumer/consumerconn"

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Package client contains generic representations of clients connecting to
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Package client contains generic representations of clients connecting to
// Package consumerconn contains generic representations of clients connecting to

const MetadataHostName = "Host"

// NewContext takes an existing context and derives a new context with the
// client.Info value stored on it.
//
// Deprecated: [v0.99.0] Use consumerconnection.NewContextWithConnection instead
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Deprecated: [v0.99.0] Use consumerconnection.NewContextWithConnection instead
// Deprecated: [v0.99.0] Use consumerconn.NewContextWithConnection instead

@@ -402,7 +402,7 @@ func (hss *ServerConfig) ToServer(_ context.Context, host component.Host, settin
// TODO: Consider to use component ID string as prefix for all the operations.
handler = otelhttp.NewHandler(handler, "", otelOpts...)

// wrap the current handler in an interceptor that will add client.Info to the request's context
// wrap the current handler in an interceptor that will add consumerconnection.Info to the request's context
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// wrap the current handler in an interceptor that will add consumerconnection.Info to the request's context
// wrap the current handler in an interceptor that will add consumerconn.Info to the request's context

//
// Provided that the pipeline does not contain processors that would discard or
// rewrite the context, such as the batch processor, processors and exporters
// have access to the consumerconn.Info via consumerconnection.FromContext. Among other usages,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// have access to the consumerconn.Info via consumerconnection.FromContext. Among other usages,
// have access to the consumerconn.Info via consumerconn.FromContext. Among other usages,

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

I'm still not convinced we need this: while this change isn't backwards incompatible and there's a clear migration path, I don't think it's worth the hassle. Every authenticator out there (ours and external) will need to eventually migrate to the new package name. Even if the new name is really great, I don't think we should pursue this or similar changes before v1.

About the Metadata vs. AuthData, we could certainly have a separate discussion about unifying them, but I still see them as serving different purposes: metadata is typically just the headers from HTTP or gRPC, while AuthData doesn't necessarily has to be backed by a map of a slice of strings.

As someone else mentioned on yesterday's call: this package has been stable and serving it's purpose for a long time now, we shouldn't really be changing it in the name of stability for v1.

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

5 participants