Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Interval is the minimum interval between fetches. Interval time.Duration `json:"interval"` // Jitter is the maximum interval between fetches. Jitter time.Duration `json:"jitter"` // Trace is whether to trace the requests. Trace bool `json:"trace"` // Logger is the logger to use. Logger slog.Logger `json:"-"` // Headless controls headless mode for chromedp. Headless bool `json:"headless"` // ActionFunc is a function that returns an action to run. ActionFunc func(ctx context.Context, log slog.Logger, randIntn func(int) int, deadline time.Time) (Label, Action, error) `json:"-"` // WaitLoaded is a function that waits for the page to be loaded. WaitLoaded func(ctx context.Context, deadline time.Time) error // Screenshot is a function that takes a screenshot. Screenshot func(ctx context.Context, filename string) (string, error) // RandIntn is a function that returns a random number between 0 and n-1. RandIntn func(int) int `json:"-"` // InitChromeDPCtx is a function that initializes ChromeDP into the given context.Context. InitChromeDPCtx func(ctx context.Context, log slog.Logger, u *url.URL, sessionToken string, headless bool) (context.Context, context.CancelFunc, error) `json:"-"` }
type PromMetrics ¶
type PromMetrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(reg prometheus.Registerer) *PromMetrics
func (*PromMetrics) IncErrors ¶
func (p *PromMetrics) IncErrors(action string)
func (*PromMetrics) ObserveDuration ¶
func (p *PromMetrics) ObserveDuration(action string, d time.Duration)
type Target ¶ added in v2.2.1
type Target struct { // Label is a human-readable label for the target. Label Label // ClickOn is the selector that locates the element to be clicked. ClickOn Selector // WaitFor is a selector that is expected to appear after the target is clicked. WaitFor Selector }
Target is a thing that can be clicked.
Click to show internal directories.
Click to hide internal directories.