From 7743353f269a30d5b7cd6fc3e7a9f2d5eeaa11fc Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Fri, 18 Nov 2022 10:13:31 -0600 Subject: [PATCH 1/4] Move otlp client to an internal package --- exporters/otlp/otlpmetric/{ => internal}/client.go | 2 +- exporters/otlp/otlpmetric/{ => internal}/exporter.go | 3 +-- exporters/otlp/otlpmetric/{ => internal}/exporter_test.go | 2 +- exporters/otlp/otlpmetric/internal/otest/client.go | 6 +++--- exporters/otlp/otlpmetric/internal/otest/client_test.go | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/client.go | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go | 4 ++-- 9 files changed, 18 insertions(+), 19 deletions(-) rename exporters/otlp/otlpmetric/{ => internal}/client.go (96%) rename exporters/otlp/otlpmetric/{ => internal}/exporter.go (97%) rename exporters/otlp/otlpmetric/{ => internal}/exporter_test.go (96%) diff --git a/exporters/otlp/otlpmetric/client.go b/exporters/otlp/otlpmetric/internal/client.go similarity index 96% rename from exporters/otlp/otlpmetric/client.go rename to exporters/otlp/otlpmetric/internal/client.go index 622b2bdd2a7..7950a4170cd 100644 --- a/exporters/otlp/otlpmetric/client.go +++ b/exporters/otlp/otlpmetric/internal/client.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" import ( "context" diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go similarity index 97% rename from exporters/otlp/otlpmetric/exporter.go rename to exporters/otlp/otlpmetric/internal/exporter.go index b7e06e51785..1fbf2f2e0f5 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" import ( "context" "fmt" diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/internal/exporter_test.go similarity index 96% rename from exporters/otlp/otlpmetric/exporter_test.go rename to exporters/otlp/otlpmetric/internal/exporter_test.go index dc0ccb9903d..65c8e578c46 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/internal/exporter_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" import ( "context" diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index 39002156a5c..cac7e98ce53 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -26,7 +26,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/metric/unit" semconv "go.opentelemetry.io/otel/semconv/v1.10.0" collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" @@ -168,13 +168,13 @@ var ( ) // ClientFactory is a function that when called returns a -// otlpmetric.Client implementation that is connected to also returned +// internal.Client implementation that is connected to also returned // Collector implementation. The Client is ready to upload metric data to the // Collector which is ready to store that data. // // If resultCh is not nil, the returned Collector needs to use the responses // from that channel to send back to the client for every export request. -type ClientFactory func(resultCh <-chan ExportResult) (otlpmetric.Client, Collector) +type ClientFactory func(resultCh <-chan ExportResult) (internal.Client, Collector) // RunClientTests runs a suite of Client integration tests. For example: // diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index 1db3cc78ea6..ff33ea5b73f 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -67,7 +67,7 @@ func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } func TestClientTests(t *testing.T) { - factory := func(rCh <-chan ExportResult) (otlpmetric.Client, Collector) { + factory := func(rCh <-chan ExportResult) (ominternal.Client, Collector) { c := &client{rCh: rCh, storage: NewStorage()} return c, c } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index d2f64432d72..3f41820be1f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -49,7 +49,7 @@ func New(ctx context.Context, options ...Option) (metric.Exporter, error) { if err != nil { return nil, err } - return otlpmetric.New(c), nil + return ominternal.New(c), nil } type client struct { @@ -70,7 +70,7 @@ type client struct { } // newClient creates a new gRPC metric client. -func newClient(ctx context.Context, options ...Option) (otlpmetric.Client, error) { +func newClient(ctx context.Context, options ...Option) (ominternal.Client, error) { cfg := oconf.NewGRPCConfig(asGRPCOptions(options)...) c := &client{ diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index ec6c27dfc87..91637530ada 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -27,7 +27,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/durationpb" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -130,7 +130,7 @@ func TestRetryable(t *testing.T) { } func TestClient(t *testing.T) { - factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) { + factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { coll, err := otest.NewGRPCCollector("", rCh) require.NoError(t, err) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index ecc170f198a..a362b45087e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -49,7 +49,7 @@ func New(_ context.Context, opts ...Option) (metric.Exporter, error) { if err != nil { return nil, err } - return otlpmetric.New(c), nil + return ominternal.New(c), nil } type client struct { @@ -81,7 +81,7 @@ var ourTransport = &http.Transport{ } // newClient creates a new HTTP metric client. -func newClient(opts ...Option) (otlpmetric.Client, error) { +func newClient(opts ...Option) (ominternal.Client, error) { cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) httpClient := &http.Client{ diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 82e5f8ed29f..e4c7dacc0f3 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -27,14 +27,14 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) func TestClient(t *testing.T) { - factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) { + factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { coll, err := otest.NewHTTPCollector("", rCh) require.NoError(t, err) From f7eb87b65e1a9a71c3e169fc55f9e7a87fbe7169 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 21 Nov 2022 09:44:06 -0600 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac0bdc06da8..277d6c1c3c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +## Removed + +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#????) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#????) + ## [1.11.1/0.33.0] 2022-10-19 ### Added From 5f414d465f50780c0db9aec7081983e1eddbd622 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 21 Nov 2022 10:16:36 -0600 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++-- exporters/otlp/otlpmetric/internal/exporter.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 277d6c1c3c2..e02402ebcd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,8 +55,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Removed -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#????) -- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#????) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486) ## [1.11.1/0.33.0] 2022-10-19 diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go index 1fbf2f2e0f5..c8db05e114b 100644 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -13,6 +13,7 @@ // limitations under the License. package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + import ( "context" "fmt" From 470b506e70b37af74ce084bbe74ad9e5f9b4d38d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 22 Nov 2022 15:56:42 -0800 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f671105ce2..a08cf2af749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,7 +63,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated. Use `Instrument`, `InstrumentKind`, `View`, and `NewView` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3476) - ## [1.11.1/0.33.0] 2022-10-19 ### Added