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 statsdreceiver to checkapi standards #26471

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/checkapi-statsd-26304.yaml
Original file line number Diff line number Diff line change
@@ -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: statsdreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "rename and do not export function `New` to `newReceiver` to pass checkapi"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [26304]

# (Optional) One or more lines of additional information to render under the primagit sry 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]
1 change: 0 additions & 1 deletion cmd/checkapi/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ receiver/mysqlreceiver
receiver/nsxtreceiver
receiver/podmanreceiver
receiver/pulsarreceiver
receiver/statsdreceiver
receiver/windowseventlogreceiver
2 changes: 1 addition & 1 deletion receiver/statsdreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ func createMetricsReceiver(
consumer consumer.Metrics,
) (receiver.Metrics, error) {
c := cfg.(*Config)
return New(params, *c, consumer)
return newReceiver(params, *c, consumer)
}
4 changes: 2 additions & 2 deletions receiver/statsdreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ type statsdReceiver struct {
cancel context.CancelFunc
}

// New creates the StatsD receiver with the given parameters.
func New(
// newReceiver creates the StatsD receiver with the given parameters.
func newReceiver(
set receiver.CreateSettings,
config Config,
nextConsumer consumer.Metrics,
Expand Down
10 changes: 5 additions & 5 deletions receiver/statsdreceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Test_statsdreceiver_New(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := New(receivertest.NewNopCreateSettings(), tt.args.config, tt.args.nextConsumer)
_, err := newReceiver(receivertest.NewNopCreateSettings(), tt.args.config, tt.args.nextConsumer)
assert.Equal(t, tt.wantErr, err)
})
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func Test_statsdreceiver_Start(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
receiver, err := New(receivertest.NewNopCreateSettings(), tt.args.config, tt.args.nextConsumer)
receiver, err := newReceiver(receivertest.NewNopCreateSettings(), tt.args.config, tt.args.nextConsumer)
require.NoError(t, err)
err = receiver.Start(context.Background(), componenttest.NewNopHost())
assert.Equal(t, tt.wantErr, err)
Expand All @@ -93,7 +93,7 @@ func TestStatsdReceiver_ShutdownBeforeStart(t *testing.T) {
ctx := context.Background()
cfg := createDefaultConfig().(*Config)
nextConsumer := consumertest.NewNop()
rcv, err := New(receivertest.NewNopCreateSettings(), *cfg, nextConsumer)
rcv, err := newReceiver(receivertest.NewNopCreateSettings(), *cfg, nextConsumer)
assert.NoError(t, err)
r := rcv.(*statsdReceiver)
assert.NoError(t, r.Shutdown(ctx))
Expand All @@ -103,7 +103,7 @@ func TestStatsdReceiver_Flush(t *testing.T) {
ctx := context.Background()
cfg := createDefaultConfig().(*Config)
nextConsumer := consumertest.NewNop()
rcv, err := New(receivertest.NewNopCreateSettings(), *cfg, nextConsumer)
rcv, err := newReceiver(receivertest.NewNopCreateSettings(), *cfg, nextConsumer)
assert.NoError(t, err)
r := rcv.(*statsdReceiver)
var metrics = pmetric.NewMetrics()
Expand Down Expand Up @@ -147,7 +147,7 @@ func Test_statsdreceiver_EndToEnd(t *testing.T) {
cfg := tt.configFn()
cfg.NetAddr.Endpoint = addr
sink := new(consumertest.MetricsSink)
rcv, err := New(receivertest.NewNopCreateSettings(), *cfg, sink)
rcv, err := newReceiver(receivertest.NewNopCreateSettings(), *cfg, sink)
require.NoError(t, err)
r := rcv.(*statsdReceiver)

Expand Down