Documentation ¶
Index ¶
- Constants
- Variables
- func AssertHistogramData(t *testing.T, query string, expectedMetric string, testName string)
- func AssertMetricData(t *testing.T, query, expectedMetric string, testName string)
- func AssertMetricsAvailable(t *testing.T, metrics []string, histogramMetrics []string, testName string)
- func FetchDataFromURL(url string, target Unmarshaler) error
- func MetricQuery(metricName string, testName string) string
- func MetricsQuery(testName string) string
- func MimirMetricsTest(t *testing.T, metrics []string, histogramMetrics []string, testName string)
- type Bucket
- type HistogramData
- type HistogramRawData
- type LogData
- type LogResponse
- type Metric
- type MetricData
- type MetricResponse
- type MetricResult
- type MetricsResponse
- type Unmarshaler
- type Value
Constants ¶
const DefaultRetryInterval = 100 * time.Millisecond
const DefaultTimeout = 90 * time.Second
Variables ¶
var OtelDefaultHistogramMetrics = []string{
"example_exponential_histogram",
"example_exponential_float_histogram",
}
Default histogram metrics list according to what the otel-gen app is generating.
var OtelDefaultMetrics = []string{
"example_counter",
"example_float_counter",
"example_updowncounter",
"example_float_updowncounter",
"example_histogram_bucket",
"example_float_histogram_bucket",
}
Default metrics list according to what the otel-gen app is generating.
var PromDefaultHistogramMetric = []string{
"golang_native_histogram",
}
Default histogram metrics list according to what the prom-gen app is generating.
var PromDefaultMetrics = []string{
"golang_counter",
"golang_gauge",
"golang_histogram_bucket",
"golang_summary",
}
Default metrics list according to what the prom-gen app is generating.
Functions ¶
func AssertHistogramData ¶
AssertHistogramData performs a Prometheus query and expect the result to eventually contain the expected histogram. The count and sum metrics should be greater than 10 before the timeout triggers.
func AssertMetricData ¶
AssertMetricData performs a Prometheus query and expect the result to eventually contain the expected metric.
func AssertMetricsAvailable ¶
func AssertMetricsAvailable(t *testing.T, metrics []string, histogramMetrics []string, testName string)
AssertMetricsAvailable performs a Prometheus query and expect the result to eventually contain the list of expected metrics.
func FetchDataFromURL ¶
func FetchDataFromURL(url string, target Unmarshaler) error
func MetricQuery ¶
MetricQuery returns a formatted Prometheus metric query with a given metricName and the given test_name label.
func MetricsQuery ¶
MetricsQuery returns the list of available metrics matching the given test_name label.
Types ¶
type Bucket ¶
type Bucket struct { BoundaryRule float64 LeftBoundary string RightBoundary string CountInBucket string }
func (*Bucket) UnmarshalJSON ¶
type HistogramData ¶
type HistogramRawData ¶
type HistogramRawData struct { Timestamp int64 Data HistogramData }
func (*HistogramRawData) UnmarshalJSON ¶
func (h *HistogramRawData) UnmarshalJSON(b []byte) error
type LogResponse ¶
type LogResponse struct { Status string `json:"status"` Data struct { ResultType string `json:"resultType"` Result []LogData `json:"result"` } `json:"data"` }
func (*LogResponse) Unmarshal ¶
func (m *LogResponse) Unmarshal(data []byte) error
type MetricData ¶
type MetricData struct { ResultType string `json:"resultType"` Result []MetricResult `json:"result"` }
type MetricResponse ¶
type MetricResponse struct { Status string `json:"status"` Data MetricData `json:"data"` }
func (*MetricResponse) Unmarshal ¶
func (m *MetricResponse) Unmarshal(data []byte) error
type MetricResult ¶
type MetricResult struct { Metric Metric `json:"metric"` Value *Value `json:"value,omitempty"` Histogram *HistogramRawData `json:"histogram,omitempty"` }
type MetricsResponse ¶
func (*MetricsResponse) Unmarshal ¶
func (m *MetricsResponse) Unmarshal(data []byte) error