promtest

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GCMServiceAccountOrFail

func GCMServiceAccountOrFail(t testing.TB) []byte

GCMServiceAccountOrFail gets the Google SA JSON content from GCM_SECRET environment variable or fails.

func NewIngestionTest

func NewIngestionTest(t testing.TB, backends []Backend) *ingestionTest

NewIngestionTest takes testing T and returns test instance as well as registry that can be used to register test metrics.

NOTE(bwplotka): All test functionality fails tests on error (instead of returning error).

func NoopBackend

func NoopBackend() noopBackend

NoopBackend creates noop backend, useful when you want to skip one backend for local debugging purpose without changing test significantly.

Types

type Backend

type Backend interface {
	Ref() string
	// contains filtered or unexported methods
}

func LocalExportWithGCM

func LocalExportWithGCM(gcmSA []byte) Backend

LocalExportWithGCM represents locally imported export pkg with GCM as a backend. In particular this backend is mimicking our GMP collector, while allowing quickest feedback loop for experiment and using IDE debuggers.

In particular this backend uses following data models, which is what our Prometheus fork is doing when scraping any scrape target:

* (Exposed to user) Go Prometheus SDK client types e.g. prometheus.NewCounter. * Go Prometheus SDK dto (Prometheus proto exposition format https://github.com/prometheus/client_model/blob/master/io/prometheus/client/metrics.proto). * Internal Prometheus parser (https://pkg.go.dev/github.com/prometheus/prometheus/pkg/textparse). * Internal Prometheus TSDB (head block) dto (e.g. records https://pkg.go.dev/github.com/prometheus/prometheus@v0.47.2/tsdb/record). * GCM monitoring API proto ingested by Monarch.

func Prometheus

func Prometheus(image string) Backend

type ExpectationsRecorder

type ExpectationsRecorder interface {
	Expect(val float64, metric prometheus.Metric, b Backend) ExpectationsRecorder
}

type Scrape

type Scrape func(after time.Duration) ExpectationsRecorder

Jump to

Keyboard shortcuts

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