Documentation
¶
Index ¶
- Constants
- func EvaluateExecutionCriteria(criteria map[string][]string, criteriaExpression string, ...) (bool, string, string, error)
- type AsyncOperationStatus
- type KustoClient
- func (k *KustoClient) Database() string
- func (k *KustoClient) Endpoint() string
- func (k *KustoClient) Mgmt(ctx context.Context, query kusto.Statement, options ...kusto.MgmtOption) (*kusto.RowIterator, error)
- func (k *KustoClient) Query(ctx context.Context, query kusto.Statement, options ...kusto.QueryOption) (*kusto.RowIterator, error)
- type KustoExecutor
- type MetricsExporterReconciler
- type QueryExecutor
- type QueryResult
- type SummaryRuleReconciler
Constants ¶
const DefaultQueryExecutorMaxRows = 50000
Variables ¶
This section is empty.
Functions ¶
func EvaluateExecutionCriteria ¶
func EvaluateExecutionCriteria(criteria map[string][]string, criteriaExpression string, clusterLabels map[string]string) (bool, string, string, error)
EvaluateExecutionCriteria evaluates the criteria map (OR semantics within values, any key match) and optional criteriaExpression (CEL). Semantics:
- Neither provided: proceed=true
- Only map: proceed when map matches
- Only expression: proceed when expression evaluates true
- Both provided: AND semantics (map must match AND expression true)
Returns (proceed, reason, message, err) where err is only non-nil for expression parse/type/eval errors.
Types ¶
type AsyncOperationStatus ¶
type AsyncOperationStatus struct {
OperationId string `kusto:"OperationId"`
LastUpdatedOn time.Time `kusto:"LastUpdatedOn"`
State string `kusto:"State"`
ShouldRetry float64 `kusto:"ShouldRetry"`
Status string `kusto:"Status"`
}
AsyncOperationStatus mirrors the schema returned by .show operations
type KustoClient ¶
type KustoClient struct {
// contains filtered or unexported fields
}
KustoClient wraps the Azure Kusto Go client to implement KustoExecutor
func NewKustoClient ¶
func NewKustoClient(endpoint, database string) (*KustoClient, error)
NewKustoClient creates a new KustoClient with the given endpoint and database
func (*KustoClient) Database ¶
func (k *KustoClient) Database() string
func (*KustoClient) Endpoint ¶
func (k *KustoClient) Endpoint() string
func (*KustoClient) Mgmt ¶
func (k *KustoClient) Mgmt(ctx context.Context, query kusto.Statement, options ...kusto.MgmtOption) (*kusto.RowIterator, error)
Mgmt executes a Kusto management command (dot-command) against the configured database
func (*KustoClient) Query ¶
func (k *KustoClient) Query(ctx context.Context, query kusto.Statement, options ...kusto.QueryOption) (*kusto.RowIterator, error)
type KustoExecutor ¶
type KustoExecutor interface {
// Database returns the target database name
Database() string
// Endpoint returns the Kusto cluster endpoint
Endpoint() string
// Query executes a KQL query and returns the results
Query(ctx context.Context, query kusto.Statement, options ...kusto.QueryOption) (*kusto.RowIterator, error)
// Mgmt executes a Kusto management command (dot-command)
Mgmt(ctx context.Context, query kusto.Statement, options ...kusto.MgmtOption) (*kusto.RowIterator, error)
}
KustoExecutor provides an interface for executing KQL queries. This matches the pattern established in SummaryRule and allows for easy testing.
type MetricsExporterReconciler ¶
type MetricsExporterReconciler struct {
client.Client
Scheme *runtime.Scheme
// Configuration
ClusterLabels map[string]string
KustoClusters map[string]string // database name -> endpoint URL
OTLPEndpoint string
AddResourceAttributes map[string]string // Additional OTLP resource attributes (merged with ClusterLabels)
MetricNamePrefix string // Global prefix prepended to all metric names (combined with CRD prefix)
EnableMetricsEndpoint bool // Deprecated: kept for backward compatibility, not used with OTLP push
MetricsPort string // Deprecated: kept for backward compatibility
MetricsPath string // Deprecated: kept for backward compatibility
// Query execution components
QueryExecutors map[string]*QueryExecutor // keyed by database name
Clock clock.Clock
// OTLP push client for metrics delivery
OtlpExporter *export.PromToOtlpExporter
}
MetricsExporterReconciler reconciles MetricsExporter objects
func (*MetricsExporterReconciler) Reconcile ¶
func (r *MetricsExporterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile handles MetricsExporter reconciliation
func (*MetricsExporterReconciler) SetupWithManager ¶
func (r *MetricsExporterReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the service with the Manager
type QueryExecutor ¶
type QueryExecutor struct {
// contains filtered or unexported fields
}
QueryExecutor handles KQL query execution with time window management
func NewQueryExecutor ¶
func NewQueryExecutor(kustoClient KustoExecutor) *QueryExecutor
NewQueryExecutor creates a new QueryExecutor
func (*QueryExecutor) ExecuteQuery ¶
func (qe *QueryExecutor) ExecuteQuery(ctx context.Context, queryBody string, startTime, endTime time.Time, clusterLabels map[string]string) (*QueryResult, error)
ExecuteQuery executes a KQL query with time window parameters
func (*QueryExecutor) SetClock ¶
func (qe *QueryExecutor) SetClock(clk clock.Clock)
SetClock sets the clock for testing purposes
func (*QueryExecutor) SetMaxRows ¶
func (qe *QueryExecutor) SetMaxRows(limit int)
SetMaxRows overrides the maximum number of rows that will be materialized from a query result. A non-positive limit disables the safeguard.
type QueryResult ¶
QueryResult represents the result of a KQL query execution
type SummaryRuleReconciler ¶
type SummaryRuleReconciler struct {
client.Client
Scheme *runtime.Scheme
// Configuration
ClusterLabels map[string]string
KustoClusters map[string]string // database name -> endpoint URL
KustoExecutors map[string]KustoExecutor // per-database Kusto clients supporting Query and Mgmt
Clock clock.Clock
}
SummaryRuleReconciler will reconcile SummaryRule objects.
func (*SummaryRuleReconciler) Reconcile ¶
func (r *SummaryRuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile processes a single SummaryRule; placeholder implementation for now.
func (*SummaryRuleReconciler) SetupWithManager ¶
func (r *SummaryRuleReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the controller with the manager.