From 6d6b1a4490967c751319f388db9b012e3b411dba Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:59:58 -0700 Subject: [PATCH 1/4] [scraperhelper] deprecate NewObsReport This function doesn't appear used in any of the components in either core or contrib. Deprecating to remove the surface area of the package. Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- receiver/scraperhelper/obsreport.go | 2 ++ receiver/scraperhelper/obsreport_test.go | 2 +- receiver/scraperhelper/scrapercontroller.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/receiver/scraperhelper/obsreport.go b/receiver/scraperhelper/obsreport.go index af9a89c4fc0..0ca1e03a4db 100644 --- a/receiver/scraperhelper/obsreport.go +++ b/receiver/scraperhelper/obsreport.go @@ -37,6 +37,8 @@ type ObsReportSettings struct { } // NewObsReport creates a new ObsReport. +// +// Deprecated: [v0.108.0] will be removed, scrapers should use NewScraperControllerReceiver instead. func NewObsReport(cfg ObsReportSettings) (*ObsReport, error) { return newScraper(cfg) } diff --git a/receiver/scraperhelper/obsreport_test.go b/receiver/scraperhelper/obsreport_test.go index 94d58f18d97..88445e57fa8 100644 --- a/receiver/scraperhelper/obsreport_test.go +++ b/receiver/scraperhelper/obsreport_test.go @@ -95,7 +95,7 @@ func TestCheckScraperMetricsViews(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) - s, err := NewObsReport(ObsReportSettings{ + s, err := newScraper(ObsReportSettings{ ReceiverID: receiverID, Scraper: scraperID, ReceiverCreateSettings: receiver.Settings{ID: receiverID, TelemetrySettings: tt.TelemetrySettings(), BuildInfo: component.NewDefaultBuildInfo()}, diff --git a/receiver/scraperhelper/scrapercontroller.go b/receiver/scraperhelper/scrapercontroller.go index eed33fd2193..7ed92497e3f 100644 --- a/receiver/scraperhelper/scrapercontroller.go +++ b/receiver/scraperhelper/scrapercontroller.go @@ -103,7 +103,7 @@ func NewScraperControllerReceiver( sc.obsScrapers = make([]*ObsReport, len(sc.scrapers)) for i, scraper := range sc.scrapers { - scrp, err := NewObsReport(ObsReportSettings{ + scrp, err := newScraper(ObsReportSettings{ ReceiverID: sc.id, Scraper: scraper.ID(), ReceiverCreateSettings: sc.recvSettings, From db80d18bdc0ffcf9c565aa469732928f6c710a62 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:02:08 -0700 Subject: [PATCH 2/4] changelog Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- .../codeboten_cleanup-unnecessary-func-2.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .chloggen/codeboten_cleanup-unnecessary-func-2.yaml diff --git a/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml b/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml new file mode 100644 index 00000000000..ee1547bdf90 --- /dev/null +++ b/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: deprecation + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: scraperhelper + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: deprecate NewObsReport, scrapers should use NewScraperControllerReceiver instead + +# One or more tracking issues or pull requests related to the change +issues: [10959] + +# (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: + +# 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: [] From 9c547409481f047b43f3138e4a7ec68f6488572c Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:09:38 -0700 Subject: [PATCH 3/4] more unnecessary surface area to deprecate Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- .chloggen/codeboten_cleanup-unnecessary-func-2.yaml | 2 +- receiver/scraperhelper/obsreport.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml b/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml index ee1547bdf90..59c9bf08114 100644 --- a/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml +++ b/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml @@ -7,7 +7,7 @@ change_type: deprecation component: scraperhelper # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: deprecate NewObsReport, scrapers should use NewScraperControllerReceiver instead +note: deprecate NewObsReport, ObsReport, ObsReportSettings, scrapers should use NewScraperControllerReceiver # One or more tracking issues or pull requests related to the change issues: [10959] diff --git a/receiver/scraperhelper/obsreport.go b/receiver/scraperhelper/obsreport.go index 0ca1e03a4db..271551c80db 100644 --- a/receiver/scraperhelper/obsreport.go +++ b/receiver/scraperhelper/obsreport.go @@ -20,6 +20,8 @@ import ( ) // ObsReport is a helper to add observability to a scraper. +// +// Deprecated: [v0.108.0] will be removed. type ObsReport struct { receiverID component.ID scraper component.ID @@ -30,6 +32,8 @@ type ObsReport struct { } // ObsReportSettings are settings for creating an ObsReport. +// +// Deprecated: [v0.108.0] will be removed. type ObsReportSettings struct { ReceiverID component.ID Scraper component.ID From 4e5b27b9eff65a33f4426cdb5bbf094baa4d5e60 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Mon, 26 Aug 2024 07:04:13 -0700 Subject: [PATCH 4/4] Update .chloggen/codeboten_cleanup-unnecessary-func-2.yaml --- .chloggen/codeboten_cleanup-unnecessary-func-2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml b/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml index 59c9bf08114..16a7b9ae301 100644 --- a/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml +++ b/.chloggen/codeboten_cleanup-unnecessary-func-2.yaml @@ -22,4 +22,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]