Skip to content

Commit

Permalink
[chore] move receiver/scrapererror to scraper/scrapererror (#11733)
Browse files Browse the repository at this point in the history
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Migrates existing scrapererror code to new scraper package. Sets aliases
for receiver/scrapererror so that dependent code in contrib and
elsewhere can be updated
<!-- Issue number if applicable -->
#### Link to tracking issue
Relates to #11003

<!--Describe what testing was performed and which tests were added.-->
#### Testing
included unit/integration tests should suffice
<!--Describe the documentation added.-->
#### Documentation
changelog yaml
<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Pablo Baeyens <[email protected]>
Co-authored-by: Pablo Baeyens <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent 97929ac commit 32abecb
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 8 deletions.
25 changes: 25 additions & 0 deletions .chloggen/rm-dep-receiver-scrapererror.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: receiver/scraper

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Move receiver/scrapererror package to scraper/scrapererror and deprecate original receiver/scrapererror package.

# One or more tracking issues or pull requests related to the change
issues: [11003]

# (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]
24 changes: 24 additions & 0 deletions receiver/scrapererror/aliases.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Package scrapererror provides aliases for package scraper/scrapererror.
// Deprecated: [v0.115.0] Use `scraper/scrapererror` instead.
package scrapererror // import "go.opentelemetry.io/collector/receiver/scrapererror"

import "go.opentelemetry.io/collector/scraper/scrapererror"

type (
ScrapeErrors = scrapererror.ScrapeErrors
PartialScrapeError = scrapererror.PartialScrapeError
)

var (
AddPartial = (*ScrapeErrors).AddPartial
Add = (*ScrapeErrors).Add
Combine = (*ScrapeErrors).Combine
)

var (
NewPartialScrapeError = scrapererror.NewPartialScrapeError
IsPartialScrapeError = scrapererror.IsPartialScrapeError
)
2 changes: 1 addition & 1 deletion receiver/scraperhelper/obs_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/receiver/internal"
"go.opentelemetry.io/collector/receiver/scrapererror"
"go.opentelemetry.io/collector/receiver/scraperhelper/internal/metadata"
"go.opentelemetry.io/collector/scraper"
"go.opentelemetry.io/collector/scraper/scrapererror"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion receiver/scraperhelper/obs_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/testdata"
"go.opentelemetry.io/collector/receiver/scrapererror"
"go.opentelemetry.io/collector/scraper"
"go.opentelemetry.io/collector/scraper/scrapererror"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion receiver/scraperhelper/scrapercontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/receiverhelper"
"go.opentelemetry.io/collector/receiver/scrapererror"
"go.opentelemetry.io/collector/scraper"
"go.opentelemetry.io/collector/scraper/scrapererror"
)

// ScraperControllerOption apply changes to internal options.
Expand Down
2 changes: 1 addition & 1 deletion receiver/scraperhelper/scrapercontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/receivertest"
"go.opentelemetry.io/collector/receiver/scrapererror"
"go.opentelemetry.io/collector/scraper"
"go.opentelemetry.io/collector/scraper/scrapererror"
)

type testInitialize struct {
Expand Down
2 changes: 1 addition & 1 deletion scraper/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
go.opentelemetry.io/collector/pdata v1.20.0
go.opentelemetry.io/collector/pipeline v0.114.0
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
)

require (
Expand All @@ -27,7 +28,6 @@ require (
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.27.0 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// SPDX-License-Identifier: Apache-2.0

// Package scrapererror provides custom error types for scrapers.
package scrapererror // import "go.opentelemetry.io/collector/receiver/scrapererror"
package scrapererror // import "go.opentelemetry.io/collector/scraper/scrapererror"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package scrapererror // import "go.opentelemetry.io/collector/receiver/scrapererror"
package scrapererror // import "go.opentelemetry.io/collector/scraper/scrapererror"

import "errors"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package scrapererror // import "go.opentelemetry.io/collector/receiver/scrapererror"
package scrapererror // import "go.opentelemetry.io/collector/scraper/scrapererror"

import (
"go.uber.org/multierr"
Expand Down
File renamed without changes.

0 comments on commit 32abecb

Please sign in to comment.