Skip to content

refactor(diagnostics): encapsulate Client channels with send methods - #8072

Open
bowale01 wants to merge 1 commit into
Kong:mainfrom
bowale01:refactor/diagnostics-client-encapsulation
Open

refactor(diagnostics): encapsulate Client channels with send methods#8072
bowale01 wants to merge 1 commit into
Kong:mainfrom
bowale01:refactor/diagnostics-client-encapsulation

Conversation

@bowale01

Copy link
Copy Markdown

Description

Closes #8071

Resolves the TODO in internal/diagnostics/types.go:

// TODO(czeslavo): we could consider refactoring this to use private channels and expose methods for sending data.

This PR makes the channel fields on diagnostics.Client unexported and exposes public methods for controlled access, improving encapsulation.

Changes

  • Made Configs, FallbackCacheMetadata, Diffs channel fields unexported
  • Added SendConfig(), SendFallbackCacheMetadata(), SendDiff() methods for sending
  • Added DumpsIncludeSensitive() getter
  • Added IsEmpty() to replace zero-value struct comparison
  • Added Configs(), FallbackCacheMetadataCh(), DiffsCh() receive-only channel accessors
  • Added NewClient() constructor
  • Updated all callers in internal/dataplane/ and internal/dataplane/sendconfig/
  • Updated test code to use the new API

Type of change

  • Refactoring (non-breaking change that improves code quality)

Checklist

  • My code follows the style guidelines of this project
  • I have made corresponding changes to tests
  • go build ./internal/... ./pkg/... passes
  • go vet passes on all modified packages

Make the channel fields on diagnostics.Client unexported and expose
public methods for sending data, improving encapsulation.

Changes:
- Made Configs, FallbackCacheMetadata, Diffs channels unexported
- Added SendConfig(), SendFallbackCacheMetadata(), SendDiff() methods
- Added DumpsIncludeSensitive() getter
- Added IsEmpty() to replace zero-value struct comparison
- Added Configs(), FallbackCacheMetadataCh(), DiffsCh() receive-only accessors
- Added NewClient() constructor
- Updated all callers in dataplane and sendconfig packages
- Updated test code to use new API

Resolves TODO(czeslavo) in internal/diagnostics/types.go
@bowale01
bowale01 requested a review from a team as a code owner August 13, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: encapsulate diagnostics.Client channels with send methods

1 participant