From 76ce985d64a771010f7ba71c938371542f880667 Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:52:05 -0600 Subject: [PATCH] [configgrpc] Remove deprecated functions/structs (#9616) **Description:** Removes deprecated functions/structs **Link to tracking Issue:** Related to https://github.com/open-telemetry/opentelemetry-collector/issues/9428 Related to https://github.com/open-telemetry/opentelemetry-collector/issues/9482 Closes https://github.com/open-telemetry/opentelemetry-collector/issues/9481 --- .../configgrpc-remove-deprecated-items.yaml | 25 +++++++++++++++++++ config/configgrpc/configgrpc.go | 16 ------------ config/configgrpc/configgrpc_test.go | 8 +----- 3 files changed, 26 insertions(+), 23 deletions(-) create mode 100755 .chloggen/configgrpc-remove-deprecated-items.yaml diff --git a/.chloggen/configgrpc-remove-deprecated-items.yaml b/.chloggen/configgrpc-remove-deprecated-items.yaml new file mode 100755 index 00000000000..b6d42c52cfe --- /dev/null +++ b/.chloggen/configgrpc-remove-deprecated-items.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: configgrpc + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Remove deprecated `GRPCClientSettings`, `GRPCServerSettings`, and `ServerConfig.ToListenerContext`. + +# One or more tracking issues or pull requests related to the change +issues: [9616] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/config/configgrpc/configgrpc.go b/config/configgrpc/configgrpc.go index 6dea5917ea2..3dab945f8dc 100644 --- a/config/configgrpc/configgrpc.go +++ b/config/configgrpc/configgrpc.go @@ -8,7 +8,6 @@ import ( "crypto/tls" "errors" "fmt" - "net" "strings" "time" @@ -47,10 +46,6 @@ type KeepaliveClientConfig struct { PermitWithoutStream bool `mapstructure:"permit_without_stream"` } -// GRPCClientSettings defines common settings for a gRPC client configuration. -// Deprecated: [v0.94.0] Use ClientConfig instead -type GRPCClientSettings = ClientConfig - // ClientConfig defines common settings for a gRPC client configuration. type ClientConfig struct { // The target to which the exporter is going to send traces or metrics, @@ -120,10 +115,6 @@ type KeepaliveEnforcementPolicy struct { PermitWithoutStream bool `mapstructure:"permit_without_stream"` } -// GRPCServerSettings defines common settings for a gRPC server configuration. -// Deprecated: [v0.94.0] Use ServerConfig instead -type GRPCServerSettings = ServerConfig - // ServerConfig defines common settings for a gRPC server configuration. type ServerConfig struct { // Server net.Addr config. For transport only "tcp" and "unix" are valid options. @@ -160,7 +151,6 @@ type ServerConfig struct { } // SanitizedEndpoint strips the prefix of either http:// or https:// from configgrpc.ClientConfig.Endpoint. -// Deprecated: [v0.95.0] Trim the prefix from configgrpc.ClientConfig.Endpoint directly. func (gcs *ClientConfig) SanitizedEndpoint() string { switch { case gcs.isSchemeHTTP(): @@ -277,12 +267,6 @@ func validateBalancerName(balancerName string) bool { return balancer.Get(balancerName) != nil } -// ToListenerContext returns the net.Listener constructed from the settings. -// Deprecated: [v0.95.0] Call Listen directly on the NetAddr field. -func (gss *ServerConfig) ToListenerContext(ctx context.Context) (net.Listener, error) { - return gss.NetAddr.Listen(ctx) -} - func (gss *ServerConfig) ToServer(host component.Host, settings component.TelemetrySettings, extraOpts ...grpc.ServerOption) (*grpc.Server, error) { opts, err := gss.toServerOption(host, settings) if err != nil { diff --git a/config/configgrpc/configgrpc_test.go b/config/configgrpc/configgrpc_test.go index 714c5b0bc9b..dd77209d3e8 100644 --- a/config/configgrpc/configgrpc_test.go +++ b/config/configgrpc/configgrpc_test.go @@ -493,14 +493,8 @@ func TestGRPCServerSettings_ToListener_Error(t *testing.T) { Endpoint: "127.0.0.1:1234567", Transport: "tcp", }, - TLSSetting: &configtls.TLSServerSetting{ - TLSSetting: configtls.TLSSetting{ - CertFile: "/doesnt/exist", - }, - }, - Keepalive: nil, } - _, err := settings.ToListenerContext(context.Background()) + _, err := settings.NetAddr.Listen(context.Background()) assert.Error(t, err) }