Skip to content

Commit

Permalink
[scraperhelper] deprecate NewObsReport, ObsReport, ObsReportSettings (#…
Browse files Browse the repository at this point in the history
…10959)

These functions and structs 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>
  • Loading branch information
codeboten committed Aug 26, 2024
1 parent 93ecf69 commit fbdbd50
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .chloggen/codeboten_cleanup-unnecessary-func-2.yaml
Original file line number Diff line number Diff line change
@@ -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, ObsReport, ObsReportSettings, scrapers should use NewScraperControllerReceiver

# 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: [api]
6 changes: 6 additions & 0 deletions receiver/scraperhelper/obsreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,13 +32,17 @@ 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
ReceiverCreateSettings receiver.Settings
}

// 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)
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/scraperhelper/obsreport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()},
Expand Down
2 changes: 1 addition & 1 deletion receiver/scraperhelper/scrapercontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fbdbd50

Please sign in to comment.