scrapper

package
v0.0.0-...-f5eb8f5 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostPort

func HostPort(u *url.URL) string

HostPort return host:port.

Types

type Target

type Target struct {
	URL             *url.URL
	AllowList       []string
	DenyList        []string
	Rules           []types.SimpleRule
	ExtraLabels     map[string]string
	ContainerLabels map[string]string
	// contains filtered or unexported fields
}

Target is an URL to scrape.

func New

func New(u *url.URL, extraLabels map[string]string) *Target

func NewMock

func NewMock(content []byte, extraLabels map[string]string) *Target

func (*Target) Gather

func (t *Target) Gather() ([]*dto.MetricFamily, error)

Gather implement prometheus.Gatherer.

func (*Target) GatherWithState

func (t *Target) GatherWithState(ctx context.Context, state registry.GatherState) ([]*dto.MetricFamily, error)

type TargetError

type TargetError struct {
	// First 32kb of response
	PartialBody []byte
	StatusCode  int
	ConnectErr  error
	ReadErr     error
	DecodeErr   error
}

func (TargetError) Error

func (e TargetError) Error() string

Jump to

Keyboard shortcuts

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