scrapererror

package
Version: v0.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 2 Imported by: 15

Documentation

Overview

Package scraperror provides custom error types for scrapers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPartialScrapeError

func IsPartialScrapeError(err error) bool

IsPartialScrapeError checks if an error was wrapped with PartialScrapeError.

Types

type PartialScrapeError

type PartialScrapeError struct {
	Failed int
	// contains filtered or unexported fields
}

PartialScrapeError is an error to represent that a subset of metrics were failed to be scraped.

func NewPartialScrapeError

func NewPartialScrapeError(err error, failed int) PartialScrapeError

NewPartialScrapeError creates PartialScrapeError for failed metrics. Use this error type only when a subset of data was failed to be scraped.

type ScrapeErrors

type ScrapeErrors struct {
	// contains filtered or unexported fields
}

ScrapeErrors contains multiple PartialScrapeErrors and can also contain generic errors.

func (*ScrapeErrors) Add

func (s *ScrapeErrors) Add(err error)

Add adds a regular error.

func (*ScrapeErrors) AddPartial

func (s *ScrapeErrors) AddPartial(failed int, err error)

AddPartial adds a PartialScrapeError with the provided failed count and error.

func (*ScrapeErrors) Combine

func (s *ScrapeErrors) Combine() error

Combine converts a slice of errors into one error. It will return a PartialScrapeError if at least one error in the slice is a PartialScrapeError.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL