Documentation ¶
Index ¶
- Variables
- func FormatTime(t time.Time) string
- func GetDefaultEnvVariables() map[string]string
- func GetDefaultImage() string
- func GetMimirtoolImage() string
- func NoopFlagMapper(flags map[string]string) map[string]string
- type ActiveSeriesOption
- type AlertGroup
- type Client
- func (c *Client) ActiveNativeHistogramMetrics(selector string, options ...ActiveSeriesOption) (*cardinality.ActiveNativeHistogramMetricsResponse, error)
- func (c *Client) ActiveSeries(selector string, options ...ActiveSeriesOption) (*api.ActiveSeriesResponse, error)
- func (c *Client) CloseIdleConnections()
- func (c *Client) CreateSilence(ctx context.Context, silence types.Silence) (string, error)
- func (c *Client) DeleteAlertmanagerConfig(ctx context.Context) error
- func (c *Client) DeleteGrafanaAlertmanagerConfig(ctx context.Context) error
- func (c *Client) DeleteGrafanaAlertmanagerState(ctx context.Context) error
- func (c *Client) DeleteRuleGroup(namespace string, groupName string) error
- func (c *Client) DeleteRuleNamespace(namespace string) error
- func (c *Client) DeleteSilence(ctx context.Context, id string) error
- func (c *Client) DoGet(url string) (*http.Response, error)
- func (c *Client) DoGetBody(url string) (*http.Response, []byte, error)
- func (c *Client) DoPost(url string, body io.Reader) (*http.Response, error)
- func (c *Client) DoPostBody(url string, body io.Reader) (*http.Response, []byte, error)
- func (c *Client) GetAlertGroups(ctx context.Context) ([]AlertGroup, error)
- func (c *Client) GetAlertmanager(ctx context.Context, path string) (string, error)
- func (c *Client) GetAlertmanagerConfig(ctx context.Context) (*alertConfig.Config, error)
- func (c *Client) GetAlertmanagerStatusPage(ctx context.Context) ([]byte, error)
- func (c *Client) GetAlerts(ctx context.Context) ([]model.Alert, error)
- func (c *Client) GetGrafanaAlertmanagerConfig(ctx context.Context) (*alertmanager.UserGrafanaConfig, error)
- func (c *Client) GetGrafanaAlertmanagerState(ctx context.Context) (*alertmanager.UserGrafanaState, error)
- func (c *Client) GetPrometheusMetadata() (*http.Response, error)
- func (c *Client) GetPrometheusRules(maxGroups int, token string) ([]*promv1.RuleGroup, string, error)
- func (c *Client) GetReceivers(ctx context.Context) ([]string, error)
- func (c *Client) GetReceiversExperimental(ctx context.Context) ([]alertingmodels.Receiver, error)
- func (c *Client) GetRuleGroup(namespace string, groupName string) (*http.Response, error)
- func (c *Client) GetRuleGroups() (*http.Response, map[string][]rulefmt.RuleGroup, error)
- func (c *Client) GetSilence(ctx context.Context, id string) (types.Silence, error)
- func (c *Client) GetSilences(ctx context.Context) ([]types.Silence, error)
- func (c *Client) LabelNames(start, end time.Time, matches []string, opts ...promv1.Option) ([]string, error)
- func (c *Client) LabelNamesAndValues(selector string, limit int) (*api.LabelNamesCardinalityResponse, error)
- func (c *Client) LabelValues(label string, start, end time.Time, matches []string, opts ...promv1.Option) (model.LabelValues, error)
- func (c *Client) LabelValuesCardinality(labelNames []string, selector string, limit int) (*api.LabelValuesCardinalityResponse, error)
- func (c *Client) PostAlertmanager(ctx context.Context, path string) error
- func (c *Client) Push(timeseries []prompb.TimeSeries) (*http.Response, error)
- func (c *Client) PushOTLP(timeseries []prompb.TimeSeries, metadata []mimirpb.MetricMetadata) (*http.Response, error)
- func (c *Client) QuerierAddress() string
- func (c *Client) Query(query string, ts time.Time) (model.Value, error)
- func (c *Client) QueryExemplars(query string, start, end time.Time) ([]promv1.ExemplarQueryResult, error)
- func (c *Client) QueryRange(query string, start, end time.Time, step time.Duration) (model.Value, error)
- func (c *Client) QueryRangeRaw(query string, start, end time.Time, step time.Duration) (*http.Response, []byte, error)
- func (c *Client) QueryRaw(query string) (*http.Response, []byte, error)
- func (c *Client) QueryRawAt(query string, ts time.Time) (*http.Response, []byte, error)
- func (c *Client) RemoteRead(query *prompb.Query) (_ *http.Response, _ *prompb.QueryResult, plaintextResponse []byte, _ error)
- func (c *Client) RemoteReadChunks(query *prompb.Query) (_ *http.Response, _ []prompb.ChunkedReadResponse, plaintextResponse []byte, ...)
- func (c *Client) SendAlertToAlermanager(ctx context.Context, alert *model.Alert) error
- func (c *Client) Series(matches []string, start, end time.Time, opts ...promv1.Option) ([]model.LabelSet, error)
- func (c *Client) SetAlertmanagerConfig(ctx context.Context, amConfig string, templates map[string]string) error
- func (c *Client) SetGrafanaAlertmanagerConfig(ctx context.Context, createdAtTimestamp int64, cfg, hash, externalURL string, ...) error
- func (c *Client) SetGrafanaAlertmanagerState(ctx context.Context, state string) error
- func (c *Client) SetRuleGroup(rulegroup rulefmt.RuleGroup, namespace string) error
- func (c *Client) SetTimeout(t time.Duration)
- func (c *Client) TestReceiversExperimental(ctx context.Context, trConf alertingNotify.TestReceiversConfigBodyParams) (*alertingNotify.TestReceiversResult, error)
- func (c *Client) TestTemplatesExperimental(ctx context.Context, ttConf alertingNotify.TestTemplatesConfigBodyParams) (*alertingNotify.TestTemplatesResults, error)
- type ClientOption
- type CompositeMimirService
- type FlagMapper
- type MimirService
- func NewAlertmanager(name string, flags map[string]string, options ...Option) *MimirService
- func NewAlertmanagerWithTLS(name string, flags map[string]string, options ...Option) *MimirService
- func NewBackendInstance(name string, flags map[string]string, options ...Option) *MimirService
- func NewCompactor(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewDistributor(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewIngester(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewMimirService(name string, image string, command *e2e.Command, readiness e2e.ReadinessProbe, ...) *MimirService
- func NewOverridesExporter(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewQuerier(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewQueryFrontend(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewQueryScheduler(name string, flags map[string]string, options ...Option) *MimirService
- func NewReadInstance(name string, flags map[string]string, options ...Option) *MimirService
- func NewRuler(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewSingleBinary(name string, flags map[string]string, options ...Option) *MimirService
- func NewStoreGateway(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
- func NewWriteInstance(name string, flags map[string]string, options ...Option) *MimirService
- type Option
- type Options
- type S3Client
- type ServerStatus
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
func FormatTime ¶
FormatTime converts a time to a string acceptable by the Prometheus API.
func GetDefaultEnvVariables ¶
func GetDefaultImage ¶
func GetDefaultImage() string
GetDefaultImage returns the Docker image to use to run Mimir.
func GetMimirtoolImage ¶
func GetMimirtoolImage() string
Types ¶
type ActiveSeriesOption ¶
type ActiveSeriesOption func(*activeSeriesRequestConfig)
func WithEnableCompression ¶
func WithEnableCompression() ActiveSeriesOption
func WithQueryShards ¶
func WithQueryShards(n int) ActiveSeriesOption
func WithRequestMethod ¶
func WithRequestMethod(m string) ActiveSeriesOption
type AlertGroup ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client used to interact with Mimir in integration tests
func NewClient ¶
func NewClient( distributorAddress string, querierAddress string, alertmanagerAddress string, rulerAddress string, orgID string, opts ...ClientOption, ) (*Client, error)
NewClient makes a new Mimir client
func (*Client) ActiveNativeHistogramMetrics ¶
func (c *Client) ActiveNativeHistogramMetrics(selector string, options ...ActiveSeriesOption) (*cardinality.ActiveNativeHistogramMetricsResponse, error)
func (*Client) ActiveSeries ¶
func (c *Client) ActiveSeries(selector string, options ...ActiveSeriesOption) (*api.ActiveSeriesResponse, error)
func (*Client) CloseIdleConnections ¶
func (c *Client) CloseIdleConnections()
func (*Client) CreateSilence ¶
CreateSilence creates a new silence and returns the unique identifier of the silence.
func (*Client) DeleteAlertmanagerConfig ¶
DeleteAlertmanagerConfig gets the status of an alertmanager instance
func (*Client) DeleteGrafanaAlertmanagerConfig ¶
func (*Client) DeleteGrafanaAlertmanagerState ¶
func (*Client) DeleteRuleGroup ¶
DeleteRuleGroup deletes a rule group.
func (*Client) DeleteRuleNamespace ¶
DeleteRuleNamespace deletes all the rule groups (and the namespace itself).
func (*Client) DoGet ¶
DoGet performs a HTTP GET request towards the supplied URL. The request contains the X-Scope-OrgID header and the timeout configured by the client object.
func (*Client) DoGetBody ¶
DoGetBody performs a HTTP GET request towards the supplied URL and returns the full response body. The request contains the X-Scope-OrgID header and the timeout configured by the client object.
func (*Client) DoPost ¶
DoPost performs a HTTP POST request towards the supplied URL and using the given request body. The request contains the X-Scope-OrgID header and the timeout configured by the client object.
func (*Client) DoPostBody ¶
DoPostBody performs a HTTP POST request towards the supplied URL and returns the full response body. The request contains the X-Scope-OrgID header and the timeout configured by the client object.
func (*Client) GetAlertGroups ¶
func (c *Client) GetAlertGroups(ctx context.Context) ([]AlertGroup, error)
func (*Client) GetAlertmanager ¶
GetAlertmanager performs a GET request on a per-tenant alertmanager endpoint.
func (*Client) GetAlertmanagerConfig ¶
GetAlertmanagerConfig gets the status of an alertmanager instance
func (*Client) GetAlertmanagerStatusPage ¶
GetAlertmanagerStatusPage gets the status page of alertmanager.
func (*Client) GetGrafanaAlertmanagerConfig ¶
func (c *Client) GetGrafanaAlertmanagerConfig(ctx context.Context) (*alertmanager.UserGrafanaConfig, error)
func (*Client) GetGrafanaAlertmanagerState ¶
func (c *Client) GetGrafanaAlertmanagerState(ctx context.Context) (*alertmanager.UserGrafanaState, error)
func (*Client) GetPrometheusMetadata ¶
GetPrometheusMetadata fetches the metadata from the Prometheus endpoint /api/v1/metadata.
func (*Client) GetPrometheusRules ¶
func (c *Client) GetPrometheusRules(maxGroups int, token string) ([]*promv1.RuleGroup, string, error)
GetPrometheusRules fetches the rules from the Prometheus endpoint /api/v1/rules.
func (*Client) GetReceiversExperimental ¶
func (*Client) GetRuleGroup ¶
GetRuleGroup gets a rule group.
func (*Client) GetRuleGroups ¶
GetRuleGroups gets the configured rule groups from the ruler.
func (*Client) GetSilence ¶
func (*Client) GetSilences ¶
func (*Client) LabelNames ¶
func (c *Client) LabelNames(start, end time.Time, matches []string, opts ...promv1.Option) ([]string, error)
LabelNames gets label names
func (*Client) LabelNamesAndValues ¶
func (c *Client) LabelNamesAndValues(selector string, limit int) (*api.LabelNamesCardinalityResponse, error)
LabelNamesAndValues returns distinct label values per label name.
func (*Client) LabelValues ¶
func (c *Client) LabelValues(label string, start, end time.Time, matches []string, opts ...promv1.Option) (model.LabelValues, error)
LabelValues gets label values
func (*Client) LabelValuesCardinality ¶
func (c *Client) LabelValuesCardinality(labelNames []string, selector string, limit int) (*api.LabelValuesCardinalityResponse, error)
LabelValuesCardinality returns all values and series total count for each label name.
func (*Client) PostAlertmanager ¶
PostAlertmanager performs a POST request on a per-tenant alertmanager endpoint.
func (*Client) PushOTLP ¶
func (c *Client) PushOTLP(timeseries []prompb.TimeSeries, metadata []mimirpb.MetricMetadata) (*http.Response, error)
PushOTLP the input timeseries to the remote endpoint in OTLP format
func (*Client) QuerierAddress ¶
QuerierAddress returns the address of the querier
func (*Client) QueryExemplars ¶
func (c *Client) QueryExemplars(query string, start, end time.Time) ([]promv1.ExemplarQueryResult, error)
QueryExemplars runs an exemplar query.
func (*Client) QueryRange ¶
func (c *Client) QueryRange(query string, start, end time.Time, step time.Duration) (model.Value, error)
Query runs a query range.
func (*Client) QueryRangeRaw ¶
func (c *Client) QueryRangeRaw(query string, start, end time.Time, step time.Duration) (*http.Response, []byte, error)
QueryRangeRaw runs a ranged query directly against the querier API.
func (*Client) QueryRawAt ¶
func (*Client) RemoteRead ¶
func (c *Client) RemoteRead(query *prompb.Query) (_ *http.Response, _ *prompb.QueryResult, plaintextResponse []byte, _ error)
RemoteRead runs a remote read query against the querier. RemoteRead uses samples streaming. See RemoteReadChunks as well for chunks streaming. RemoteRead returns the HTTP response with consumed body, the remote read protobuf response and an error. In case the response is not a protobuf, the plaintext body content is returned instead of the protobuf message.
func (*Client) RemoteReadChunks ¶
func (c *Client) RemoteReadChunks(query *prompb.Query) (_ *http.Response, _ []prompb.ChunkedReadResponse, plaintextResponse []byte, _ error)
RemoteReadChunks runs a remote read query against the querier. RemoteReadChunks uses chunks streaming. See RemoteRead as well for samples streaming. RemoteReadChunks returns the HTTP response with consumed body, the remote read protobuf response and an error. In case the response is not a protobuf, the plaintext body content is returned instead of the protobuf message.
func (*Client) SendAlertToAlermanager ¶
SendAlertToAlermanager sends alerts to the Alertmanager API
func (*Client) Series ¶
func (c *Client) Series(matches []string, start, end time.Time, opts ...promv1.Option) ([]model.LabelSet, error)
Series finds series by label matchers.
func (*Client) SetAlertmanagerConfig ¶
func (c *Client) SetAlertmanagerConfig(ctx context.Context, amConfig string, templates map[string]string) error
SetAlertmanagerConfig gets the status of an alertmanager instance
func (*Client) SetGrafanaAlertmanagerConfig ¶
func (*Client) SetGrafanaAlertmanagerState ¶
func (*Client) SetRuleGroup ¶
SetRuleGroup configures the provided rulegroup to the ruler.
func (*Client) SetTimeout ¶
func (*Client) TestReceiversExperimental ¶
func (c *Client) TestReceiversExperimental(ctx context.Context, trConf alertingNotify.TestReceiversConfigBodyParams) (*alertingNotify.TestReceiversResult, error)
func (*Client) TestTemplatesExperimental ¶
func (c *Client) TestTemplatesExperimental(ctx context.Context, ttConf alertingNotify.TestTemplatesConfigBodyParams) (*alertingNotify.TestTemplatesResults, error)
type ClientOption ¶
type ClientOption func(*clientConfig)
func WithAddHeader ¶
func WithAddHeader(key, value string) ClientOption
func WithTripperware ¶
func WithTripperware(wrap querymiddleware.Tripperware) ClientOption
type CompositeMimirService ¶
type CompositeMimirService struct {
*e2e.CompositeHTTPService
}
CompositeMimirService abstract an higher-level service composed, under the hood, by 2+ MimirService.
func NewCompositeMimirService ¶
func NewCompositeMimirService(services ...*MimirService) *CompositeMimirService
type FlagMapper ¶
FlagMapper is the type of function that maps flags, just to reduce some verbosity.
func ChainFlagMappers ¶
func ChainFlagMappers(mappers ...FlagMapper) FlagMapper
ChainFlagMappers chains multiple flag mappers, each flag mapper gets a copy of the flags so it can safely modify the values. ChainFlagMappers(a, b)(flags) == b(copy(a(copy(flags)
func RemoveFlagMapper ¶
func RemoveFlagMapper(toRemove []string) FlagMapper
RemoveFlagMapper builds a flag mapper that remove flags.
func RenameFlagMapper ¶
func RenameFlagMapper(fromTo map[string]string) FlagMapper
RenameFlagMapper builds a flag mapper that renames flags.
func SetFlagMapper ¶
func SetFlagMapper(set map[string]string) FlagMapper
SetFlagMapper builds a flag mapper that sets the provided flags.
func (*FlagMapper) UnmarshalJSON ¶
func (fm *FlagMapper) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a single json object into a single FlagMapper, or an array into a ChainMapper.
type MimirService ¶
type MimirService struct { *e2e.HTTPService // contains filtered or unexported fields }
MimirService represents a Mimir service with at least an HTTP and GRPC port exposed.
func NewAlertmanager ¶
func NewAlertmanager(name string, flags map[string]string, options ...Option) *MimirService
func NewAlertmanagerWithTLS ¶
func NewAlertmanagerWithTLS(name string, flags map[string]string, options ...Option) *MimirService
func NewBackendInstance ¶
func NewBackendInstance(name string, flags map[string]string, options ...Option) *MimirService
func NewCompactor ¶
func NewDistributor ¶
func NewIngester ¶
func NewMimirService ¶
func NewOverridesExporter ¶
func NewQuerier ¶
func NewQueryFrontend ¶
func NewQueryFrontend(name string, consulAddress string, flags map[string]string, options ...Option) *MimirService
NewQueryFrontend returns a new query-frontend instance. The consulAddress is required to be a valid consul address when Mimir is configured with ingest storage enabled, otherwise it's ignored.
func NewQueryScheduler ¶
func NewQueryScheduler(name string, flags map[string]string, options ...Option) *MimirService
func NewReadInstance ¶
func NewReadInstance(name string, flags map[string]string, options ...Option) *MimirService
func NewSingleBinary ¶
func NewSingleBinary(name string, flags map[string]string, options ...Option) *MimirService
func NewStoreGateway ¶
func NewWriteInstance ¶
func NewWriteInstance(name string, flags map[string]string, options ...Option) *MimirService
func (*MimirService) NetworkGRPCEndpoint ¶
func (s *MimirService) NetworkGRPCEndpoint() string
type Option ¶
type Option func(*Options)
Option modifies options.
func WithConfigFile ¶
WithConfigFile returns an option that sets the config file flag if the provided string is not empty.
func WithFlagMapper ¶
func WithFlagMapper(mapFlags FlagMapper) Option
WithFlagMapper creates an option that sets a FlagMapper. Multiple flag mappers can be set, each one maps the output of the previous one. Flag mappers added using this option act on a copy of the flags, so they don't alter the input.
func WithNoopOption ¶
func WithNoopOption() Option
WithNoopOption returns an option that doesn't change anything.
func WithOtherPorts ¶
WithOtherPorts creates an option that adds other ports to the service.
type Options ¶
type Options struct { Image string MapFlags FlagMapper OtherPorts []int HTTPPort int GRPCPort int Environment map[string]string }
Options holds a set of options for running services, they can be altered passing Option funcs.
type S3Client ¶
type S3Client struct {
// contains filtered or unexported fields
}
func NewS3ClientForMinio ¶
func NewS3ClientForMinio(minio *e2e.HTTPService, bucketName string) (*S3Client, error)
func (*S3Client) DeleteBlock ¶
DeleteBlock deletes a single block.
func (*S3Client) DeleteBlocks ¶
DeleteBlocks deletes all blocks for a tenant.
type ServerStatus ¶
type ServerStatus struct { Config struct { Original string `json:"original"` } `json:"config"` }
ServerStatus represents a Alertmanager status response TODO: Upgrade to Alertmanager v0.20.0+ and utilize vendored structs