refactor(clockreceiver): restore convention from PR-B3 drift#213
Merged
Conversation
Cross-cut review drift from #205. No behavior change — package surface realignment to match every other component package in the repo. 1. Rename `clockreceiver.Receiver` -> `clockReceiver` (package-private). All peer receivers (containerStdoutReceiver, k8sEventsReceiver, kernelEventsReceiver, ncclfrReceiver, pyspyReceiver) keep the concrete struct lowercase; the factory is the only exported surface — callers stitch via OCB, not by importing the struct. #205 unilaterally went exported. Restore convention. 2. Delete local `type componenttest struct{}` test stub that shadowed upstream `go.opentelemetry.io/collector/component/componenttest`. Replace usage with `componenttest.NewNopHost()` from the upstream package (already in go.mod via the v0.153.0 stack). Peer ports #208 (containerstdout) and #209 (k8sevents) use the upstream helper — #205 invented a local stub for no reason. `make check` + `go test -race ./components/receivers/clockreceiver/...` green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Tri Lam <tri@maydow.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cross-cut review cleanup of #205 (clockreceiver port off internal/pipeline). Two convention drifts caught when reviewing the merged PR against peer receivers; both are pure realignment, no behavior change.
Root cause
#205 ported
clockreceiverfrominternal/pipeline+consumerto the upstreamreceiver.Factoryshape. The port worked, but two package-surface decisions diverged from every other component package in the repo:type Receiver structexported. Every peer keeps the concrete struct package-private:containerStdoutReceiver(components/receivers/containerstdout)k8sEventsReceiver(components/receivers/k8sevents)kernelEventsReceiver(components/receivers/kernelevents)ncclfrReceiver(components/receivers/nccl_fr)pyspyReceiver(components/receivers/pyspy)The factory is the only exported constructor — callers stitch via OCB, never by importing the concrete struct.
git grep clockreceiver.Receiverreturns zero external hits, confirming no caller depended on the exported name. Restore convention.Local
type componenttest struct{}test stub. The fakecomponent.Hostinclockreceiver_test.goshadowed the upstream packagego.opentelemetry.io/collector/component/componenttest— which is already ingo.modatv0.153.0and is what every peer test uses (componenttest.NewNopHost()). The local stub was invented for no reason; peer ports #208 (containerstdout) and #209 (k8sevents) use the upstream helper directly.Neither drift is a workaround for an upstream blocker — both are pure convention misses caught post-merge. This PR is the root-cause fix.
Changes
Receiver→clockReceiveracrossclockreceiver.go,factory.go(comment),selftel_test.go(type-assertion).componenttest{}stub fromclockreceiver_test.go; replace usage with upstreamcomponenttest.NewNopHost().clockReceiverexplaining the package-private convention so a future drift fails review.Net diff: 4 files, +23/-23 LOC.
Test plan
make check(fmt + tidy + lint + vet + mod-verify) — greengo test -race ./components/receivers/clockreceiver/...— greenclockreceiver.Receivercallers exist (grep -rn 'clockreceiver\.Receiver' --include='*.go'returns nothing)componenttest.NewNopHost()is the peer-receiver pattern (containerstdout, kernelevents, nccl_fr, k8sevents)