Documentation
¶
Index ¶
- Variables
- func NewExemplarQueryable(upstream storage.ExemplarQueryable, maxConcurrent int, ...) storage.ExemplarQueryable
- func NewMergeExemplarQueryable(idLabelName string, maxConcurrent int, callback MergeExemplarQuerierCallback, ...) storage.ExemplarQueryable
- func NewMergeQueryable(idLabelName string, maxConcurrent int, callback MergeQuerierCallback, ...) storage.Queryable
- func NewMetadataQuerier(upstream querier.MetadataQuerier, maxConcurrent int, reg prometheus.Registerer) querier.MetadataQuerier
- func NewQueryable(upstream storage.Queryable, maxConcurrent int, byPassWithSingleQuerier bool, ...) storage.Queryable
- type Config
- type MergeExemplarQuerierCallback
- type MergeQuerierCallback
- type RegexResolver
- type RegexValidator
Constants ¶
This section is empty.
Variables ¶
var (
ErrTooManyTenants = "too many tenants, max: %d, actual: %d"
)
Functions ¶
func NewExemplarQueryable ¶ added in v1.19.0
func NewExemplarQueryable(upstream storage.ExemplarQueryable, maxConcurrent int, byPassWithSingleQuerier bool, reg prometheus.Registerer) storage.ExemplarQueryable
NewExemplarQueryable returns a exemplarQueryable that iterates through all the tenant IDs that are part of the request and aggregates the results from each tenant's ExemplarQuerier by sending of subsequent requests. By setting byPassWithSingleQuerier to true the mergeExemplarQuerier gets by-passed and results for request with a single exemplar querier will not contain the "__tenant_id__" label. This allows a smoother transition, when enabling tenant federation in a cluster. The result contains a label "__tenant_id__" to identify the tenant ID that it originally resulted from. If the label "__tenant_id__" is already existing, its value is overwritten by the tenant ID and the previous value is exposed through a new label prefixed with "original_". This behaviour is not implemented recursively.
func NewMergeExemplarQueryable ¶ added in v1.19.0
func NewMergeExemplarQueryable(idLabelName string, maxConcurrent int, callback MergeExemplarQuerierCallback, byPassWithSingleQuerier bool, reg prometheus.Registerer) storage.ExemplarQueryable
NewMergeExemplarQueryable returns a queryable that merges results from multiple underlying ExemplarQueryables. By setting byPassWithSingleQuerier to true the mergeExemplarQuerier gets by-passed and results for request with a single exemplar querier will not contain the "__tenant_id__" label. This allows a smoother transition, when enabling tenant federation in a cluster. Results contain a label `idLabelName` to identify the underlying exemplar queryable that it originally resulted from. If the label `idLabelName` is already existing, its value is overwritten and the previous value is exposed through a new label prefixed with "original_". This behaviour is not implemented recursively.
func NewMergeQueryable ¶ added in v1.10.0
func NewMergeQueryable(idLabelName string, maxConcurrent int, callback MergeQuerierCallback, byPassWithSingleQuerier bool, reg prometheus.Registerer) storage.Queryable
NewMergeQueryable returns a queryable that merges results from multiple underlying Queryables. The underlying queryables and its label values to be considered are returned by a MergeQuerierCallback. By setting byPassWithSingleQuerier to true the mergeQuerier gets by-passed and results for request with a single querier will not contain the id label. This allows a smoother transition, when enabling tenant federation in a cluster. Results contain a label `idLabelName` to identify the underlying queryable that it originally resulted from. If the label `idLabelName` is already existing, its value is overwritten and the previous value is exposed through a new label prefixed with "original_". This behaviour is not implemented recursively.
func NewMetadataQuerier ¶ added in v1.19.0
func NewMetadataQuerier(upstream querier.MetadataQuerier, maxConcurrent int, reg prometheus.Registerer) querier.MetadataQuerier
NewMetadataQuerier returns a MetadataQuerier that merges metric metadata for multiple tenants.
func NewQueryable ¶
func NewQueryable(upstream storage.Queryable, maxConcurrent int, byPassWithSingleQuerier bool, reg prometheus.Registerer) storage.Queryable
NewQueryable returns a queryable that iterates through all the tenant IDs that are part of the request and aggregates the results from each tenant's Querier by sending of subsequent requests. By setting byPassWithSingleQuerier to true the mergeQuerier gets by-passed and results for request with a single querier will not contain the "__tenant_id__" label. This allows a smoother transition, when enabling tenant federation in a cluster. The result contains a label "__tenant_id__" to identify the tenant ID that it originally resulted from. If the label "__tenant_id__" is already existing, its value is overwritten by the tenant ID and the previous value is exposed through a new label prefixed with "original_". This behaviour is not implemented recursively.
Types ¶
type Config ¶
type Config struct {
// Enabled switches on support for multi tenant query federation
Enabled bool `yaml:"enabled"`
// MaxConcurrent The number of workers used for processing federated query.
MaxConcurrent int `yaml:"max_concurrent"`
// MaxTenant A maximum number of tenants to query at once.
MaxTenant int `yaml:"max_tenant"`
// RegexMatcherEnabled If true, the `X-Scope-OrgID` header can accept a regex, matched tenantIDs are automatically involved.
RegexMatcherEnabled bool `yaml:"regex_matcher_enabled"`
// UserSyncInterval How frequently to scan users, scanned users are used to calculate matched tenantIDs if the regex matcher is enabled.
UserSyncInterval time.Duration `yaml:"user_sync_interval"`
}
func (*Config) RegisterFlags ¶
type MergeExemplarQuerierCallback ¶ added in v1.19.0
type MergeExemplarQuerierCallback func(ctx context.Context) (ids []string, queriers []storage.ExemplarQuerier, err error)
MergeExemplarQuerierCallback returns the underlying exemplar queriers and their IDs relevant for the query.
type MergeQuerierCallback ¶ added in v1.10.0
type MergeQuerierCallback func(ctx context.Context, mint int64, maxt int64) (ids []string, queriers []storage.Querier, err error)
MergeQuerierCallback returns the underlying queriers and their IDs relevant for the query.
type RegexResolver ¶ added in v1.20.0
RegexResolver resolves tenantIDs matched given regex.
func NewRegexResolver ¶ added in v1.20.0
func NewRegexResolver(cfg tsdb.UsersScannerConfig, tenantFederationCfg Config, reg prometheus.Registerer, bucketClientFactory func(ctx context.Context) (objstore.InstrumentedBucket, error), logger log.Logger) (*RegexResolver, error)
type RegexValidator ¶ added in v1.20.0
type RegexValidator struct{}
RegexValidator used to pass a regex orgID to the querier. Using an existing tenant resolver could emit an errTenantIDUnsupportedCharacter since the regex would contain unsupported characters like a `+`.
func NewRegexValidator ¶ added in v1.20.0
func NewRegexValidator() *RegexValidator