Documentation ¶
Index ¶
- Constants
- func CreatePrombQuery(mint, maxt int64, matchers []*labels.Matcher) (*prompb.Query, error)
- func HashLabels(lset prompb.Labels) uint64
- func LabelSet(metricName, migrationJobName string) []prompb.Label
- func ParseClientInfo(conf *ClientConfig) error
- type Auth
- type Client
- func (c *Client) Config() ClientConfig
- func (c *Client) Read(ctx context.Context, query *prompb.Query, desc string) (result *prompb.QueryResult, numBytesCompressed int, numBytesUncompressed int, ...)
- func (c *Client) ReadConcurrent(ctx context.Context, query *prompb.Query, shardID int, desc string, ...)
- func (c *Client) Store(ctx context.Context, req []byte) error
- type ClientConfig
- type HeadersFlag
- type PrompbResponse
- type RecoverableError
- type RecoveryAction
Constants ¶
const ( // Read defines the type of client. It is used to fetch the auth from authStore. Read = iota // Write defines the type of client. It is used to fetch the auth from authStore. Write )
const ( LabelJob = "job" Megabyte = 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func CreatePrombQuery ¶
CreatePrombQuery creates a new promb query based on the matchers.
func HashLabels ¶
HashLabels returns the hash of the provided promb labels-set. It fetches the value of the hash from the labelsCache if exists, else creates the hash and returns it after storing the new hash value.
func ParseClientInfo ¶
func ParseClientInfo(conf *ClientConfig) error
Types ¶
type Auth ¶
type Auth struct { Username string Password string PasswordFile string BearerToken string BearerTokenFile string config.TLSConfig }
Auth defines the authentication for prom-migrator.
func (*Auth) ToHTTPClientConfig ¶
func (a *Auth) ToHTTPClientConfig() config.HTTPClientConfig
Convert converts the auth credentials to HTTP client compatible format.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(remoteName string, clientConfig ClientConfig, httpConfig promConfig.HTTPClientConfig) (*Client, error)
NewClient creates a new read or write client. The `clientType` should be either `read` or `write`. The client type is used to get the auth from the auth store. If the `clientType` is other than the ones specified, then auth may not work.
type ClientConfig ¶
type ClientConfig struct { URL string Timeout time.Duration OnTimeout RecoveryAction OnTimeoutStr string OnErr RecoveryAction OnErrStr string MaxRetry int // Delay defines the time we should wait before a retry. This can happen // either in a timeout or after an error. Delay time.Duration CustomHeaders map[string][]string }
type HeadersFlag ¶
func (HeadersFlag) Set ¶
func (f HeadersFlag) Set(value string) error
func (HeadersFlag) String ¶
func (f HeadersFlag) String() string
type PrompbResponse ¶
type PrompbResponse struct { ID int Result *prompb.QueryResult NumBytesCompressed int NumBytesUncompressed int }
PrompbResponse is a type that contains promb-result and information pertaining to it.
type RecoverableError ¶
type RecoverableError struct {
// contains filtered or unexported fields
}
RecoverableError is an error for which the send samples can retry with a backoff.
type RecoveryAction ¶
type RecoveryAction uint8
const ( // Retry makes the client to retry in case of a timeout or error. Retry RecoveryAction = iota // Skip makes the client to skip the current slab. Skip // Abort aborts the client from any further retries and exits the migration process. // This can be applied after a timeout or error. Abort )
func RecoveryActionEnum ¶
func RecoveryActionEnum(typ string) (RecoveryAction, error)