mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Add scraper for logs <!-- Issue number if applicable --> #### Link to tracking issue Relates to #11238 <!--Describe what testing was performed and which tests were added.--> #### Testing Added unit tests <!--Describe the documentation added.--> #### Documentation Added <!--Please delete paragraphs that you did not use before submitting.-->
29 lines
827 B
Go
29 lines
827 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package scrapererror // import "go.opentelemetry.io/collector/scraper/scrapererror"
|
|
|
|
import "errors"
|
|
|
|
// PartialScrapeError is an error to represent
|
|
// that a subset of data were failed to be scraped.
|
|
type PartialScrapeError struct {
|
|
error
|
|
Failed int
|
|
}
|
|
|
|
// NewPartialScrapeError creates PartialScrapeError for failed data.
|
|
// 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)
|
|
}
|