Documentation ¶
Index ¶
- Variables
- func AgentRelationToVizierRelation(relation *schemapb.Relation) *vizierpb.Relation
- func BuildExecuteScriptResponse(r *carnotpb.TransferResultChunkRequest, tableIDMap map[string]string, ...) (*vizierpb.ExecuteScriptResponse, error)
- func ErrToVizierResponse(id uuid.UUID, err error) *vizierpb.ExecuteScriptResponse
- func ErrToVizierStatus(err error) *vizierpb.Status
- func GetQueryPlanAsDotString(distributedPlan *distributedpb.DistributedPlan, ...) (string, error)
- func LaunchQuery(queryID uuid.UUID, natsConn *nats.Conn, planMap map[uuid.UUID]*planpb.Plan, ...) error
- func OutputSchemaFromPlan(planMap map[uuid.UUID]*planpb.Plan) map[string]*schemapb.Relation
- func QueryPlanRelationResponse(queryID uuid.UUID, planTableID string) *vizierpb.ExecuteScriptResponse
- func QueryPlanResponse(queryID uuid.UUID, plan *distributedpb.DistributedPlan, ...) ([]*vizierpb.ExecuteScriptResponse, error)
- func QueryResultStatsToVizierStats(e *queryresultspb.QueryExecutionStats, compilationTimeNs int64) *vizierpb.QueryExecutionStats
- func RelationFromTable(table *schemapb.Table) (*vizierpb.QueryMetadata, error)
- func RowBatchToVizierRowBatch(rb *schemapb.RowBatchData, tableID string) (*vizierpb.RowBatchData, error)
- func StatusToError(s *statuspb.Status) error
- func StatusToVizierResponse(id uuid.UUID, s *statuspb.Status) *vizierpb.ExecuteScriptResponse
- func StatusToVizierStatus(s *statuspb.Status) *vizierpb.Status
- func TableRelationResponses(queryID uuid.UUID, tableIDMap map[string]string, ...) ([]*vizierpb.ExecuteScriptResponse, error)
- func UInt128ToVizierUInt128(i *typespb.UInt128) *vizierpb.UInt128
- func VizierQueryRequestToPlannerMutationRequest(vpb *vizierpb.ExecuteScriptRequest) (*plannerpb.CompileMutationsRequest, error)
- func VizierQueryRequestToPlannerQueryRequest(vpb *vizierpb.ExecuteScriptRequest) (*plannerpb.QueryRequest, error)
- func VizierStatusToError(s *vizierpb.Status) error
- type AgentsTracker
- type DataPrivacy
- type MutationExecFactory
- type MutationExecutor
- type MutationExecutorImpl
- type Planner
- type QueryExecutor
- type QueryExecutorFactory
- type QueryExecutorImpl
- type QueryFlags
- type QueryPlanOpts
- type QueryResultConsumer
- type QueryResultForwarder
- type QueryResultForwarderImpl
- func (f *QueryResultForwarderImpl) ForwardQueryResult(ctx context.Context, msg *carnotpb.TransferResultChunkRequest) error
- func (f *QueryResultForwarderImpl) GetProducerCtx(queryID uuid.UUID) (context.Context, error)
- func (f *QueryResultForwarderImpl) ProducerCancelStream(queryID uuid.UUID, err error)
- func (f *QueryResultForwarderImpl) RegisterQuery(queryID uuid.UUID, tableIDMap map[string]string, compilationTimeNs int64, ...) error
- func (f *QueryResultForwarderImpl) StreamResults(ctx context.Context, queryID uuid.UUID, ...) error
- type QueryResultForwarderOption
- type Server
- func (s *Server) CheckHealth(ctx context.Context) error
- func (s *Server) Close()
- func (s *Server) ExecuteScript(req *vizierpb.ExecuteScriptRequest, ...) error
- func (s *Server) GenerateOTelScript(ctx context.Context, req *vizierpb.GenerateOTelScriptRequest) (*vizierpb.GenerateOTelScriptResponse, error)
- func (s *Server) HealthCheck(req *vizierpb.HealthCheckRequest, srv vizierpb.VizierService_HealthCheckServer) error
- func (s *Server) TransferResultChunk(srv carnotpb.ResultSinkService_TransferResultChunkServer) error
- type TracepointInfo
- type TracepointMap
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTracepointRegistrationFailed failed to register tracepoint. ErrTracepointRegistrationFailed = errors.New("failed to register tracepoints") // ErrTracepointDeletionFailed failed to delete tracepoint. ErrTracepointDeletionFailed = errors.New("failed to delete tracepoints") // ErrTracepointPending tracepoint is still pending. ErrTracepointPending = errors.New("tracepoints are still pending") // ErrConfigUpdateFailed failed to send the config update request to an agent. ErrConfigUpdateFailed = errors.New("failed to update config") )
Functions ¶
func AgentRelationToVizierRelation ¶
AgentRelationToVizierRelation converts the agent relation format to the Vizier relation format.
func BuildExecuteScriptResponse ¶
func BuildExecuteScriptResponse(r *carnotpb.TransferResultChunkRequest, tableIDMap map[string]string, compilationTimeNs int64) (*vizierpb.ExecuteScriptResponse, error)
BuildExecuteScriptResponse Converts the agent-format result into the vizier client format result.
func ErrToVizierResponse ¶
func ErrToVizierResponse(id uuid.UUID, err error) *vizierpb.ExecuteScriptResponse
ErrToVizierResponse converts an error to an externally-facing Vizier response message
func ErrToVizierStatus ¶
ErrToVizierStatus converts an error to an externally-facing Vizier status.
func GetQueryPlanAsDotString ¶
func GetQueryPlanAsDotString(distributedPlan *distributedpb.DistributedPlan, planMap map[uuid.UUID]*planpb.Plan, planExecStats *[]*queryresultspb.AgentExecutionStats) (string, error)
GetQueryPlanAsDotString converts the plan into a dotstring that can be rendered by GraphViz.
func LaunchQuery ¶
func LaunchQuery(queryID uuid.UUID, natsConn *nats.Conn, planMap map[uuid.UUID]*planpb.Plan, analyze bool) error
LaunchQuery launches a query by sending query fragments to relevant agents.
func OutputSchemaFromPlan ¶
OutputSchemaFromPlan takes in a plan map and returns the relations for all of the final output tables in the plan map.
func QueryPlanRelationResponse ¶
func QueryPlanRelationResponse(queryID uuid.UUID, planTableID string) *vizierpb.ExecuteScriptResponse
QueryPlanRelationResponse returns the relation of the query plan as an ExecuteScriptResponse.
func QueryPlanResponse ¶
func QueryPlanResponse(queryID uuid.UUID, plan *distributedpb.DistributedPlan, planMap map[uuid.UUID]*planpb.Plan, agentStats *[]*queryresultspb.AgentExecutionStats, planTableID string, maxQueryPlanStringSizeBytes int) ([]*vizierpb.ExecuteScriptResponse, error)
QueryPlanResponse returns the query plan as an ExecuteScriptResponse.
func QueryResultStatsToVizierStats ¶
func QueryResultStatsToVizierStats(e *queryresultspb.QueryExecutionStats, compilationTimeNs int64) *vizierpb.QueryExecutionStats
QueryResultStatsToVizierStats gets the execution stats from the query results.
func RelationFromTable ¶
func RelationFromTable(table *schemapb.Table) (*vizierpb.QueryMetadata, error)
RelationFromTable gets the relation from the table.
func RowBatchToVizierRowBatch ¶
func RowBatchToVizierRowBatch(rb *schemapb.RowBatchData, tableID string) (*vizierpb.RowBatchData, error)
RowBatchToVizierRowBatch converts an internal row batch to a vizier row batch.
func StatusToError ¶
StatusToError converts a statuspb.Status to a grpc error.
func StatusToVizierResponse ¶
StatusToVizierResponse converts an error to an externally-facing Vizier response message
func StatusToVizierStatus ¶
StatusToVizierStatus converts an internal status to an externally-facing Vizier status.
func TableRelationResponses ¶
func TableRelationResponses(queryID uuid.UUID, tableIDMap map[string]string, planMap map[uuid.UUID]*planpb.Plan) ([]*vizierpb.ExecuteScriptResponse, error)
TableRelationResponses returns the query metadata table schemas as ExecuteScriptResponses.
func UInt128ToVizierUInt128 ¶
UInt128ToVizierUInt128 converts our internal representation of UInt128 to Vizier's representation of UInt128.
func VizierQueryRequestToPlannerMutationRequest ¶
func VizierQueryRequestToPlannerMutationRequest(vpb *vizierpb.ExecuteScriptRequest) (*plannerpb.CompileMutationsRequest, error)
VizierQueryRequestToPlannerMutationRequest maps request to mutation.
func VizierQueryRequestToPlannerQueryRequest ¶
func VizierQueryRequestToPlannerQueryRequest(vpb *vizierpb.ExecuteScriptRequest) (*plannerpb.QueryRequest, error)
VizierQueryRequestToPlannerQueryRequest converts a externally-facing query request to an internal representation.
func VizierStatusToError ¶
VizierStatusToError converts a vizierpb.Status to a grpc error.
Types ¶
type AgentsTracker ¶
type AgentsTracker interface {
GetAgentInfo() tracker.AgentsInfo
}
AgentsTracker is the interface for the background agent information tracker.
type DataPrivacy ¶
type DataPrivacy interface { // RedactionOptions returns the proto message containing options for redaction based on the cached data privacy level. RedactionOptions(ctx context.Context) (*distributedpb.RedactionOptions, error) }
DataPrivacy is an interface that manages data privacy in the query executor.
func CreateDataPrivacyManager ¶
func CreateDataPrivacyManager(ns string) (DataPrivacy, error)
CreateDataPrivacyManager creates a privacy manager for the namespace.
type MutationExecFactory ¶
type MutationExecFactory func(Planner, metadatapb.MetadataTracepointServiceClient, metadatapb.MetadataConfigServiceClient, *distributedpb.DistributedState) MutationExecutor
MutationExecFactory is a function that creates a new MutationExecutorImpl.
type MutationExecutor ¶
type MutationExecutor interface { Execute(ctx context.Context, request *vizierpb.ExecuteScriptRequest, options *planpb.PlanOptions) (*statuspb.Status, error) MutationInfo(ctx context.Context) (*vizierpb.MutationInfo, error) }
MutationExecutor is the interface for running script mutations.
func NewMutationExecutor ¶
func NewMutationExecutor( planner Planner, mdtp metadatapb.MetadataTracepointServiceClient, mdconf metadatapb.MetadataConfigServiceClient, distributedState *distributedpb.DistributedState) MutationExecutor
NewMutationExecutor creates a new mutation executor.
type MutationExecutorImpl ¶
type MutationExecutorImpl struct {
// contains filtered or unexported fields
}
MutationExecutorImpl is responsible for running script mutations.
func (*MutationExecutorImpl) Execute ¶
func (m *MutationExecutorImpl) Execute(ctx context.Context, req *vizierpb.ExecuteScriptRequest, planOpts *planpb.PlanOptions) (*statuspb.Status, error)
Execute runs the mutation. On unknown errors it will return an error, otherwise we return a status message that has more context about the error message.
func (*MutationExecutorImpl) MutationInfo ¶
func (m *MutationExecutorImpl) MutationInfo(ctx context.Context) (*vizierpb.MutationInfo, error)
MutationInfo returns the summarized mutation information.
type Planner ¶
type Planner interface { Plan(req *plannerpb.QueryRequest) (*distributedpb.LogicalPlannerResult, error) CompileMutations(request *plannerpb.CompileMutationsRequest) (*plannerpb.CompileMutationsResponse, error) GenerateOTelScript(request *plannerpb.GenerateOTelScriptRequest) (*plannerpb.GenerateOTelScriptResponse, error) Free() }
Planner describes the interface for any planner.
type QueryExecutor ¶
type QueryExecutor interface { Run(context.Context, *vizierpb.ExecuteScriptRequest, QueryResultConsumer) error Wait() error QueryID() uuid.UUID }
QueryExecutor executes a query and allows the caller to consume results via a QueryResultConsumer.
func NewQueryExecutor ¶
func NewQueryExecutor( resultAddress string, resultSSLTargetName string, agentsTracker AgentsTracker, dataPrivacy DataPrivacy, natsConn *nats.Conn, mdtp metadatapb.MetadataTracepointServiceClient, mdconf metadatapb.MetadataConfigServiceClient, resultForwarder QueryResultForwarder, planner Planner, mutExecFactory MutationExecFactory, ) QueryExecutor
NewQueryExecutor creates a new QueryExecutorImpl.
func NewQueryExecutorFromServer ¶
func NewQueryExecutorFromServer(s *Server, mutExecFactory MutationExecFactory) QueryExecutor
NewQueryExecutorFromServer creates a new QueryExecutor using the properties of a query broker server.
type QueryExecutorFactory ¶
type QueryExecutorFactory func(*Server, MutationExecFactory) QueryExecutor
QueryExecutorFactory creates a new QueryExecutor.
type QueryExecutorImpl ¶
type QueryExecutorImpl struct {
// contains filtered or unexported fields
}
QueryExecutorImpl implements the QueryExecutor interface.
func (*QueryExecutorImpl) QueryID ¶
func (q *QueryExecutorImpl) QueryID() uuid.UUID
QueryID returns the uuid of the executing query.
func (*QueryExecutorImpl) Run ¶
func (q *QueryExecutorImpl) Run(ctx context.Context, req *vizierpb.ExecuteScriptRequest, consumer QueryResultConsumer) error
Run launches a query with the given QueryResultConsumer consuming results, and does not wait for the query to error or finish.
func (*QueryExecutorImpl) Wait ¶
func (q *QueryExecutorImpl) Wait() error
Wait waits for the query to finish or error.
type QueryFlags ¶
type QueryFlags struct {
// contains filtered or unexported fields
}
QueryFlags represents a set of Pixie configuration flags.
func ParseQueryFlags ¶
func ParseQueryFlags(queryStr string) (*QueryFlags, error)
ParseQueryFlags takes a query string containing some config options and generates a QueryFlags object that can be used to retrieve those options.
func (*QueryFlags) GetBool ¶
func (f *QueryFlags) GetBool(key string) bool
GetBool gets the value of the given flag as a bool.
func (*QueryFlags) GetFloat64 ¶
func (f *QueryFlags) GetFloat64(key string) float64
GetFloat64 gets the value of the given flag as a float.
func (*QueryFlags) GetInt64 ¶
func (f *QueryFlags) GetInt64(key string) int64
GetInt64 gets the value of the given flag as an int64.
func (*QueryFlags) GetPlanOptions ¶
func (f *QueryFlags) GetPlanOptions() *planpb.PlanOptions
GetPlanOptions creates the plan option proto from the specified query flags.
func (*QueryFlags) GetString ¶
func (f *QueryFlags) GetString(key string) string
GetString gets the value of the given flag as a string.
type QueryPlanOpts ¶
type QueryPlanOpts struct { TableID string Plan *distributedpb.DistributedPlan PlanMap map[uuid.UUID]*planpb.Plan }
QueryPlanOpts contains options for generating and returning the query plan when the query has explain=true.
type QueryResultConsumer ¶
type QueryResultConsumer interface {
Consume(*vizierpb.ExecuteScriptResponse) error
}
QueryResultConsumer defines an interface to allow consumption of Query results from a QueryResultExecutor.
type QueryResultForwarder ¶
type QueryResultForwarder interface { RegisterQuery(queryID uuid.UUID, tableIDMap map[string]string, compilationTimeNs int64, queryPlanOpts *QueryPlanOpts, queryName string) error // Streams results from the agent stream to the client stream. // Blocks until the stream (& the agent stream) has completed, been cancelled, or experienced an error. // Returns error for any error received. StreamResults(ctx context.Context, queryID uuid.UUID, resultCh chan<- *vizierpb.ExecuteScriptResponse) error // Returns the producer context for the query, so that the watchdog can cancel all producers with one context. GetProducerCtx(queryID uuid.UUID) (context.Context, error) // Pass a message received from the agent stream to the client-side stream. ForwardQueryResult(ctx context.Context, msg *carnotpb.TransferResultChunkRequest) error // If the producer of data (i.e. Kelvin) errors then this function can be used to shutdown the stream. // The producer should not call this function if there's a retry is possible. ProducerCancelStream(queryID uuid.UUID, err error) }
QueryResultForwarder is responsible for receiving query results from the agent streams and forwarding that data to the client stream.
func NewQueryResultForwarder ¶
func NewQueryResultForwarder() QueryResultForwarder
NewQueryResultForwarder creates a new QueryResultForwarder.
func NewQueryResultForwarderWithOptions ¶
func NewQueryResultForwarderWithOptions(opts ...QueryResultForwarderOption) QueryResultForwarder
NewQueryResultForwarderWithOptions returns a query result forwarder with custom options.
type QueryResultForwarderImpl ¶
type QueryResultForwarderImpl struct {
// contains filtered or unexported fields
}
QueryResultForwarderImpl implements the QueryResultForwarder interface.
func (*QueryResultForwarderImpl) ForwardQueryResult ¶
func (f *QueryResultForwarderImpl) ForwardQueryResult(ctx context.Context, msg *carnotpb.TransferResultChunkRequest) error
ForwardQueryResult forwards the agent result to the client result channel.
func (*QueryResultForwarderImpl) GetProducerCtx ¶
GetProducerCtx returns the producer context for the query, so producers can check for that context being cancelled.
func (*QueryResultForwarderImpl) ProducerCancelStream ¶
func (f *QueryResultForwarderImpl) ProducerCancelStream(queryID uuid.UUID, err error)
ProducerCancelStream signals to StreamResults that the client stream should be cancelled. It is triggered by the handler for the agent streams.
func (*QueryResultForwarderImpl) RegisterQuery ¶
func (f *QueryResultForwarderImpl) RegisterQuery(queryID uuid.UUID, tableIDMap map[string]string, compilationTimeNs int64, queryPlanOpts *QueryPlanOpts, queryName string) error
RegisterQuery registers a query ID in the result forwarder.
func (*QueryResultForwarderImpl) StreamResults ¶
func (f *QueryResultForwarderImpl) StreamResults(ctx context.Context, queryID uuid.UUID, resultCh chan<- *vizierpb.ExecuteScriptResponse) error
StreamResults streams results from the agent streams to the client stream.
type QueryResultForwarderOption ¶
type QueryResultForwarderOption func(*QueryResultForwarderImpl)
QueryResultForwarderOption allows specifying options for new QueryResultForwarders.
func WithConsumerTimeout ¶
func WithConsumerTimeout(timeout time.Duration) QueryResultForwarderOption
WithConsumerTimeout sets a timeout on how long the result forwarder will wait without a consumer pulling data from it.
func WithProducerTimeout ¶
func WithProducerTimeout(timeout time.Duration) QueryResultForwarderOption
WithProducerTimeout sets a timeout on how long the result forwarder will wait without seeing any data from producers.
func WithResultSinkTimeout ¶
func WithResultSinkTimeout(timeout time.Duration) QueryResultForwarderOption
WithResultSinkTimeout sets the result sink initialization timeout.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server defines an gRPC server type.
func NewServer ¶
func NewServer(env querybrokerenv.QueryBrokerEnv, agentsTracker AgentsTracker, dataPrivacy DataPrivacy, mds metadatapb.MetadataTracepointServiceClient, mdconf metadatapb.MetadataConfigServiceClient, natsConn *nats.Conn, queryExecFactory QueryExecutorFactory) (*Server, error)
NewServer creates GRPC handlers.
func NewServerWithForwarderAndPlanner ¶
func NewServerWithForwarderAndPlanner(env querybrokerenv.QueryBrokerEnv, agentsTracker AgentsTracker, dataPrivacy DataPrivacy, resultForwarder QueryResultForwarder, mds metadatapb.MetadataTracepointServiceClient, mdconf metadatapb.MetadataConfigServiceClient, natsConn *nats.Conn, planner Planner, queryExecFactory QueryExecutorFactory) (*Server, error)
NewServerWithForwarderAndPlanner is NewServer with a QueryResultForwarder and a planner generating func.
func (*Server) CheckHealth ¶
CheckHealth runs the health check and returns an error if it didn't pass.
func (*Server) ExecuteScript ¶
func (s *Server) ExecuteScript(req *vizierpb.ExecuteScriptRequest, srv vizierpb.VizierService_ExecuteScriptServer) error
ExecuteScript executes the script and sends results through the gRPC stream.
func (*Server) GenerateOTelScript ¶
func (s *Server) GenerateOTelScript(ctx context.Context, req *vizierpb.GenerateOTelScriptRequest) (*vizierpb.GenerateOTelScriptResponse, error)
GenerateOTelScript generates an OTel script for the given DataFrame script.
func (*Server) HealthCheck ¶
func (s *Server) HealthCheck(req *vizierpb.HealthCheckRequest, srv vizierpb.VizierService_HealthCheckServer) error
HealthCheck continually responds with the current health of Vizier.
func (*Server) TransferResultChunk ¶
func (s *Server) TransferResultChunk(srv carnotpb.ResultSinkService_TransferResultChunkServer) error
TransferResultChunk implements the API that allows the query broker receive streamed results from Carnot instances.
type TracepointInfo ¶
TracepointInfo stores information of a particular tracepoint.
type TracepointMap ¶
type TracepointMap map[string]*TracepointInfo
TracepointMap stores a map from the name to tracepoint info.