Documentation
¶
Index ¶
- func StartVmbackup(instance, storageDataPath, snapshotCreateURL, dst string, output io.Writer) error
- func StartVmctl(instance string, flags []string, output io.Writer) error
- func StartVmrestore(instance, src, storageDataPath string, output io.Writer) error
- type APIV1AdminTSDBSnapshotResponse
- type AdminTenantsResponse
- type AssertOptions
- type Client
- func (c *Client) CloseConnections()
- func (c *Client) Delete(t *testing.T, url string) (string, int)
- func (c *Client) Get(t *testing.T, url string) (string, int)
- func (c *Client) Post(t *testing.T, url, contentType string, data []byte) (string, int)
- func (c *Client) PostForm(t *testing.T, url string, data url.Values) (string, int)
- func (c *Client) Write(t *testing.T, address string, data []string)
- type ClusterOptions
- type GraphiteMetricsIndexResponse
- type LogsQLQueryResponse
- type MetricNamesStatsRecord
- type MetricNamesStatsResponse
- type PrometheusAPIV1LabelValuesResponse
- type PrometheusAPIV1LabelsResponse
- type PrometheusAPIV1QueryResponse
- type PrometheusAPIV1SeriesCountResponse
- type PrometheusAPIV1SeriesResponse
- type PrometheusQuerier
- type PrometheusWriteQuerier
- type QueryData
- type QueryOpts
- type QueryResult
- type Sample
- type ServesMetrics
- func (app *ServesMetrics) GetIntMetric(t *testing.T, metricName string) int
- func (app *ServesMetrics) GetMetric(t *testing.T, metricName string) float64
- func (app *ServesMetrics) GetMetricsByPrefix(t *testing.T, prefix string) []float64
- func (app *ServesMetrics) GetMetricsByRegexp(t *testing.T, re *regexp.Regexp) []float64
- type SnapshotCreateResponse
- type SnapshotData
- type SnapshotDeleteAllResponse
- type SnapshotDeleteResponse
- type SnapshotListResponse
- type Stopper
- type StorageFlusher
- type StorageMerger
- type TSDBStatusResponse
- type TSDBStatusResponseData
- type TSDBStatusResponseEntry
- type TSDBStatusResponseMetricNameEntry
- type TestCase
- func (tc *TestCase) Assert(opts *AssertOptions)
- func (tc *TestCase) Client() *Client
- func (tc *TestCase) Dir() string
- func (tc *TestCase) ForceFlush(apps ...*Vmstorage)
- func (tc *TestCase) MustStartCluster(opts *ClusterOptions) *Vmcluster
- func (tc *TestCase) MustStartDefaultCluster() *Vmcluster
- func (tc *TestCase) MustStartDefaultVmsingle() *Vmsingle
- func (tc *TestCase) MustStartVmagent(instance string, flags []string, promScrapeConfigFileYAML string) *Vmagent
- func (tc *TestCase) MustStartVmauth(instance string, flags []string, configFileYAML string) *Vmauth
- func (tc *TestCase) MustStartVmbackup(instance, storageDataPath, snapshotCreateURL, dst string)
- func (tc *TestCase) MustStartVmctl(instance string, flags []string)
- func (tc *TestCase) MustStartVminsert(instance string, flags []string) *Vminsert
- func (tc *TestCase) MustStartVmrestore(instance, src, storageDataPath string)
- func (tc *TestCase) MustStartVmselect(instance string, flags []string) *Vmselect
- func (tc *TestCase) MustStartVmsingle(instance string, flags []string) *Vmsingle
- func (tc *TestCase) MustStartVmsingleAt(instance, binary string, flags []string) *Vmsingle
- func (tc *TestCase) MustStartVmstorage(instance string, flags []string) *Vmstorage
- func (tc *TestCase) MustStartVmstorageAt(instance string, binary string, flags []string) *Vmstorage
- func (tc *TestCase) Stop()
- func (tc *TestCase) StopApp(instance string)
- func (tc *TestCase) StopPrometheusWriteQuerier(pwq PrometheusWriteQuerier)
- func (tc *TestCase) T() *testing.T
- type Trace
- type Vmagent
- func (app *Vmagent) APIV1ImportPrometheus(t *testing.T, records []string, opts QueryOpts)
- func (app *Vmagent) APIV1ImportPrometheusNoWaitFlush(t *testing.T, records []string, _ QueryOpts)
- func (app Vmagent) Name() string
- func (app *Vmagent) ReloadRelabelConfigs(t *testing.T)
- func (app *Vmagent) RemoteWritePacketsDroppedTotal(t *testing.T) int
- func (app *Vmagent) RemoteWritePendingInmemoryBlocks(t *testing.T, url string) int
- func (app *Vmagent) RemoteWriteRequests(t *testing.T, url string) int
- func (app *Vmagent) RemoteWriteRequestsRetriesCountTotal(t *testing.T) int
- func (app *Vmagent) RemoteWriteSamplesDropped(t *testing.T, url string) int
- func (app Vmagent) Stop()
- func (app Vmagent) String() string
- type Vmauth
- type Vmcluster
- type Vminsert
- func (app *Vminsert) ClusternativeListenAddr() string
- func (app *Vminsert) GraphiteWrite(t *testing.T, records []string, _ QueryOpts)
- func (app *Vminsert) HTTPAddr() string
- func (app *Vminsert) InfluxWrite(t *testing.T, records []string, opts QueryOpts)
- func (app Vminsert) Name() string
- func (app *Vminsert) OpenTSDBAPIPut(t *testing.T, records []string, opts QueryOpts)
- func (app *Vminsert) PrometheusAPIV1ImportCSV(t *testing.T, records []string, opts QueryOpts)
- func (app *Vminsert) PrometheusAPIV1ImportNative(t *testing.T, data []byte, opts QueryOpts)
- func (app *Vminsert) PrometheusAPIV1ImportPrometheus(t *testing.T, records []string, opts QueryOpts)
- func (app *Vminsert) PrometheusAPIV1Write(t *testing.T, records []prompb.TimeSeries, opts QueryOpts)
- func (app Vminsert) Stop()
- func (app *Vminsert) String() string
- type Vmselect
- func (app *Vmselect) APIV1AdminTSDBDeleteSeries(t *testing.T, matchQuery string, opts QueryOpts)
- func (app *Vmselect) APIV1AdminTenants(t *testing.T) *AdminTenantsResponse
- func (app *Vmselect) APIV1StatusTSDB(t *testing.T, matchQuery string, date string, topN string, opts QueryOpts) TSDBStatusResponse
- func (app *Vmselect) ClusternativeListenAddr() string
- func (app *Vmselect) GraphiteMetricsIndex(t *testing.T, opts QueryOpts) GraphiteMetricsIndexResponse
- func (app *Vmselect) HTTPAddr() string
- func (app *Vmselect) MetricNamesStats(t *testing.T, limit, le, matchPattern string, opts QueryOpts) MetricNamesStatsResponse
- func (app *Vmselect) MetricNamesStatsReset(t *testing.T, opts QueryOpts)
- func (app Vmselect) Name() string
- func (app *Vmselect) PrometheusAPIV1Export(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
- func (app *Vmselect) PrometheusAPIV1ExportNative(t *testing.T, query string, opts QueryOpts) []byte
- func (app *Vmselect) PrometheusAPIV1LabelValues(t *testing.T, labelName, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelValuesResponse
- func (app *Vmselect) PrometheusAPIV1Labels(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelsResponse
- func (app *Vmselect) PrometheusAPIV1Query(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
- func (app *Vmselect) PrometheusAPIV1QueryRange(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
- func (app *Vmselect) PrometheusAPIV1Series(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1SeriesResponse
- func (app *Vmselect) PrometheusAPIV1SeriesCount(t *testing.T, opts QueryOpts) *PrometheusAPIV1SeriesCountResponse
- func (app Vmselect) Stop()
- func (app *Vmselect) String() string
- type Vmsingle
- func (app *Vmsingle) APIV1AdminStatusMetricNamesStatsReset(t *testing.T, opts QueryOpts)
- func (app *Vmsingle) APIV1AdminTSDBDeleteSeries(t *testing.T, matchQuery string, opts QueryOpts)
- func (app *Vmsingle) APIV1AdminTSDBSnapshot(t *testing.T) *APIV1AdminTSDBSnapshotResponse
- func (app *Vmsingle) APIV1StatusMetricNamesStats(t *testing.T, limit, le, matchPattern string, opts QueryOpts) MetricNamesStatsResponse
- func (app *Vmsingle) APIV1StatusTSDB(t *testing.T, matchQuery string, date string, topN string, opts QueryOpts) TSDBStatusResponse
- func (app *Vmsingle) ForceFlush(t *testing.T)
- func (app *Vmsingle) ForceMerge(t *testing.T)
- func (app *Vmsingle) GraphiteMetricsIndex(t *testing.T, _ QueryOpts) GraphiteMetricsIndexResponse
- func (app *Vmsingle) GraphiteWrite(t *testing.T, records []string, _ QueryOpts)
- func (app *Vmsingle) HTTPAddr() string
- func (app *Vmsingle) InfluxWrite(t *testing.T, records []string, opts QueryOpts)
- func (app Vmsingle) Name() string
- func (app *Vmsingle) OpenTSDBAPIPut(t *testing.T, records []string, opts QueryOpts)
- func (app *Vmsingle) PrometheusAPIV1Export(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
- func (app *Vmsingle) PrometheusAPIV1ExportNative(t *testing.T, query string, opts QueryOpts) []byte
- func (app *Vmsingle) PrometheusAPIV1ImportCSV(t *testing.T, records []string, opts QueryOpts)
- func (app *Vmsingle) PrometheusAPIV1ImportNative(t *testing.T, data []byte, opts QueryOpts)
- func (app *Vmsingle) PrometheusAPIV1ImportPrometheus(t *testing.T, records []string, opts QueryOpts)
- func (app *Vmsingle) PrometheusAPIV1LabelValues(t *testing.T, labelName, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelValuesResponse
- func (app *Vmsingle) PrometheusAPIV1Labels(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelsResponse
- func (app *Vmsingle) PrometheusAPIV1Query(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
- func (app *Vmsingle) PrometheusAPIV1QueryRange(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
- func (app *Vmsingle) PrometheusAPIV1Series(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1SeriesResponse
- func (app *Vmsingle) PrometheusAPIV1SeriesCount(t *testing.T, opts QueryOpts) *PrometheusAPIV1SeriesCountResponse
- func (app *Vmsingle) PrometheusAPIV1Write(t *testing.T, records []prompb.TimeSeries, _ QueryOpts)
- func (app *Vmsingle) SnapshotCreate(t *testing.T) *SnapshotCreateResponse
- func (app *Vmsingle) SnapshotCreateURL() string
- func (app *Vmsingle) SnapshotDelete(t *testing.T, snapshotName string) *SnapshotDeleteResponse
- func (app *Vmsingle) SnapshotDeleteAll(t *testing.T) *SnapshotDeleteAllResponse
- func (app *Vmsingle) SnapshotList(t *testing.T) *SnapshotListResponse
- func (app Vmsingle) Stop()
- func (app *Vmsingle) String() string
- type Vmstorage
- func (app *Vmstorage) ForceFlush(t *testing.T)
- func (app *Vmstorage) ForceMerge(t *testing.T)
- func (app Vmstorage) Name() string
- func (app *Vmstorage) SnapshotCreate(t *testing.T) *SnapshotCreateResponse
- func (app *Vmstorage) SnapshotCreateURL() string
- func (app *Vmstorage) SnapshotDelete(t *testing.T, snapshotName string) *SnapshotDeleteResponse
- func (app *Vmstorage) SnapshotDeleteAll(t *testing.T) *SnapshotDeleteAllResponse
- func (app *Vmstorage) SnapshotList(t *testing.T) *SnapshotListResponse
- func (app Vmstorage) Stop()
- func (app *Vmstorage) String() string
- func (app *Vmstorage) VminsertAddr() string
- func (app *Vmstorage) VmselectAddr() string
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartVmbackup ¶ added in v1.102.23
func StartVmbackup(instance, storageDataPath, snapshotCreateURL, dst string, output io.Writer) error
StartVmbackup starts an instance of vmbackup with the given flags and waits until it exits.
func StartVmctl ¶ added in v1.102.23
StartVmctl starts an instance of vmctl cli with the given flags
Types ¶
type APIV1AdminTSDBSnapshotResponse ¶ added in v1.102.18
type APIV1AdminTSDBSnapshotResponse struct {
Status string
Data *SnapshotData
}
APIV1AdminTSDBSnapshotResponse is an in-memory representation of the json response returned by the /api/v1/admin/tsdb/snapshot endpoint.
type AdminTenantsResponse ¶ added in v1.102.24
AdminTenantsResponse is an in-memory representation of the json response returned by the /api/v1/admin/tenants endpoint.
type AssertOptions ¶ added in v1.97.13
type AssertOptions struct {
Msg string
Got func() any
Want any
CmpOpts []cmp.Option
DoNotRetry bool
Retries int
Period time.Duration
FailNow bool
}
AssertOptions hold the assertion params, such as got and wanted values as well as the message that should be included into the assertion error message in case of failure.
In VictoriaMetrics (especially the cluster version) the inserted data does not become visible for querying right away. Therefore, the first comparisons may fail. AssertOptions allow to configure how many times the actual result must be retrieved and compared with the expected one and for long to wait between the retries. If these two params (`Retries` and `Period`) are not set, the default values will be used.
If it is known that the data is available, then the retry functionality can be disabled by setting the `DoNotRetry` field.
AssertOptions are used by the TestCase.Assert() method, and this method uses cmp.Diff() from go-cmp package for comparing got and wanted values. AssertOptions, therefore, allows to pass cmp.Options to cmp.Diff() via `CmpOpts` field.
Finally the `FailNow` field controls whether the assertion should fail using `testing.T.Errorf()` or `testing.T.Fatalf()`.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used for interacting with the apps over the network.
func (*Client) CloseConnections ¶
func (c *Client) CloseConnections()
CloseConnections closes client connections.
func (*Client) Delete ¶ added in v1.102.18
Delete sends a HTTP DELETE request and returns the response body and status code to the caller.
func (*Client) Get ¶
Get sends a HTTP GET request, returns the response body and status code to the caller.
func (*Client) Post ¶
Post sends a HTTP POST request, returns the response body and status code to the caller.
type ClusterOptions ¶ added in v1.97.15
type ClusterOptions struct {
Vmstorage1Instance string
Vmstorage1Binary string
Vmstorage1Flags []string
Vmstorage2Instance string
Vmstorage2Binary string
Vmstorage2Flags []string
VminsertInstance string
VminsertFlags []string
VmselectInstance string
VmselectFlags []string
}
ClusterOptions holds the params for simple cluster configuration suitable for most tests.
The cluster consists of two vmstorages, one vminsert and one vmselect, no data replication.
Such configuration is suitable for tests that don't verify the cluster-specific behavior (such as sharding, replication, or multilevel vmselect) but instead just need a typical cluster configuration to verify some business logic (such as API surface, or MetricsQL). Such cluster tests usually come paired with corresponding vmsingle tests.
type GraphiteMetricsIndexResponse ¶ added in v1.102.25
type GraphiteMetricsIndexResponse = []string
GraphiteMetricsIndexResponse is an in-memory representation of the json response returned by the /graphite/metrics/index.json endpoint.
type LogsQLQueryResponse ¶ added in v1.102.24
type LogsQLQueryResponse struct {
LogLines []string
}
LogsQLQueryResponse is an in-memory representation of the /select/logsql/query response.
func NewLogsQLQueryResponse ¶ added in v1.102.24
func NewLogsQLQueryResponse(t *testing.T, s string) *LogsQLQueryResponse
NewLogsQLQueryResponse is a test helper function that creates a new instance of LogsQLQueryResponse by unmarshalling a json string.
type MetricNamesStatsRecord ¶ added in v1.102.16
MetricNamesStatsRecord is a record item for MetricNamesStatsResponse
type MetricNamesStatsResponse ¶ added in v1.102.16
type MetricNamesStatsResponse struct {
Records []MetricNamesStatsRecord
}
MetricNamesStatsResponse is an inmemory representation of the /api/v1/status/metric_names_stats API response
type PrometheusAPIV1LabelValuesResponse ¶ added in v1.102.26
type PrometheusAPIV1LabelValuesResponse struct {
Status string
IsPartial bool
Data []string
Trace *Trace
ErrorType string
Error string
}
PrometheusAPIV1LabelValuesResponse is an inmemory representation of the /prometheus/api/v1/labels/.../values response.
func NewPrometheusAPIV1LabelValuesResponse ¶ added in v1.102.26
func NewPrometheusAPIV1LabelValuesResponse(t *testing.T, s string) *PrometheusAPIV1LabelValuesResponse
NewPrometheusAPIV1LabelValuesResponse is a test helper function that creates a new instance of PrometheusAPIV1LabelValuesResponse by unmarshalling a json string.
type PrometheusAPIV1LabelsResponse ¶ added in v1.102.26
type PrometheusAPIV1LabelsResponse struct {
Status string
IsPartial bool
Data []string
Trace *Trace
ErrorType string
Error string
}
PrometheusAPIV1LabelsResponse is an inmemory representation of the /prometheus/api/v1/labels response.
func NewPrometheusAPIV1LabelsResponse ¶ added in v1.102.26
func NewPrometheusAPIV1LabelsResponse(t *testing.T, s string) *PrometheusAPIV1LabelsResponse
NewPrometheusAPIV1LabelsResponse is a test helper function that creates a new instance of PrometheusAPIV1LabelsResponse by unmarshalling a json string.
type PrometheusAPIV1QueryResponse ¶ added in v1.97.12
type PrometheusAPIV1QueryResponse struct {
Status string
Data *QueryData
ErrorType string
Error string
IsPartial bool
}
PrometheusAPIV1QueryResponse is an inmemory representation of the /prometheus/api/v1/query or /prometheus/api/v1/query_range response.
func NewPrometheusAPIV1QueryResponse ¶ added in v1.97.12
func NewPrometheusAPIV1QueryResponse(t *testing.T, s string) *PrometheusAPIV1QueryResponse
NewPrometheusAPIV1QueryResponse is a test helper function that creates a new instance of PrometheusAPIV1QueryResponse by unmarshalling a json string.
func (*PrometheusAPIV1QueryResponse) Sort ¶ added in v1.97.15
func (pqr *PrometheusAPIV1QueryResponse) Sort()
Sort performs data.Result sort by metric labels
type PrometheusAPIV1SeriesCountResponse ¶ added in v1.102.26
type PrometheusAPIV1SeriesCountResponse struct {
Status string
IsPartial bool
Data []uint64
Trace *Trace
ErrorType string
Error string
}
PrometheusAPIV1SeriesCountResponse is an inmemory representation of the /prometheus/api/v1/series/count response.
func NewPrometheusAPIV1SeriesCountResponse ¶ added in v1.102.26
func NewPrometheusAPIV1SeriesCountResponse(t *testing.T, s string) *PrometheusAPIV1SeriesCountResponse
NewPrometheusAPIV1SeriesCountResponse is a test helper function that creates a new instance of PrometheusAPIV1SeriesCountResponse by unmarshalling a json string.
type PrometheusAPIV1SeriesResponse ¶
type PrometheusAPIV1SeriesResponse struct {
Status string
IsPartial bool
Data []map[string]string
Trace *Trace
ErrorType string
Error string
}
PrometheusAPIV1SeriesResponse is an inmemory representation of the /prometheus/api/v1/series response.
func NewPrometheusAPIV1SeriesResponse ¶ added in v1.97.12
func NewPrometheusAPIV1SeriesResponse(t *testing.T, s string) *PrometheusAPIV1SeriesResponse
NewPrometheusAPIV1SeriesResponse is a test helper function that creates a new instance of PrometheusAPIV1SeriesResponse by unmarshalling a json string.
func (*PrometheusAPIV1SeriesResponse) Sort ¶ added in v1.97.13
func (r *PrometheusAPIV1SeriesResponse) Sort() *PrometheusAPIV1SeriesResponse
Sort sorts the response data.
type PrometheusQuerier ¶ added in v1.97.12
type PrometheusQuerier interface {
PrometheusAPIV1Export(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1Query(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1QueryRange(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1Series(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1SeriesResponse
PrometheusAPIV1SeriesCount(t *testing.T, opts QueryOpts) *PrometheusAPIV1SeriesCountResponse
PrometheusAPIV1Labels(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1LabelsResponse
PrometheusAPIV1LabelValues(t *testing.T, labelName, query string, opts QueryOpts) *PrometheusAPIV1LabelValuesResponse
PrometheusAPIV1ExportNative(t *testing.T, query string, opts QueryOpts) []byte
APIV1AdminTSDBDeleteSeries(t *testing.T, matchQuery string, opts QueryOpts)
// TODO(@rtm0): Prometheus does not provide this API. Either move it to a
// separate interface or rename this interface to allow for multiple querier
// types.
GraphiteMetricsIndex(t *testing.T, opts QueryOpts) GraphiteMetricsIndexResponse
}
PrometheusQuerier contains methods available to Prometheus-like HTTP API for Querying
type PrometheusWriteQuerier ¶ added in v1.97.13
type PrometheusWriteQuerier interface {
Writer
PrometheusQuerier
StorageFlusher
StorageMerger
}
PrometheusWriteQuerier encompasses the methods for writing, flushing and querying the data.
type QueryData ¶ added in v1.97.12
type QueryData struct {
ResultType string
Result []*QueryResult
}
QueryData holds the query result along with its type.
type QueryOpts ¶ added in v1.97.12
type QueryOpts struct {
Tenant string
Timeout string
Start string
End string
Time string
Step string
ExtraFilters []string
ExtraLabels []string
Trace string
ReduceMemUsage string
MaxLookback string
LatencyOffset string
Format string
}
QueryOpts contains various params used for querying or ingesting data
type QueryResult ¶ added in v1.97.12
type QueryResult struct {
Metric map[string]string
Sample *Sample `json:"value"`
Samples []*Sample `json:"values"`
}
QueryResult holds the metric name (in the form of label name-value collection) and its samples.
Sample or Samples field is set for /prometheus/api/v1/query or /prometheus/api/v1/query_range response respectively.
type Sample ¶ added in v1.97.12
Sample is a timeseries value at a given timestamp.
func NewSample ¶ added in v1.97.12
NewSample is a test helper function that creates a new sample out of time in RFC3339 format and a value.
func (*Sample) UnmarshalJSON ¶ added in v1.97.12
UnmarshalJSON populates the sample fields from a JSON string.
type ServesMetrics ¶
type ServesMetrics struct {
// contains filtered or unexported fields
}
ServesMetrics is used to retrieve the app's metrics.
This type is expected to be embedded by the apps that serve metrics.
func (*ServesMetrics) GetIntMetric ¶
func (app *ServesMetrics) GetIntMetric(t *testing.T, metricName string) int
GetIntMetric retrieves the value of a metric served by an app at /metrics URL. The value is then converted to int.
func (*ServesMetrics) GetMetric ¶
func (app *ServesMetrics) GetMetric(t *testing.T, metricName string) float64
GetMetric retrieves the value of a metric served by an app at /metrics URL.
func (*ServesMetrics) GetMetricsByPrefix ¶ added in v1.97.13
func (app *ServesMetrics) GetMetricsByPrefix(t *testing.T, prefix string) []float64
GetMetricsByPrefix retrieves the values of all metrics that start with given prefix.
func (*ServesMetrics) GetMetricsByRegexp ¶ added in v1.110.16
type SnapshotCreateResponse ¶ added in v1.102.18
SnapshotCreateResponse is an in-memory representation of the json response returned by the /snapshot/create endpoint.
type SnapshotData ¶ added in v1.102.18
type SnapshotData struct {
Name string
}
SnapshotData holds the info about the snapshot created via /api/v1/admin/tsdb/snapshot endpoint.
type SnapshotDeleteAllResponse ¶ added in v1.102.18
type SnapshotDeleteAllResponse struct {
Status string
}
SnapshotDeleteAllResponse is an in-memory representation of the json response returned by the /snapshot/delete_all endpoint.
type SnapshotDeleteResponse ¶ added in v1.102.18
SnapshotDeleteResponse is an in-memory representation of the json response returned by the /snapshot/delete endpoint.
type SnapshotListResponse ¶ added in v1.102.18
SnapshotListResponse is an in-memory representation of the json response returned by the /snapshot/list endpoint.
type Stopper ¶ added in v1.97.12
type Stopper interface {
Stop()
}
Stopper is an interface of objects that needs to be stopped via Stop() call
type StorageFlusher ¶ added in v1.97.13
StorageFlusher defines a method that forces the flushing of data inserted into the storage, so it becomes available for searching immediately.
type StorageMerger ¶ added in v1.102.17
StorageMerger defines a method that forces the merging of data inserted into the storage.
type TSDBStatusResponse ¶ added in v1.102.19
type TSDBStatusResponse struct {
IsPartial bool
Data TSDBStatusResponseData
}
TSDBStatusResponse is an in-memory representation of the json response returned by the /prometheus/api/v1/status/tsdb endpoint.
func (*TSDBStatusResponse) Sort ¶ added in v1.102.19
func (tsr *TSDBStatusResponse) Sort()
Sort performs sorting of stats entries
type TSDBStatusResponseData ¶ added in v1.102.19
type TSDBStatusResponseData struct {
TotalSeries int
TotalLabelValuePairs int
SeriesCountByMetricName []TSDBStatusResponseMetricNameEntry
SeriesCountByLabelName []TSDBStatusResponseEntry
SeriesCountByFocusLabelValue []TSDBStatusResponseEntry
SeriesCountByLabelValuePair []TSDBStatusResponseEntry
LabelValueCountByLabelName []TSDBStatusResponseEntry
}
TSDBStatusResponseData is a part of TSDBStatusResponse
type TSDBStatusResponseEntry ¶ added in v1.102.19
TSDBStatusResponseEntry defines stats entry for TSDBStatusResponseData
type TSDBStatusResponseMetricNameEntry ¶ added in v1.102.19
type TSDBStatusResponseMetricNameEntry struct {
Name string
Count int
RequestsCount int
LastRequestTimestamp int
}
TSDBStatusResponseMetricNameEntry defines metric names stats entry for TSDBStatusResponseData
type TestCase ¶
type TestCase struct {
// contains filtered or unexported fields
}
TestCase holds the state and defines clean-up procedure common for all test cases.
func (*TestCase) Assert ¶ added in v1.97.13
func (tc *TestCase) Assert(opts *AssertOptions)
Assert compares the actual result with the expected one possibly multiple times in order to account for the fact that the inserted data does not become available for querying right away (especially in cluster version of VictoriaMetrics).
func (*TestCase) Client ¶
Client returns an instance of the client that can be used for interacting with the app(s) under test.
func (*TestCase) Dir ¶
Dir returns the directory name that should be used by as the -storageDataDir.
func (*TestCase) ForceFlush ¶ added in v1.97.14
ForceFlush flushes zero or more storages.
func (*TestCase) MustStartCluster ¶ added in v1.97.15
func (tc *TestCase) MustStartCluster(opts *ClusterOptions) *Vmcluster
MustStartCluster starts a typical cluster configuration with custom flags.
func (*TestCase) MustStartDefaultCluster ¶ added in v1.97.13
MustStartDefaultCluster starts a typical cluster configuration with default flags.
func (*TestCase) MustStartDefaultVmsingle ¶ added in v1.97.13
MustStartDefaultVmsingle is a test helper function that starts an instance of vmsingle with defaults suitable for most tests.
func (*TestCase) MustStartVmagent ¶ added in v1.102.19
func (tc *TestCase) MustStartVmagent(instance string, flags []string, promScrapeConfigFileYAML string) *Vmagent
MustStartVmagent is a test helper function that starts an instance of vmagent and fails the test if the app fails to start.
func (*TestCase) MustStartVmauth ¶ added in v1.102.13
MustStartVmauth is a test helper function that starts an instance of vmauth and fails the test if the app fails to start.
func (*TestCase) MustStartVmbackup ¶ added in v1.102.23
MustStartVmbackup is a test helper that starts an instance of vmbackup and waits until the app exits. It fails the test if the app fails to start or exits with non zero code.
func (*TestCase) MustStartVmctl ¶ added in v1.102.23
MustStartVmctl is a test helper function that starts an instance of vmctl
func (*TestCase) MustStartVminsert ¶ added in v1.97.12
MustStartVminsert is a test helper function that starts an instance of vminsert and fails the test if the app fails to start.
func (*TestCase) MustStartVmrestore ¶ added in v1.102.23
MustStartVmrestore is a test helper that starts an instance of vmrestore and waits until the app exits. It fails the test if the app fails to start or exits with non zero code.
func (*TestCase) MustStartVmselect ¶ added in v1.97.12
MustStartVmselect is a test helper function that starts an instance of vmselect and fails the test if the app fails to start.
func (*TestCase) MustStartVmsingle ¶ added in v1.97.12
MustStartVmsingle is a test helper function that starts an instance of vmsingle located at ../../bin/victoria-metrics and fails the test if the app fails to start.
func (*TestCase) MustStartVmsingleAt ¶ added in v1.102.26
MustStartVmsingleAt is a test helper function that starts an instance of vmsingle and fails the test if the app fails to start.
func (*TestCase) MustStartVmstorage ¶ added in v1.97.12
MustStartVmstorage is a test helper function that starts an instance of vmstorage located at ../../bin/vmstorage and fails the test if the app fails to start.
func (*TestCase) MustStartVmstorageAt ¶ added in v1.102.26
MustStartVmstorageAt is a test helper function that starts an instance of vmstorage and fails the test if the app fails to start.
func (*TestCase) Stop ¶ added in v1.97.12
func (tc *TestCase) Stop()
Stop performs the test case clean up, such as closing all client connections and removing the -storageDataDir directory.
Note that the -storageDataDir is not removed in case of test case failure to allow for further manual debugging.
func (*TestCase) StopApp ¶ added in v1.97.14
StopApp stops the app identified by the `instance` name and removes it from the collection of started apps.
func (*TestCase) StopPrometheusWriteQuerier ¶ added in v1.102.14
func (tc *TestCase) StopPrometheusWriteQuerier(pwq PrometheusWriteQuerier)
StopPrometheusWriteQuerier stop all apps that are a part of the pwq.
type Trace ¶ added in v1.97.14
Trace provides the description and the duration of some unit of work that has been performed during the request processing.
type Vmagent ¶ added in v1.102.19
type Vmagent struct {
*ServesMetrics
// contains filtered or unexported fields
}
Vmagent holds the state of a vmagent app and provides vmagent-specific functions
func StartVmagent ¶ added in v1.102.19
func StartVmagent(instance string, flags []string, cli *Client, promScrapeConfigFilePath string, output io.Writer) (*Vmagent, error)
StartVmagent starts an instance of vmagent with the given flags. It also sets the default flags and populates the app instance state with runtime values extracted from the application log (such as httpListenAddr)
func (*Vmagent) APIV1ImportPrometheus ¶ added in v1.102.19
APIV1ImportPrometheus is a test helper function that inserts a collection of records in Prometheus text exposition format for the given tenant by sending a HTTP POST request to /api/v1/import/prometheus vmagent endpoint.
The call is blocked until the data is flushed to vmstorage or the timeout is reached.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1importprometheus
func (*Vmagent) APIV1ImportPrometheusNoWaitFlush ¶ added in v1.102.19
APIV1ImportPrometheusNoWaitFlush is a test helper function that inserts a collection of records in Prometheus text exposition format for the given tenant by sending a HTTP POST request to /api/v1/import/prometheus vmagent endpoint.
The call accepts the records but does not guarantee successful flush to vmstorage. Flushing may still be in progress on the function return.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1importprometheus
func (Vmagent) Name ¶ added in v1.102.19
func (app Vmagent) Name() string
Name returns the application instance name.
func (*Vmagent) ReloadRelabelConfigs ¶ added in v1.102.24
ReloadRelabelConfigs sends SIGHUP to trigger relabel config reload and waits until vmagent_relabel_config_reloads_total increases. Fails the test if no reload is detected within 3 seconds.
func (*Vmagent) RemoteWritePacketsDroppedTotal ¶ added in v1.102.19
RemoteWritePacketsDroppedTotal sums up the total number of dropped remote write packets.
func (*Vmagent) RemoteWritePendingInmemoryBlocks ¶ added in v1.110.16
RemoteWritePendingInmemoryBlocks sums up the total number of pending in-memory blocks for given remote write URL.
func (*Vmagent) RemoteWriteRequests ¶ added in v1.110.16
RemoteWriteRequests sums up the total number of sending requests for given remote write URL.
func (*Vmagent) RemoteWriteRequestsRetriesCountTotal ¶ added in v1.102.19
RemoteWriteRequestsRetriesCountTotal sums up the total retries for remote write requests.
func (*Vmagent) RemoteWriteSamplesDropped ¶ added in v1.110.16
RemoteWriteSamplesDropped sums up the total number of dropped remote write samples for given remote write URL.
type Vmauth ¶ added in v1.102.13
type Vmauth struct {
*ServesMetrics
// contains filtered or unexported fields
}
Vmauth holds the state of a vmauth app and provides vmauth-specific functions.
func StartVmauth ¶ added in v1.102.13
func StartVmauth(instance string, flags []string, cli *Client, configFilePath string, output io.Writer) (*Vmauth, error)
StartVmauth starts an instance of vmauth with the given flags. It also sets the default flags and populates the app instance state with runtime values extracted from the application log (such as httpListenAddr)
func (*Vmauth) GetHTTPListenAddr ¶ added in v1.102.13
GetHTTPListenAddr returns listen http addr
func (Vmauth) Name ¶ added in v1.102.13
func (app Vmauth) Name() string
Name returns the application instance name.
func (Vmauth) Stop ¶ added in v1.102.13
func (app Vmauth) Stop()
Stop sends the app process a SIGINT signal and waits until it terminates gracefully.
func (Vmauth) String ¶ added in v1.102.13
func (app Vmauth) String() string
String returns the string representation of the app state.
func (*Vmauth) UpdateConfiguration ¶ added in v1.102.13
UpdateConfiguration updates the vmauth configuration file with the provided YAML content, sends SIGHUP to trigger config reload and waits until vmauth_config_last_reload_total increases. Fails the test if no reload is detected within 2 seconds.
type Vmcluster ¶ added in v1.102.14
Vmcluster represents a typical cluster setup: several vmstorage replicas, one vminsert, and one vmselect.
Both Vmsingle and Vmcluster implement the PrometheusWriteQuerier used in business logic tests to abstract out the infrastructure.
This type is not suitable for infrastructure tests where custom cluster setups are often required.
func (*Vmcluster) ForceFlush ¶ added in v1.102.14
ForceFlush forces the ingested data to become visible for searching immediately.
func (*Vmcluster) ForceMerge ¶ added in v1.102.17
ForceMerge is a test helper function that forces the merging of parts.
type Vminsert ¶
type Vminsert struct {
*ServesMetrics
// contains filtered or unexported fields
}
Vminsert holds the state of a vminsert app and provides vminsert-specific functions.
func StartVminsert ¶
func StartVminsert(instance string, flags []string, cli *Client, output io.Writer) (*Vminsert, error)
StartVminsert starts an instance of vminsert with the given flags. It also sets the default flags and populates the app instance state with runtime values extracted from the application log (such as httpListenAddr)
func (*Vminsert) ClusternativeListenAddr ¶ added in v1.97.14
ClusternativeListenAddr returns the address at which the vminsert process is listening for connections from other vminsert apps.
func (*Vminsert) GraphiteWrite ¶ added in v1.102.20
GraphiteWrite is a test helper function that sends a collection of records to graphiteListenAddr port.
See https://docs.victoriametrics.com/victoriametrics/integrations/graphite/#ingesting
func (*Vminsert) HTTPAddr ¶ added in v1.102.23
HTTPAddr returns the address at which the vminsert process is listening for incoming HTTP requests.
func (*Vminsert) InfluxWrite ¶ added in v1.97.15
InfluxWrite is a test helper function that inserts a collection of records in Influx line format by sending a HTTP POST request to /influx/write vmsingle endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#influxwrite
func (Vminsert) Name ¶ added in v1.97.14
func (app Vminsert) Name() string
Name returns the application instance name.
func (*Vminsert) OpenTSDBAPIPut ¶ added in v1.102.20
OpenTSDBAPIPut is a test helper function that inserts a collection of records in OpenTSDB format for the given tenant by sending an HTTP POST request to /opentsdb/api/put vminsert endpoint.
See https://docs.victoriametrics.com/cluster-victoriametrics/#url-format
func (*Vminsert) PrometheusAPIV1ImportCSV ¶ added in v1.102.20
PrometheusAPIV1ImportCSV is a test helper function that inserts a collection of records in CSV format for the given tenant by sending an HTTP POST request to prometheus/api/v1/import/csv vminsert endpoint.
See https://docs.victoriametrics.com/cluster-victoriametrics/#url-format
func (*Vminsert) PrometheusAPIV1ImportNative ¶ added in v1.102.23
PrometheusAPIV1ImportNative is a test helper function that inserts a collection of records in Native format for the given tenant by sending an HTTP POST request to prometheus/api/v1/import/native vminsert endpoint.
See https://docs.victoriametrics.com/cluster-victoriametrics/#url-format
func (*Vminsert) PrometheusAPIV1ImportPrometheus ¶
func (app *Vminsert) PrometheusAPIV1ImportPrometheus(t *testing.T, records []string, opts QueryOpts)
PrometheusAPIV1ImportPrometheus is a test helper function that inserts a collection of records in Prometheus text exposition format for the given tenant by sending a HTTP POST request to /prometheus/api/v1/import/prometheus vminsert endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1importprometheus
func (*Vminsert) PrometheusAPIV1Write ¶ added in v1.97.13
func (app *Vminsert) PrometheusAPIV1Write(t *testing.T, records []prompb.TimeSeries, opts QueryOpts)
PrometheusAPIV1Write is a test helper function that inserts a collection of records in Prometheus remote-write format by sending a HTTP POST request to /prometheus/api/v1/write vminsert endpoint.
type Vmselect ¶
type Vmselect struct {
*ServesMetrics
// contains filtered or unexported fields
}
Vmselect holds the state of a vmselect app and provides vmselect-specific functions.
func StartVmselect ¶
func StartVmselect(instance string, flags []string, cli *Client, output io.Writer) (*Vmselect, error)
StartVmselect starts an instance of vmselect with the given flags. It also sets the default flags and populates the app instance state with runtime values extracted from the application log (such as httpListenAddr)
func (*Vmselect) APIV1AdminTSDBDeleteSeries ¶ added in v1.102.26
APIV1AdminTSDBDeleteSeries deletes the series that match the query by sending a request to /api/v1/admin/tsdb/delete_series.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1admintsdbdelete_series
func (*Vmselect) APIV1AdminTenants ¶ added in v1.102.24
func (app *Vmselect) APIV1AdminTenants(t *testing.T) *AdminTenantsResponse
APIV1AdminTenants sends a query to a /admin/tenants endpoint
func (*Vmselect) APIV1StatusTSDB ¶ added in v1.102.19
func (app *Vmselect) APIV1StatusTSDB(t *testing.T, matchQuery string, date string, topN string, opts QueryOpts) TSDBStatusResponse
APIV1StatusTSDB sends a query to a /prometheus/api/v1/status/tsdb // See https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#tsdb-stats
func (*Vmselect) ClusternativeListenAddr ¶
ClusternativeListenAddr returns the address at which the vmselect process is listening for connections from other vmselect apps.
func (*Vmselect) GraphiteMetricsIndex ¶ added in v1.102.25
func (app *Vmselect) GraphiteMetricsIndex(t *testing.T, opts QueryOpts) GraphiteMetricsIndexResponse
GraphiteMetricsIndex sends a query to a /graphite/metrics/index.json
See https://docs.victoriametrics.com/victoriametrics/integrations/graphite/#metrics-api
func (*Vmselect) HTTPAddr ¶ added in v1.102.24
HTTPAddr returns the address at which the vmselect process is listening for incoming HTTP requests.
func (*Vmselect) MetricNamesStats ¶ added in v1.102.16
func (app *Vmselect) MetricNamesStats(t *testing.T, limit, le, matchPattern string, opts QueryOpts) MetricNamesStatsResponse
MetricNamesStats sends a query to a /select/tenant/prometheus/api/v1/status/metric_names_stats endpoint and returns the statistics response for given params.
func (*Vmselect) MetricNamesStatsReset ¶ added in v1.102.16
MetricNamesStatsReset sends a query to a /admin/api/v1/status/metric_names_stats/reset endpoint
func (Vmselect) Name ¶ added in v1.97.14
func (app Vmselect) Name() string
Name returns the application instance name.
func (*Vmselect) PrometheusAPIV1Export ¶ added in v1.97.13
func (app *Vmselect) PrometheusAPIV1Export(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1Export is a test helper function that performs the export of raw samples in JSON line format by sending a HTTP POST request to /prometheus/api/v1/export vmselect endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1export
func (*Vmselect) PrometheusAPIV1ExportNative ¶ added in v1.102.23
PrometheusAPIV1ExportNative is a test helper function that performs the export of raw samples in native binary format by sending an HTTP POST request to /prometheus/api/v1/export/native vmselect endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1exportnative
func (*Vmselect) PrometheusAPIV1LabelValues ¶ added in v1.102.26
func (app *Vmselect) PrometheusAPIV1LabelValues(t *testing.T, labelName, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelValuesResponse
PrometheusAPIV1LabelValues sends a query to a /prometheus/api/v1/label/.../values endpoint and returns the label names list of time series that match the query.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1labelvalues
func (*Vmselect) PrometheusAPIV1Labels ¶ added in v1.102.26
func (app *Vmselect) PrometheusAPIV1Labels(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelsResponse
PrometheusAPIV1Labels sends a query to a /prometheus/api/v1/labels endpoint and returns the label names list of time series that match the query.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1labels
func (*Vmselect) PrometheusAPIV1Query ¶ added in v1.97.12
func (app *Vmselect) PrometheusAPIV1Query(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1Query is a test helper function that performs PromQL/MetricsQL instant query by sending a HTTP POST request to /prometheus/api/v1/query vmselect endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1query
func (*Vmselect) PrometheusAPIV1QueryRange ¶ added in v1.97.12
func (app *Vmselect) PrometheusAPIV1QueryRange(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1QueryRange is a test helper function that performs PromQL/MetricsQL range query by sending a HTTP POST request to /prometheus/api/v1/query_range vmselect endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1query_range
func (*Vmselect) PrometheusAPIV1Series ¶
func (app *Vmselect) PrometheusAPIV1Series(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1SeriesResponse
PrometheusAPIV1Series sends a query to a /prometheus/api/v1/series endpoint and returns the list of time series that match the query.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1series
func (*Vmselect) PrometheusAPIV1SeriesCount ¶ added in v1.102.26
func (app *Vmselect) PrometheusAPIV1SeriesCount(t *testing.T, opts QueryOpts) *PrometheusAPIV1SeriesCountResponse
PrometheusAPIV1SeriesCount sends a query to a /prometheus/api/v1/series/count endpoint and returns the total number of time series.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1series
type Vmsingle ¶ added in v1.97.12
type Vmsingle struct {
*ServesMetrics
// contains filtered or unexported fields
}
Vmsingle holds the state of a vmsingle app and provides vmsingle-specific functions.
func StartVmsingleAt ¶ added in v1.102.26
func StartVmsingleAt(instance, binary string, flags []string, cli *Client, output io.Writer) (*Vmsingle, error)
StartVmsingleAt starts an instance of vmsingle with the given flags. It also sets the default flags and populates the app instance state with runtime values extracted from the application log (such as httpListenAddr).
func (*Vmsingle) APIV1AdminStatusMetricNamesStatsReset ¶ added in v1.102.16
APIV1AdminStatusMetricNamesStatsReset sends a query to a /api/v1/admin/status/metric_names_stats/reset endpoint
func (*Vmsingle) APIV1AdminTSDBDeleteSeries ¶ added in v1.102.26
APIV1AdminTSDBDeleteSeries deletes the series that match the query by sending a request to /api/v1/admin/tsdb/delete_series.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1admintsdbdelete_series
func (*Vmsingle) APIV1AdminTSDBSnapshot ¶ added in v1.102.18
func (app *Vmsingle) APIV1AdminTSDBSnapshot(t *testing.T) *APIV1AdminTSDBSnapshotResponse
APIV1AdminTSDBSnapshot creates a database snapshot by sending a query to the /api/v1/admin/tsdb/snapshot endpoint.
See https://prometheus.io/docs/prometheus/latest/querying/api/#snapshot.
func (*Vmsingle) APIV1StatusMetricNamesStats ¶ added in v1.102.16
func (app *Vmsingle) APIV1StatusMetricNamesStats(t *testing.T, limit, le, matchPattern string, opts QueryOpts) MetricNamesStatsResponse
APIV1StatusMetricNamesStats sends a query to a /api/v1/status/metric_names_stats endpoint and returns the statistics response for given params.
func (*Vmsingle) APIV1StatusTSDB ¶ added in v1.102.19
func (app *Vmsingle) APIV1StatusTSDB(t *testing.T, matchQuery string, date string, topN string, opts QueryOpts) TSDBStatusResponse
APIV1StatusTSDB sends a query to a /prometheus/api/v1/status/tsdb // See https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#tsdb-stats
func (*Vmsingle) ForceFlush ¶ added in v1.97.12
ForceFlush is a test helper function that forces the flushing of inserted data, so it becomes available for searching immediately.
func (*Vmsingle) ForceMerge ¶ added in v1.102.17
ForceMerge is a test helper function that forces the merging of parts.
func (*Vmsingle) GraphiteMetricsIndex ¶ added in v1.102.25
func (app *Vmsingle) GraphiteMetricsIndex(t *testing.T, _ QueryOpts) GraphiteMetricsIndexResponse
GraphiteMetricsIndex sends a query to a /metrics/index.json
See https://docs.victoriametrics.com/victoriametrics/integrations/graphite/#metrics-api
func (*Vmsingle) GraphiteWrite ¶ added in v1.102.20
GraphiteWrite is a test helper function that sends a collection of records to graphiteListenAddr port.
See https://docs.victoriametrics.com/victoriametrics/integrations/graphite/#ingesting
func (*Vmsingle) HTTPAddr ¶ added in v1.102.19
HTTPAddr returns the address at which the vmstorage process is listening for http connections.
func (*Vmsingle) InfluxWrite ¶ added in v1.97.15
InfluxWrite is a test helper function that inserts a collection of records in Influx line format by sending a HTTP POST request to /influx/write vmsingle endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#influxwrite
func (Vmsingle) Name ¶ added in v1.97.14
func (app Vmsingle) Name() string
Name returns the application instance name.
func (*Vmsingle) OpenTSDBAPIPut ¶ added in v1.102.20
OpenTSDBAPIPut is a test helper function that inserts a collection of records in OpenTSDB format for the given tenant by sending an HTTP POST request to /api/put vmsingle endpoint.
See https://docs.victoriametrics.com/victoriametrics/integrations/opentsdb/#sending-data-via-http
func (*Vmsingle) PrometheusAPIV1Export ¶ added in v1.97.13
func (app *Vmsingle) PrometheusAPIV1Export(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1Export is a test helper function that performs the export of raw samples in JSON line format by sending a HTTP POST request to /prometheus/api/v1/export vmsingle endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1export
func (*Vmsingle) PrometheusAPIV1ExportNative ¶ added in v1.102.23
PrometheusAPIV1ExportNative is a test helper function that performs the export of raw samples in native binary format by sending an HTTP POST request to /prometheus/api/v1/export/native vmselect endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1exportnative
func (*Vmsingle) PrometheusAPIV1ImportCSV ¶ added in v1.102.20
PrometheusAPIV1ImportCSV is a test helper function that inserts a collection of records in CSV format for the given tenant by sending an HTTP POST request to /api/v1/import/csv vmsingle endpoint.
See https://docs.victoriametrics.com/single-server-victoriametrics/#how-to-import-csv-data
func (*Vmsingle) PrometheusAPIV1ImportNative ¶ added in v1.102.23
PrometheusAPIV1ImportNative is a test helper function that inserts a collection of records in native format for the given tenant by sending an HTTP POST request to /api/v1/import/native vmsingle endpoint.
func (*Vmsingle) PrometheusAPIV1ImportPrometheus ¶ added in v1.97.12
func (app *Vmsingle) PrometheusAPIV1ImportPrometheus(t *testing.T, records []string, opts QueryOpts)
PrometheusAPIV1ImportPrometheus is a test helper function that inserts a collection of records in Prometheus text exposition format by sending a HTTP POST request to /prometheus/api/v1/import/prometheus vmsingle endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1importprometheus
func (*Vmsingle) PrometheusAPIV1LabelValues ¶ added in v1.102.26
func (app *Vmsingle) PrometheusAPIV1LabelValues(t *testing.T, labelName, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelValuesResponse
PrometheusAPIV1LabelValues sends a query to a /prometheus/api/v1/label/.../values endpoint and returns the label names list of time series that match the query.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1labelvalues
func (*Vmsingle) PrometheusAPIV1Labels ¶ added in v1.102.26
func (app *Vmsingle) PrometheusAPIV1Labels(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1LabelsResponse
PrometheusAPIV1Labels sends a query to a /prometheus/api/v1/labels endpoint and returns the label names list of time series that match the query.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1labels
func (*Vmsingle) PrometheusAPIV1Query ¶ added in v1.97.12
func (app *Vmsingle) PrometheusAPIV1Query(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1Query is a test helper function that performs PromQL/MetricsQL instant query by sending a HTTP POST request to /prometheus/api/v1/query vmsingle endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1query
func (*Vmsingle) PrometheusAPIV1QueryRange ¶ added in v1.97.12
func (app *Vmsingle) PrometheusAPIV1QueryRange(t *testing.T, query string, opts QueryOpts) *PrometheusAPIV1QueryResponse
PrometheusAPIV1QueryRange is a test helper function that performs PromQL/MetricsQL range query by sending a HTTP POST request to /prometheus/api/v1/query_range vmsingle endpoint.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1query_range
func (*Vmsingle) PrometheusAPIV1Series ¶ added in v1.97.12
func (app *Vmsingle) PrometheusAPIV1Series(t *testing.T, matchQuery string, opts QueryOpts) *PrometheusAPIV1SeriesResponse
PrometheusAPIV1Series sends a query to a /prometheus/api/v1/series endpoint and returns the list of time series that match the query.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1series
func (*Vmsingle) PrometheusAPIV1SeriesCount ¶ added in v1.102.26
func (app *Vmsingle) PrometheusAPIV1SeriesCount(t *testing.T, opts QueryOpts) *PrometheusAPIV1SeriesCountResponse
PrometheusAPIV1SeriesCount sends a query to a /prometheus/api/v1/series/count endpoint and returns the total number of time series.
See https://docs.victoriametrics.com/victoriametrics/url-examples/#apiv1series
func (*Vmsingle) PrometheusAPIV1Write ¶ added in v1.97.13
PrometheusAPIV1Write is a test helper function that inserts a collection of records in Prometheus remote-write format by sending a HTTP POST request to /prometheus/api/v1/write vmsingle endpoint.
func (*Vmsingle) SnapshotCreate ¶ added in v1.102.18
func (app *Vmsingle) SnapshotCreate(t *testing.T) *SnapshotCreateResponse
SnapshotCreate creates a database snapshot by sending a query to the /snapshot/create endpoint.
func (*Vmsingle) SnapshotCreateURL ¶ added in v1.102.23
SnapshotCreateURL returns the URL for creating snapshots.
func (*Vmsingle) SnapshotDelete ¶ added in v1.102.18
func (app *Vmsingle) SnapshotDelete(t *testing.T, snapshotName string) *SnapshotDeleteResponse
SnapshotDelete deletes a snapshot by sending a query to the /snapshot/delete endpoint.
func (*Vmsingle) SnapshotDeleteAll ¶ added in v1.102.18
func (app *Vmsingle) SnapshotDeleteAll(t *testing.T) *SnapshotDeleteAllResponse
SnapshotDeleteAll deletes all snapshots by sending a query to the /snapshot/delete_all endpoint.
func (*Vmsingle) SnapshotList ¶ added in v1.102.18
func (app *Vmsingle) SnapshotList(t *testing.T) *SnapshotListResponse
SnapshotList lists existing database snapshots by sending a query to the /snapshot/list endpoint.
type Vmstorage ¶
type Vmstorage struct {
*ServesMetrics
// contains filtered or unexported fields
}
Vmstorage holds the state of a vmstorage app and provides vmstorage-specific functions.
func StartVmstorageAt ¶ added in v1.102.26
func StartVmstorageAt(instance, binary string, flags []string, cli *Client, output io.Writer) (*Vmstorage, error)
StartVmstorageAt starts an instance of vmstorage with the given flags. It also sets the default flags and populates the app instance state with runtime values extracted from the application log (such as httpListenAddr)
func (*Vmstorage) ForceFlush ¶ added in v1.97.12
ForceFlush is a test helper function that forces the flushing of inserted data, so it becomes available for searching immediately.
func (*Vmstorage) ForceMerge ¶ added in v1.102.17
ForceMerge is a test helper function that forces the merging of parts.
func (Vmstorage) Name ¶ added in v1.97.14
func (app Vmstorage) Name() string
Name returns the application instance name.
func (*Vmstorage) SnapshotCreate ¶ added in v1.102.18
func (app *Vmstorage) SnapshotCreate(t *testing.T) *SnapshotCreateResponse
SnapshotCreate creates a database snapshot by sending a query to the /snapshot/create endpoint.
func (*Vmstorage) SnapshotCreateURL ¶ added in v1.102.23
SnapshotCreateURL returns the URL for creating snapshots.
func (*Vmstorage) SnapshotDelete ¶ added in v1.102.18
func (app *Vmstorage) SnapshotDelete(t *testing.T, snapshotName string) *SnapshotDeleteResponse
SnapshotDelete deletes a snapshot by sending a query to the /snapshot/delete endpoint.
func (*Vmstorage) SnapshotDeleteAll ¶ added in v1.102.18
func (app *Vmstorage) SnapshotDeleteAll(t *testing.T) *SnapshotDeleteAllResponse
SnapshotDeleteAll deletes all snapshots by sending a query to the /snapshot/delete_all endpoint.
func (*Vmstorage) SnapshotList ¶ added in v1.102.18
func (app *Vmstorage) SnapshotList(t *testing.T) *SnapshotListResponse
SnapshotList lists existing database snapshots by sending a query to the /snapshot/list endpoint.
func (Vmstorage) Stop ¶
func (app Vmstorage) Stop()
Stop sends the app process a SIGINT signal and waits until it terminates gracefully.
func (*Vmstorage) VminsertAddr ¶
VminsertAddr returns the address at which the vmstorage process is listening for vminsert connections.
func (*Vmstorage) VmselectAddr ¶
VmselectAddr returns the address at which the vmstorage process is listening for vmselect connections.
type Writer ¶ added in v1.102.20
type Writer interface {
// Prometheus APIs
PrometheusAPIV1Write(t *testing.T, records []prompb.TimeSeries, opts QueryOpts)
PrometheusAPIV1ImportPrometheus(t *testing.T, records []string, opts QueryOpts)
PrometheusAPIV1ImportCSV(t *testing.T, records []string, opts QueryOpts)
PrometheusAPIV1ImportNative(t *testing.T, data []byte, opts QueryOpts)
// Graphit APIs
GraphiteWrite(t *testing.T, records []string, opts QueryOpts)
// OpenTSDB APIs
OpenTSDBAPIPut(t *testing.T, records []string, opts QueryOpts)
}
Writer contains methods for writing new data