From c762886800517098e372ed8e6c0bf154352bb13f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 25 May 2025 14:49:47 -0400 Subject: [PATCH 1/2] [receiver/tcpcheck] unexport TCPConnectionState --- .chloggen/unexport_tcpconnectionstate.yaml | 27 ++++++++++++++++++++++ receiver/tcpcheckreceiver/scraper.go | 10 ++++---- 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .chloggen/unexport_tcpconnectionstate.yaml diff --git a/.chloggen/unexport_tcpconnectionstate.yaml b/.chloggen/unexport_tcpconnectionstate.yaml new file mode 100644 index 0000000000000..fdae2680b2bf4 --- /dev/null +++ b/.chloggen/unexport_tcpconnectionstate.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: tcpcheckreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Unexport TCPConnectionState + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [40271] + +# (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: [] diff --git a/receiver/tcpcheckreceiver/scraper.go b/receiver/tcpcheckreceiver/scraper.go index eb0520260dc92..2fd815bf8d3f2 100644 --- a/receiver/tcpcheckreceiver/scraper.go +++ b/receiver/tcpcheckreceiver/scraper.go @@ -22,23 +22,23 @@ type scraper struct { cfg *Config settings component.TelemetrySettings mb *metadata.MetricsBuilder - getConnectionState func(tcpConfig *confignet.TCPAddrConfig) (TCPConnectionState, error) + getConnectionState func(tcpConfig *confignet.TCPAddrConfig) (tcpConnectionState, error) errorCounts map[string]int64 } -type TCPConnectionState struct { +type tcpConnectionState struct { LocalAddr string // Local address of the connection RemoteAddr string // Remote address of the connection Network string // Network type (e.g., "tcp") } -func getConnectionState(tcpConfig *confignet.TCPAddrConfig) (TCPConnectionState, error) { +func getConnectionState(tcpConfig *confignet.TCPAddrConfig) (tcpConnectionState, error) { conn, err := tcpConfig.Dial(context.Background()) if err != nil { - return TCPConnectionState{}, err + return tcpConnectionState{}, err } defer conn.Close() - state := TCPConnectionState{ + state := tcpConnectionState{ LocalAddr: conn.LocalAddr().String(), RemoteAddr: conn.RemoteAddr().String(), Network: conn.LocalAddr().Network(), From 94c3fc1f358fc274da6829b36685e9b104650641 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Sun, 25 May 2025 13:14:43 -0700 Subject: [PATCH 2/2] Update .chloggen/unexport_tcpconnectionstate.yaml --- .chloggen/unexport_tcpconnectionstate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/unexport_tcpconnectionstate.yaml b/.chloggen/unexport_tcpconnectionstate.yaml index fdae2680b2bf4..94f84a17d7adf 100644 --- a/.chloggen/unexport_tcpconnectionstate.yaml +++ b/.chloggen/unexport_tcpconnectionstate.yaml @@ -24,4 +24,4 @@ subtext: # 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: [] +change_logs: [api]