prometheus

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package prometheus holds the resources needed to start a Prometheus testcontainer container.

Package prometheus holds the resources needed to start a Prometheus testcontainer container.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	Metric map[string]string `json:"metric"`
	Values [][]any           `json:"values"`
}

Metrics represents a Prometheus metric series.

type Prometheus

type Prometheus struct {
	Ports   map[int]nat.Port
	Network *testcontainers.DockerNetwork
	Name    string
	// contains filtered or unexported fields
}

Prometheus holds the testcontainer, ports and network used by Jaeger. If instantiating yourself, be sure to populate Jaeger.Network, otherwise a new network will be generated.

func (*Prometheus) GetMetrics

func (p *Prometheus) GetMetrics(expectedDataPoints int, maxRetries int, metricName string, service string, since time.Duration) (Metrics, string, error)

GetMetrics takes in a service names and returns the last n `metricName` events corresponding to that `service` over that `since`. There is a retry mechanism implemented; `GetMetrics` will keep fetching every 2 seconds, for a maximum of `maxRetries` times, until Prometheus returns `expectedDataPoints` number of metrics points.

func (*Prometheus) Start

func (p *Prometheus) Start(ctx context.Context, collectorName string) (func(context.Context) error, error)

Start starts the Prometheus container.

Jump to

Keyboard shortcuts

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