From 09c4f920d13ec43a868b330348f7c5e85012e401 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Thu, 3 Aug 2023 23:34:28 -0700 Subject: [PATCH] [chore] move statsdreceiver packages to internal --- .../statsdreceiver-move-to-internal.yaml | 27 +++++++++++++++++++ receiver/statsdreceiver/config.go | 2 +- receiver/statsdreceiver/config_test.go | 2 +- receiver/statsdreceiver/factory.go | 2 +- .../protocol/metric_translator.go | 2 +- .../protocol/metric_translator_test.go | 0 .../{ => internal}/protocol/parser.go | 2 +- .../{ => internal}/protocol/statsd_parser.go | 2 +- .../protocol/statsd_parser_test.go | 0 .../{ => internal}/transport/client/client.go | 2 +- .../{ => internal}/transport/mock_reporter.go | 2 +- .../{ => internal}/transport/server.go | 4 +-- .../{ => internal}/transport/server_test.go | 4 +-- .../{ => internal}/transport/udp_server.go | 4 +-- receiver/statsdreceiver/receiver.go | 4 +-- receiver/statsdreceiver/receiver_test.go | 4 +-- receiver/statsdreceiver/reporter.go | 2 +- 17 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 .chloggen/statsdreceiver-move-to-internal.yaml rename receiver/statsdreceiver/{ => internal}/protocol/metric_translator.go (98%) rename receiver/statsdreceiver/{ => internal}/protocol/metric_translator_test.go (100%) rename receiver/statsdreceiver/{ => internal}/protocol/parser.go (90%) rename receiver/statsdreceiver/{ => internal}/protocol/statsd_parser.go (99%) rename receiver/statsdreceiver/{ => internal}/protocol/statsd_parser_test.go (100%) rename receiver/statsdreceiver/{ => internal}/transport/client/client.go (96%) rename receiver/statsdreceiver/{ => internal}/transport/mock_reporter.go (94%) rename receiver/statsdreceiver/{ => internal}/transport/server.go (95%) rename receiver/statsdreceiver/{ => internal}/transport/server_test.go (97%) rename receiver/statsdreceiver/{ => internal}/transport/udp_server.go (94%) diff --git a/.chloggen/statsdreceiver-move-to-internal.yaml b/.chloggen/statsdreceiver-move-to-internal.yaml new file mode 100644 index 000000000000..0812572c53ca --- /dev/null +++ b/.chloggen/statsdreceiver-move-to-internal.yaml @@ -0,0 +1,27 @@ +# 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. filelogreceiver) +component: receiver/statsdreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Move protocol and transport packages to internal + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [24892] + +# (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: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# 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: [api] diff --git a/receiver/statsdreceiver/config.go b/receiver/statsdreceiver/config.go index 920e812c6a26..67a92b493f27 100644 --- a/receiver/statsdreceiver/config.go +++ b/receiver/statsdreceiver/config.go @@ -11,7 +11,7 @@ import ( "go.opentelemetry.io/collector/config/confignet" "go.uber.org/multierr" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" ) // Config defines configuration for StatsD receiver. diff --git a/receiver/statsdreceiver/config_test.go b/receiver/statsdreceiver/config_test.go index 480b78dfb0b1..73cad547990b 100644 --- a/receiver/statsdreceiver/config_test.go +++ b/receiver/statsdreceiver/config_test.go @@ -17,7 +17,7 @@ import ( "go.opentelemetry.io/collector/confmap/confmaptest" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/metadata" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" ) func TestLoadConfig(t *testing.T) { diff --git a/receiver/statsdreceiver/factory.go b/receiver/statsdreceiver/factory.go index f851ed42692c..a83cc2255885 100644 --- a/receiver/statsdreceiver/factory.go +++ b/receiver/statsdreceiver/factory.go @@ -13,7 +13,7 @@ import ( "go.opentelemetry.io/collector/receiver" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/metadata" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" ) const ( diff --git a/receiver/statsdreceiver/protocol/metric_translator.go b/receiver/statsdreceiver/internal/protocol/metric_translator.go similarity index 98% rename from receiver/statsdreceiver/protocol/metric_translator.go rename to receiver/statsdreceiver/internal/protocol/metric_translator.go index 4bf28ef19e2d..9dc7e7573d9f 100644 --- a/receiver/statsdreceiver/protocol/metric_translator.go +++ b/receiver/statsdreceiver/internal/protocol/metric_translator.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package protocol // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" +package protocol // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" import ( "sort" diff --git a/receiver/statsdreceiver/protocol/metric_translator_test.go b/receiver/statsdreceiver/internal/protocol/metric_translator_test.go similarity index 100% rename from receiver/statsdreceiver/protocol/metric_translator_test.go rename to receiver/statsdreceiver/internal/protocol/metric_translator_test.go diff --git a/receiver/statsdreceiver/protocol/parser.go b/receiver/statsdreceiver/internal/protocol/parser.go similarity index 90% rename from receiver/statsdreceiver/protocol/parser.go rename to receiver/statsdreceiver/internal/protocol/parser.go index f5e38d9fe4bf..abfea560ce24 100644 --- a/receiver/statsdreceiver/protocol/parser.go +++ b/receiver/statsdreceiver/internal/protocol/parser.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package protocol // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" +package protocol // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" import ( "net" diff --git a/receiver/statsdreceiver/protocol/statsd_parser.go b/receiver/statsdreceiver/internal/protocol/statsd_parser.go similarity index 99% rename from receiver/statsdreceiver/protocol/statsd_parser.go rename to receiver/statsdreceiver/internal/protocol/statsd_parser.go index def7b3243dbe..6969de362c4d 100644 --- a/receiver/statsdreceiver/protocol/statsd_parser.go +++ b/receiver/statsdreceiver/internal/protocol/statsd_parser.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package protocol // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" +package protocol // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" import ( "errors" diff --git a/receiver/statsdreceiver/protocol/statsd_parser_test.go b/receiver/statsdreceiver/internal/protocol/statsd_parser_test.go similarity index 100% rename from receiver/statsdreceiver/protocol/statsd_parser_test.go rename to receiver/statsdreceiver/internal/protocol/statsd_parser_test.go diff --git a/receiver/statsdreceiver/transport/client/client.go b/receiver/statsdreceiver/internal/transport/client/client.go similarity index 96% rename from receiver/statsdreceiver/transport/client/client.go rename to receiver/statsdreceiver/internal/transport/client/client.go index 1de8a5ee02cb..ba40dbcf1deb 100644 --- a/receiver/statsdreceiver/transport/client/client.go +++ b/receiver/statsdreceiver/internal/transport/client/client.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package client // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport/client" +package client // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport/client" import ( "fmt" diff --git a/receiver/statsdreceiver/transport/mock_reporter.go b/receiver/statsdreceiver/internal/transport/mock_reporter.go similarity index 94% rename from receiver/statsdreceiver/transport/mock_reporter.go rename to receiver/statsdreceiver/internal/transport/mock_reporter.go index 23eaf197c200..33d8ac8ce535 100644 --- a/receiver/statsdreceiver/transport/mock_reporter.go +++ b/receiver/statsdreceiver/internal/transport/mock_reporter.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package transport // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport" +package transport // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport" import ( "context" diff --git a/receiver/statsdreceiver/transport/server.go b/receiver/statsdreceiver/internal/transport/server.go similarity index 95% rename from receiver/statsdreceiver/transport/server.go rename to receiver/statsdreceiver/internal/transport/server.go index ef334aecb3e5..7b3cdab6006f 100644 --- a/receiver/statsdreceiver/transport/server.go +++ b/receiver/statsdreceiver/internal/transport/server.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package transport // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport" +package transport // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport" import ( "context" @@ -10,7 +10,7 @@ import ( "go.opentelemetry.io/collector/consumer" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" ) var errNilListenAndServeParameters = errors.New("no parameter of ListenAndServe can be nil") diff --git a/receiver/statsdreceiver/transport/server_test.go b/receiver/statsdreceiver/internal/transport/server_test.go similarity index 97% rename from receiver/statsdreceiver/transport/server_test.go rename to receiver/statsdreceiver/internal/transport/server_test.go index e9df2d64dfe3..5a7b545a9a75 100644 --- a/receiver/statsdreceiver/transport/server_test.go +++ b/receiver/statsdreceiver/internal/transport/server_test.go @@ -16,8 +16,8 @@ import ( "go.opentelemetry.io/collector/consumer/consumertest" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport/client" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport/client" ) func Test_Server_ListenAndServe(t *testing.T) { diff --git a/receiver/statsdreceiver/transport/udp_server.go b/receiver/statsdreceiver/internal/transport/udp_server.go similarity index 94% rename from receiver/statsdreceiver/transport/udp_server.go rename to receiver/statsdreceiver/internal/transport/udp_server.go index aec9576e1029..7a483ce61649 100644 --- a/receiver/statsdreceiver/transport/udp_server.go +++ b/receiver/statsdreceiver/internal/transport/udp_server.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package transport // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport" +package transport // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport" import ( "bytes" @@ -12,7 +12,7 @@ import ( "go.opentelemetry.io/collector/consumer" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" ) type udpServer struct { diff --git a/receiver/statsdreceiver/receiver.go b/receiver/statsdreceiver/receiver.go index a28c4683da78..feac277f7716 100644 --- a/receiver/statsdreceiver/receiver.go +++ b/receiver/statsdreceiver/receiver.go @@ -18,8 +18,8 @@ import ( "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/protocol" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/protocol" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport" ) var _ receiver.Metrics = (*statsdReceiver)(nil) diff --git a/receiver/statsdreceiver/receiver_test.go b/receiver/statsdreceiver/receiver_test.go index e33e63de9c3f..2332740adb72 100644 --- a/receiver/statsdreceiver/receiver_test.go +++ b/receiver/statsdreceiver/receiver_test.go @@ -22,8 +22,8 @@ import ( "go.opentelemetry.io/collector/receiver/receivertest" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport/client" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport/client" ) func Test_statsdreceiver_New(t *testing.T) { diff --git a/receiver/statsdreceiver/reporter.go b/receiver/statsdreceiver/reporter.go index d205649d663d..ebbb94f167e5 100644 --- a/receiver/statsdreceiver/reporter.go +++ b/receiver/statsdreceiver/reporter.go @@ -11,7 +11,7 @@ import ( "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/internal/transport" ) // reporter struct implements the transport.Reporter interface to give consistent