-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
1,821 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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/scrapererror | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Deprecate the package in favor of /receiver/scrapererror. | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [11003] | ||
|
||
# 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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 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: eceiver/scraperhelper | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Deprecate the package in favor of /receiver/scraperhelper. | ||
|
||
# One or more tracking issues or pull requests related to the change | ||
issues: [11003] | ||
|
||
# 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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module go.opentelemetry.io/collector/receiver/scraper | ||
|
||
go 1.22.0 | ||
|
||
require ( | ||
github.com/stretchr/testify v1.9.0 | ||
go.opentelemetry.io/collector/component v0.110.0 | ||
go.opentelemetry.io/collector/consumer v0.110.0 | ||
go.opentelemetry.io/collector/consumer/consumertest v0.110.0 | ||
go.opentelemetry.io/collector/pdata v1.16.0 | ||
go.opentelemetry.io/collector/pipeline v0.110.0 | ||
go.opentelemetry.io/collector/receiver v0.110.0 | ||
go.opentelemetry.io/otel v1.30.0 | ||
go.opentelemetry.io/otel/metric v1.30.0 | ||
go.opentelemetry.io/otel/sdk v1.30.0 | ||
go.opentelemetry.io/otel/trace v1.30.0 | ||
go.uber.org/goleak v1.3.0 | ||
go.uber.org/multierr v1.11.0 | ||
go.uber.org/zap v1.27.0 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/go-logr/logr v1.4.2 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/google/uuid v1.6.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
go.opentelemetry.io/collector/component/componentprofiles v0.110.0 // indirect | ||
go.opentelemetry.io/collector/config/configtelemetry v0.110.0 // indirect | ||
go.opentelemetry.io/collector/consumer/consumerprofiles v0.110.0 // indirect | ||
go.opentelemetry.io/collector/internal/globalsignal v0.110.0 // indirect | ||
go.opentelemetry.io/collector/pdata/pprofile v0.110.0 // indirect | ||
go.opentelemetry.io/collector/receiver/receiverprofiles v0.110.0 // indirect | ||
go.opentelemetry.io/otel/sdk/metric v1.30.0 // indirect | ||
golang.org/x/net v0.28.0 // indirect | ||
golang.org/x/sys v0.25.0 // indirect | ||
golang.org/x/text v0.17.0 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect | ||
google.golang.org/grpc v1.66.2 // indirect | ||
google.golang.org/protobuf v1.34.2 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Package scrapererror provides custom error types for scrapers. | ||
package scrapererror // import "go.opentelemetry.io/collector/receiver/scraper/scrapererror" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package scrapererror | ||
|
||
import ( | ||
"testing" | ||
|
||
"go.uber.org/goleak" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
goleak.VerifyTestMain(m) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package scrapererror // import "go.opentelemetry.io/collector/receiver/scraper/scrapererror" | ||
|
||
import "errors" | ||
|
||
// PartialScrapeError is an error to represent | ||
// that a subset of metrics were failed to be scraped. | ||
type PartialScrapeError struct { | ||
error | ||
Failed int | ||
} | ||
|
||
// NewPartialScrapeError creates PartialScrapeError for failed metrics. | ||
// Use this error type only when a subset of data was failed to be scraped. | ||
func NewPartialScrapeError(err error, failed int) PartialScrapeError { | ||
return PartialScrapeError{ | ||
error: err, | ||
Failed: failed, | ||
} | ||
} | ||
|
||
// IsPartialScrapeError checks if an error was wrapped with PartialScrapeError. | ||
func IsPartialScrapeError(err error) bool { | ||
var partialScrapeErr PartialScrapeError | ||
return errors.As(err, &partialScrapeErr) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package scrapererror | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPartialScrapeError(t *testing.T) { | ||
failed := 2 | ||
err := errors.New("some error") | ||
partialErr := NewPartialScrapeError(err, failed) | ||
require.EqualError(t, err, partialErr.Error()) | ||
assert.Equal(t, failed, partialErr.Failed) | ||
} | ||
|
||
func TestIsPartialScrapeError(t *testing.T) { | ||
err := errors.New("testError") | ||
require.False(t, IsPartialScrapeError(err)) | ||
|
||
err = NewPartialScrapeError(err, 2) | ||
require.True(t, IsPartialScrapeError(err)) | ||
} |
Oops, something went wrong.