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 struct {
Name string `json:"__name__"`
DeploymentEnvironment string `json:"deployment_environment"`
ExportedInstance string `json:"exported_instance"`
ExportedJob string `json:"exported_job"`
Instance string `json:"instance"`
Job string `json:"job"`
LibraryLanguage string `json:"library_language"`
ServiceInstanceID string `json:"service_instance_id"`
ServiceName string `json:"service_name"`
} `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.