Documentation
¶
Index ¶
- Variables
- func Query[Req, Resp any](ctx context.Context, router *Router, req *connect.Request[Req], ...) (*connect.Response[Resp], error)
- type Config
- type MetastoreSplitTimeResolver
- type Overrides
- type QueryBackendFrom
- func (q QueryBackendFrom) IsZero() bool
- func (q QueryBackendFrom) MarshalJSON() ([]byte, error)
- func (q QueryBackendFrom) MarshalText() ([]byte, error)
- func (q QueryBackendFrom) MarshalYAML() (interface{}, error)
- func (q *QueryBackendFrom) Set(s string) error
- func (q QueryBackendFrom) SplitTime(tenantOldestProfileTime func() (time.Time, error)) (time.Time, error)
- func (q QueryBackendFrom) String() string
- func (q *QueryBackendFrom) UnmarshalJSON(data []byte) error
- func (q *QueryBackendFrom) UnmarshalText(data []byte) error
- func (q *QueryBackendFrom) UnmarshalYAML(value *yaml.Node) error
- type Router
- func (r *Router) AnalyzeQuery(ctx context.Context, req *connect.Request[querierv1.AnalyzeQueryRequest]) (*connect.Response[querierv1.AnalyzeQueryResponse], error)
- func (r *Router) Diff(ctx context.Context, c *connect.Request[querierv1.DiffRequest]) (*connect.Response[querierv1.DiffResponse], error)
- func (r *Router) GetProfileStats(ctx context.Context, c *connect.Request[typesv1.GetProfileStatsRequest]) (*connect.Response[typesv1.GetProfileStatsResponse], error)
- func (r *Router) LabelNames(ctx context.Context, c *connect.Request[typesv1.LabelNamesRequest]) (*connect.Response[typesv1.LabelNamesResponse], error)
- func (r *Router) LabelValues(ctx context.Context, c *connect.Request[typesv1.LabelValuesRequest]) (*connect.Response[typesv1.LabelValuesResponse], error)
- func (r *Router) ProfileTypes(ctx context.Context, c *connect.Request[querierv1.ProfileTypesRequest]) (*connect.Response[querierv1.ProfileTypesResponse], error)
- func (r *Router) SelectHeatmap(ctx context.Context, c *connect.Request[querierv1.SelectHeatmapRequest]) (*connect.Response[querierv1.SelectHeatmapResponse], error)
- func (r *Router) SelectMergeProfile(ctx context.Context, c *connect.Request[querierv1.SelectMergeProfileRequest]) (*connect.Response[profilev1.Profile], error)
- func (r *Router) SelectMergeSpanProfile(ctx context.Context, ...) (*connect.Response[querierv1.SelectMergeSpanProfileResponse], error)
- func (r *Router) SelectMergeStacktraces(ctx context.Context, ...) (*connect.Response[querierv1.SelectMergeStacktracesResponse], error)
- func (r *Router) SelectSeries(ctx context.Context, c *connect.Request[querierv1.SelectSeriesRequest]) (*connect.Response[querierv1.SelectSeriesResponse], error)
- func (r *Router) Series(ctx context.Context, c *connect.Request[querierv1.SeriesRequest]) (*connect.Response[querierv1.SeriesResponse], error)
- type SplitTimeResolver
- type TenantServiceClient
Constants ¶
This section is empty.
Variables ¶
var ErrNoV2Data = errors.New("no v2 data ingested for tenant")
Functions ¶
func Query ¶
func Query[Req, Resp any]( ctx context.Context, router *Router, req *connect.Request[Req], sanitize func(a, b *Req), aggregate func(a, b *Resp) (*Resp, error), ) (*connect.Response[Resp], error)
Query routes a query to the appropriate query frontend. Before the call to the frontend is made, the requests are sanitized: any of the arguments can be nil, but not both. If the query was split, the responses are aggregated.
Types ¶
type Config ¶
type Config struct {
EnableQueryBackend bool `yaml:"enable_query_backend" json:"enable_query_backend" category:"advanced" doc:"hidden"`
EnableQueryBackendFrom QueryBackendFrom `yaml:"enable_query_backend_from" json:"enable_query_backend_from" doc:"hidden"`
QueryTreeEnabled bool `yaml:"query_tree_enabled" json:"query_tree_enabled" category:"experimental" doc:"hidden"`
}
func (*Config) RegisterFlags ¶
type MetastoreSplitTimeResolver ¶
type MetastoreSplitTimeResolver struct {
// contains filtered or unexported fields
}
MetastoreSplitTimeResolver resolves the split time for "auto" mode by querying the metastore for each tenant's oldest profile time. Results are cached per tenant to avoid calling the metastore on every query.
func NewMetastoreSplitTimeResolver ¶
func NewMetastoreSplitTimeResolver(client TenantServiceClient, ttl time.Duration) *MetastoreSplitTimeResolver
func (*MetastoreSplitTimeResolver) OldestProfileTime ¶
type QueryBackendFrom ¶
QueryBackendFrom is a flag/config type that accepts either an RFC3339 timestamp or the special value "auto". When set to "auto", the split point is resolved at query time by looking up the tenant's oldest profile time in the metastore.
func (QueryBackendFrom) IsZero ¶
func (q QueryBackendFrom) IsZero() bool
func (QueryBackendFrom) MarshalJSON ¶
func (q QueryBackendFrom) MarshalJSON() ([]byte, error)
func (QueryBackendFrom) MarshalText ¶
func (q QueryBackendFrom) MarshalText() ([]byte, error)
func (QueryBackendFrom) MarshalYAML ¶
func (q QueryBackendFrom) MarshalYAML() (interface{}, error)
func (*QueryBackendFrom) Set ¶
func (q *QueryBackendFrom) Set(s string) error
Set implements flag.Value.
func (QueryBackendFrom) SplitTime ¶
func (q QueryBackendFrom) SplitTime(tenantOldestProfileTime func() (time.Time, error)) (time.Time, error)
SplitTime returns the split timestamp for routing queries. For a fixed timestamp, it returns the time directly. For "auto" mode, it queries the metastore for the tenant's oldest profile time. Returns zero time if the split cannot be determined.
func (QueryBackendFrom) String ¶
func (q QueryBackendFrom) String() string
String implements flag.Value.
func (*QueryBackendFrom) UnmarshalJSON ¶
func (q *QueryBackendFrom) UnmarshalJSON(data []byte) error
func (*QueryBackendFrom) UnmarshalText ¶
func (q *QueryBackendFrom) UnmarshalText(data []byte) error
func (*QueryBackendFrom) UnmarshalYAML ¶
func (q *QueryBackendFrom) UnmarshalYAML(value *yaml.Node) error
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a proxy that routes queries to the query frontend.
If the query backend is enabled, it routes queries to the new query frontend, otherwise it routes queries to the old query frontend.
If the query targets a time range that spans the enablement of the new query backend, it splits the query into two parts and sends them to the old and new query frontends.
func NewRouter ¶
func NewRouter( logger log.Logger, overrides Overrides, resolver SplitTimeResolver, oldFrontend querierv1connect.QuerierServiceClient, newFrontend querierv1connect.QuerierServiceClient, ) *Router
func (*Router) AnalyzeQuery ¶
func (*Router) GetProfileStats ¶
func (*Router) LabelNames ¶
func (*Router) LabelValues ¶
func (*Router) ProfileTypes ¶
func (*Router) SelectHeatmap ¶
func (*Router) SelectMergeProfile ¶
func (*Router) SelectMergeSpanProfile ¶
func (*Router) SelectMergeStacktraces ¶
func (*Router) SelectSeries ¶
type SplitTimeResolver ¶
type SplitTimeResolver interface {
OldestProfileTime(ctx context.Context, tenantID string) (time.Time, error)
}
SplitTimeResolver resolves the split time for a tenant in "auto" mode. It returns the oldest profile time known for the tenant in the v2 storage.
type TenantServiceClient ¶
type TenantServiceClient interface {
GetTenant(ctx context.Context, in *metastorev1.GetTenantRequest, opts ...grpc.CallOption) (*metastorev1.GetTenantResponse, error)
}
TenantServiceClient is the subset of the metastore client needed to resolve the oldest profile time for a tenant.