Documentation ¶
Index ¶
- func EqualsAmongTwo(sums ...float64) bool
- func EqualsSingle(expected float64) func(float64) bool
- func GreaterAmongTwo(sums ...float64) bool
- func LessAmongTwo(sums ...float64) bool
- func SumValues(values []float64) float64
- type CompositeInstrumentedRunnable
- func (r *CompositeInstrumentedRunnable) Instances() []*InstrumentedRunnable
- func (r *CompositeInstrumentedRunnable) MetricTargets() (ret []Target)
- func (r *CompositeInstrumentedRunnable) SumMetrics(metricNames []string, opts ...MetricsOption) ([]float64, error)
- func (r *CompositeInstrumentedRunnable) WaitSumMetrics(expected MetricValueExpectation, metricNames ...string) error
- func (r *CompositeInstrumentedRunnable) WaitSumMetricsWithOptions(expected MetricValueExpectation, metricNames []string, opts ...MetricsOption) error
- type Instrumented
- type InstrumentedOption
- type InstrumentedRunnable
- func (r *InstrumentedRunnable) MetricTargets() []Target
- func (r *InstrumentedRunnable) Metrics() (_ string, err error)
- func (r *InstrumentedRunnable) SumMetrics(metricNames []string, opts ...MetricsOption) ([]float64, error)
- func (r *InstrumentedRunnable) WaitRemovedMetric(metricName string, opts ...MetricsOption) error
- func (r *InstrumentedRunnable) WaitSumMetrics(expected MetricValueExpectation, metricNames ...string) error
- func (r *InstrumentedRunnable) WaitSumMetricsWithOptions(expected MetricValueExpectation, metricNames []string, opts ...MetricsOption) error
- type MetricValueExpectation
- type MetricsOption
- type Option
- type Prometheus
- type Service
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualsAmongTwo ¶ added in v0.13.0
EqualsAmongTwo is an isExpected function for WaitSumMetrics that returns true if first sum is equal to the second. NOTE: Be careful on scrapes in between of process that changes two metrics. Those are usually not atomic.
func EqualsSingle ¶ added in v0.13.0
func GreaterAmongTwo ¶ added in v0.13.0
GreaterAmongTwo is an isExpected function for WaitSumMetrics that returns true if first sum is greater than second. NOTE: Be careful on scrapes in between of process that changes two metrics. Those are usually not atomic.
func LessAmongTwo ¶ added in v0.13.0
LessAmongTwo is an isExpected function for WaitSumMetrics that returns true if first sum is smaller than second. NOTE: Be careful on scrapes in between of process that changes two metrics. Those are usually not atomic.
Types ¶
type CompositeInstrumentedRunnable ¶ added in v0.13.0
type CompositeInstrumentedRunnable struct {
// contains filtered or unexported fields
}
CompositeInstrumentedRunnable abstract a higher-level service composed by more than one InstrumentedRunnable.
func NewCompositeInstrumentedRunnable ¶ added in v0.13.0
func NewCompositeInstrumentedRunnable(runnables ...*InstrumentedRunnable) *CompositeInstrumentedRunnable
func (*CompositeInstrumentedRunnable) Instances ¶ added in v0.13.0
func (r *CompositeInstrumentedRunnable) Instances() []*InstrumentedRunnable
func (*CompositeInstrumentedRunnable) MetricTargets ¶ added in v0.13.0
func (r *CompositeInstrumentedRunnable) MetricTargets() (ret []Target)
func (*CompositeInstrumentedRunnable) SumMetrics ¶ added in v0.13.0
func (r *CompositeInstrumentedRunnable) SumMetrics(metricNames []string, opts ...MetricsOption) ([]float64, error)
SumMetrics returns the sum of the values of each given metric names.
func (*CompositeInstrumentedRunnable) WaitSumMetrics ¶ added in v0.13.0
func (r *CompositeInstrumentedRunnable) WaitSumMetrics(expected MetricValueExpectation, metricNames ...string) error
WaitSumMetrics waits for at least one instance of each given metric names to be present and their sums, returning true when passed to given expected(...).
func (*CompositeInstrumentedRunnable) WaitSumMetricsWithOptions ¶ added in v0.13.0
func (r *CompositeInstrumentedRunnable) WaitSumMetricsWithOptions(expected MetricValueExpectation, metricNames []string, opts ...MetricsOption) error
type Instrumented ¶ added in v0.13.0
type Instrumented interface { MetricTargets() []Target Metrics() (string, error) WaitSumMetrics(expected MetricValueExpectation, metricNames ...string) error WaitSumMetricsWithOptions(expected MetricValueExpectation, metricNames []string, opts ...MetricsOption) error SumMetrics(metricNames []string, opts ...MetricsOption) ([]float64, error) WaitRemovedMetric(metricName string, opts ...MetricsOption) error }
Instrumented represents methods for instrumented runnable focused on accessing instrumented metrics.
type InstrumentedOption ¶ added in v0.13.0
type InstrumentedOption func(*rOpt)
InstrumentedOption is a variadic option for AsInstrumented.
func WithInstrumentedMetricPath ¶ added in v0.13.0
func WithInstrumentedMetricPath(metricPath string) InstrumentedOption
WithInstrumentedMetricPath sets a custom path for metrics page. "/metrics" by default.
func WithInstrumentedScheme ¶ added in v0.13.0
func WithInstrumentedScheme(scheme string) InstrumentedOption
WithInstrumentedScheme allows adding customized scheme. "http" or "https" values allowed. "http" by default. If "https" is specified, insecure TLS will be performed.
func WithInstrumentedWaitBackoff ¶ added in v0.13.0
func WithInstrumentedWaitBackoff(waitBackoff *backoff.Backoff) InstrumentedOption
WithInstrumentedWaitBackoff allows customizing wait backoff when accessing metric endpoint.
type InstrumentedRunnable ¶ added in v0.13.0
InstrumentedRunnable represents runnable with instrumented Prometheus metric endpoint on a certain port.
func AsInstrumented ¶ added in v0.13.0
func AsInstrumented(r e2e.Runnable, instrumentedPortName string, opts ...InstrumentedOption) *InstrumentedRunnable
AsInstrumented wraps e2e.Runnable with InstrumentedRunnable. If runnable is running during invocation AsInstrumented panics. NOTE(bwplotka): Caller is expected to discard passed `r` runnable and use returned InstrumentedRunnable.Runnable instead.
func (*InstrumentedRunnable) MetricTargets ¶ added in v0.13.0
func (r *InstrumentedRunnable) MetricTargets() []Target
func (*InstrumentedRunnable) Metrics ¶ added in v0.13.0
func (r *InstrumentedRunnable) Metrics() (_ string, err error)
func (*InstrumentedRunnable) SumMetrics ¶ added in v0.13.0
func (r *InstrumentedRunnable) SumMetrics(metricNames []string, opts ...MetricsOption) ([]float64, error)
SumMetrics returns the sum of the values of each given metric names.
func (*InstrumentedRunnable) WaitRemovedMetric ¶ added in v0.13.0
func (r *InstrumentedRunnable) WaitRemovedMetric(metricName string, opts ...MetricsOption) error
WaitRemovedMetric waits until a metric disappear from the list of metrics exported by the service.
func (*InstrumentedRunnable) WaitSumMetrics ¶ added in v0.13.0
func (r *InstrumentedRunnable) WaitSumMetrics(expected MetricValueExpectation, metricNames ...string) error
WaitSumMetrics waits for at least one instance of each given metric names to be present and their sums, returning true when passed to given expected(...).
func (*InstrumentedRunnable) WaitSumMetricsWithOptions ¶ added in v0.13.0
func (r *InstrumentedRunnable) WaitSumMetricsWithOptions(expected MetricValueExpectation, metricNames []string, opts ...MetricsOption) error
type MetricValueExpectation ¶ added in v0.13.0
func Equals ¶ added in v0.13.0
func Equals(value float64) MetricValueExpectation
Equals is an MetricValueExpectation function for WaitSumMetrics that returns true if given single sum is equals to given value.
func Greater ¶ added in v0.13.0
func Greater(value float64) MetricValueExpectation
Greater is an isExpected function for WaitSumMetrics that returns true if given single sum is greater than given value.
func GreaterOrEqual ¶ added in v0.13.0
func GreaterOrEqual(value float64) MetricValueExpectation
GreaterOrEqual is an isExpected function for WaitSumMetrics that returns true if given single sum is greater or equal than given value.
func Less ¶ added in v0.13.0
func Less(value float64) MetricValueExpectation
Less is an isExpected function for WaitSumMetrics that returns true if given single sum is less than given value.
type MetricsOption ¶ added in v0.13.0
type MetricsOption func(*metricsOptions)
MetricsOption defined the signature of a function used to manipulate options.
func SkipMissingMetrics ¶ added in v0.13.0
func SkipMissingMetrics() MetricsOption
SkipMissingMetrics is an option to skip/ignore whenever an expected metric is missing.
func WaitMissingMetrics ¶ added in v0.13.0
func WaitMissingMetrics() MetricsOption
WaitMissingMetrics is an option to wait whenever an expected metric is missing. If this option is not enabled, will return error on missing metrics.
func WithLabelMatchers ¶ added in v0.13.0
func WithLabelMatchers(matchers ...*matchers.Matcher) MetricsOption
WithLabelMatchers is an option to filter only matching series.
func WithMetricCount ¶ added in v0.13.0
func WithMetricCount() MetricsOption
WithMetricCount is an option to get the histogram/summary count as metric value.
func WithWaitBackoff ¶ added in v0.13.0
func WithWaitBackoff(backoffConfig *backoff.Config) MetricsOption
WithWaitBackoff is an option to configure a backoff when waiting on a metric value.
type Option ¶ added in v0.11.0
type Option func(*opt)
func WithCadvisorDisabled ¶ added in v0.14.0
func WithCadvisorDisabled() Option
func WithCustomRegistry ¶ added in v0.12.0
func WithCustomRegistry(reg *prometheus.Registry) Option
WithCustomRegistry allows injecting a custom registry to use for this process metrics. NOTE(bwplotka): Injected registry will be used as is, while the default registry will have prometheus.NewGoCollector() and prometheus.NewProcessCollector(..) registered.
func WithPrometheusImage ¶ added in v0.13.0
WithPrometheusImage allows injecting custom Prometheus docker image to use as scraper and queryable.
func WithScrapeInterval ¶ added in v0.11.1
WithScrapeInterval changes how often metrics are scrape by Prometheus. 5s by default.
type Prometheus ¶ added in v0.13.0
type Prometheus struct { e2e.Runnable Instrumented }
func NewPrometheus ¶ added in v0.13.0
func NewPrometheus(env e2e.Environment, name string, image string, flagOverride map[string]string) *Prometheus
func (*Prometheus) SetConfig ¶ added in v0.13.0
func (p *Prometheus) SetConfig(config promconfig.Config) error
func (*Prometheus) SetConfigEncoded ¶ added in v0.13.0
func (p *Prometheus) SetConfigEncoded(config []byte) error
type Service ¶ added in v0.10.0
type Service struct {
// contains filtered or unexported fields
}
func Start ¶ added in v0.10.0
func Start(env e2e.Environment, opts ...Option) (_ *Service, err error)
Start deploys monitoring service which deploys Prometheus that monitors all InstrumentedRunnable instances in an environment created with AsInstrumented.
func (*Service) GetMonitoringRunnable ¶ added in v0.13.1
GetMonitoringRunnable returns a Prometheus monitoring runnable.
func (*Service) InstantQuery ¶ added in v0.13.0
InstantQuery evaluates instant PromQL queries against monitoring service.