Documentation ¶
Overview ¶
Package graphql provides HTTP handlers for the GraphQL API
Index ¶
- Constants
- func AddRoutes(router gin.IRouter, bindplane exposedserver.BindPlane)
- func AgentMetrics(ctx context.Context, bindplane exposedserver.BindPlane, period string, ...) (*model1.GraphMetrics, error)
- func ApplyQueryToChanges(ctx context.Context, query *search.Query, index search.Index, ...) store.Events[*model.Agent]
- func ApplyQueryToEvents[T model.Resource](ctx context.Context, query *search.Query, index search.Index, ...) store.Events[T]
- func ApplySelectorToChanges(selector *model.Selector, changes store.Events[*model.Agent]) store.Events[*model.Agent]
- func ApplySelectorToEvents[T model.Resource](selector *model.Selector, events store.Events[T]) store.Events[T]
- func AssignMetricsToGraph(metrics []*record.Metric, resolver NodeIDResolver) (*model1.GraphMetrics, error)
- func ConfigurationMetrics(ctx context.Context, bindplane exposedserver.BindPlane, period string, ...) (*model1.GraphMetrics, error)
- func ConfigurationNodeIDResolver(_ *record.Metric, position model.MeasurementPosition, _ bpotel.PipelineType, ...) string
- func Destinations(ctx context.Context, store store.Store, query *string, filterUnused *bool) ([]*model.Destination, error)
- func MetricSubscriber(ctx context.Context, sendMetrics func(), updateTicker *time.Ticker)
- func NewHandler(bindplane exposedserver.BindPlane) *handler.Server
- func OverviewGraph(ctx context.Context, b exposedserver.BindPlane, configsIDs []string, ...) (*graph.Graph, error)
- func OverviewMetrics(ctx context.Context, bindplane exposedserver.BindPlane, period string, ...) (*model1.GraphMetrics, error)
- type NodeIDResolver
- type Resolver
- func (r *Resolver) Agent() generated.AgentResolver
- func (r *Resolver) AgentChanges(ctx context.Context, selector *string, query *string) (<-chan []*model1.AgentChange, error)
- func (r *Resolver) AgentMetrics(ctx context.Context, period string, ids []string) (<-chan *model1.GraphMetrics, error)
- func (r *Resolver) AgentSelector() generated.AgentSelectorResolver
- func (r *Resolver) AgentUpgrade() generated.AgentUpgradeResolver
- func (r *Resolver) Agents(ctx context.Context, selector *string, query *string) (*model1.Agents, error)
- func (r *Resolver) Configuration() generated.ConfigurationResolver
- func (r *Resolver) ConfigurationChanges(ctx context.Context, selector *string, query *string) (<-chan []*model1.ConfigurationChange, error)
- func (r *Resolver) ConfigurationMetrics(ctx context.Context, period string, name *string, agent *string) (<-chan *model1.GraphMetrics, error)
- func (r *Resolver) Configurations(ctx context.Context, selector *string, query *string, ...) (*model1.Configurations, error)
- func (r *Resolver) Destination() generated.DestinationResolver
- func (r *Resolver) DestinationType() generated.DestinationTypeResolver
- func (r *Resolver) DestinationWithType(ctx context.Context, name string) (*model1.DestinationWithType, error)
- func (r *Resolver) HasAgentConfigurationChanges(updates store.BasicEventUpdates) bool
- func (r *Resolver) Metadata() generated.MetadataResolver
- func (r *Resolver) Mutation() generated.MutationResolver
- func (r *Resolver) OverviewMetrics(ctx context.Context, period string, configIDs []string, ...) (<-chan *model1.GraphMetrics, error)
- func (r *Resolver) OverviewPage(ctx context.Context, configIDs []string, destinationIDs []string, ...) (*model1.OverviewPage, error)
- func (r *Resolver) ParameterDefinition() generated.ParameterDefinitionResolver
- func (r *Resolver) ParameterOptions() generated.ParameterOptionsResolver
- func (r *Resolver) ParseSelectorAndQuery(selector *string, query *string) (*model.Selector, *search.Query, error)
- func (r *Resolver) Processor() generated.ProcessorResolver
- func (r *Resolver) ProcessorType() generated.ProcessorTypeResolver
- func (r *Resolver) ProcessorWithType(ctx context.Context, name string) (*model1.ProcessorWithType, error)
- func (r *Resolver) Query() generated.QueryResolver
- func (r *Resolver) QueryOptionsAndSuggestions(ctx context.Context, selector *string, query *string, index search.Index) ([]store.QueryOption, []*search.Suggestion, error)
- func (r *Resolver) RelevantIfCondition() generated.RelevantIfConditionResolver
- func (r *Resolver) RemoveAgentConfiguration(ctx context.Context, input *model1.RemoveAgentConfigurationInput) (*model.Agent, error)
- func (r *Resolver) Rollout() generated.RolloutResolver
- func (r *Resolver) Snapshot(ctx context.Context, agentID string, pipelineType otel.PipelineType, ...) (*model1.Snapshot, error)
- func (r *Resolver) Source() generated.SourceResolver
- func (r *Resolver) SourceType() generated.SourceTypeResolver
- func (r *Resolver) SourceWithType(ctx context.Context, name string) (*model1.SourceWithType, error)
- func (r *Resolver) Subscription() generated.SubscriptionResolver
- func (r *Resolver) Type(_ context.Context, obj *model.ParameterDefinition) (model1.ParameterType, error)
- func (r *Resolver) UpdateProcessors(ctx context.Context, input model1.UpdateProcessorsInput) (*bool, error)
- func (r *Resolver) UpgradeAvailable(ctx context.Context, obj *model.Agent) (*string, error)
Constants ¶
const AgentMetricsUpdateInterval = 10 * time.Second
AgentMetricsUpdateInterval is the interval at which the agent metrics are updated on the agent page
const ConfigurationMetricsUpdateInterval = 10 * time.Second
ConfigurationMetricsUpdateInterval is the interval at which the configuration metrics are updated on the configuration page
const OverviewMetricsUpdateInterval = 10 * time.Second
OverviewMetricsUpdateInterval is the interval at which the overview metrics are updated on the overview page
Variables ¶
This section is empty.
Functions ¶
func AddRoutes ¶
func AddRoutes(router gin.IRouter, bindplane exposedserver.BindPlane)
AddRoutes TODO(doc)
func AgentMetrics ¶
func AgentMetrics(ctx context.Context, bindplane exposedserver.BindPlane, period string, ids []string) (*model1.GraphMetrics, error)
AgentMetrics returns a list of metrics for the agent page
func ApplyQueryToChanges ¶
func ApplyQueryToChanges(ctx context.Context, query *search.Query, index search.Index, changes store.Events[*model.Agent]) store.Events[*model.Agent]
ApplyQueryToChanges applies the query to the changes and returns the changes that match the query.
func ApplyQueryToEvents ¶
func ApplyQueryToEvents[T model.Resource](ctx context.Context, query *search.Query, index search.Index, events store.Events[T]) store.Events[T]
ApplyQueryToEvents applies the query to the events and returns the events that match the query.
func ApplySelectorToChanges ¶
func ApplySelectorToChanges(selector *model.Selector, changes store.Events[*model.Agent]) store.Events[*model.Agent]
ApplySelectorToChanges applies the selector to the changes and returns the changes that match the selector.
func ApplySelectorToEvents ¶
func ApplySelectorToEvents[T model.Resource](selector *model.Selector, events store.Events[T]) store.Events[T]
ApplySelectorToEvents applies the selector to the events and returns the events that match the selector.
func AssignMetricsToGraph ¶ added in v1.29.0
func AssignMetricsToGraph(metrics []*record.Metric, resolver NodeIDResolver) (*model1.GraphMetrics, error)
AssignMetricsToGraph returns a GraphMetrics struct with metrics and max values. It assigns the appropriate NodeID to a GraphMetric based on its position and NodeIDResolver. as well as the agentID and PipelineType fields. It returns an error in the case it cannot convert a metric to a GraphMetric.
func ConfigurationMetrics ¶
func ConfigurationMetrics(ctx context.Context, bindplane exposedserver.BindPlane, period string, name *string) (*model1.GraphMetrics, error)
ConfigurationMetrics returns a list of metrics for the configuration page
func ConfigurationNodeIDResolver ¶
func ConfigurationNodeIDResolver(_ *record.Metric, position model.MeasurementPosition, _ bpotel.PipelineType, resourceName string) string
ConfigurationNodeIDResolver assigns the appropriate NodeID to a GraphMetric based on its position,
func Destinations ¶ added in v1.22.0
func Destinations(ctx context.Context, store store.Store, query *string, filterUnused *bool) ([]*model.Destination, error)
Destinations is the resolver for the destinations field.
func MetricSubscriber ¶
MetricSubscriber is a goroutine that sends metrics on a ticker
func NewHandler ¶
func NewHandler(bindplane exposedserver.BindPlane) *handler.Server
NewHandler creates a *handler.Server configured for Post and Websocket
func OverviewGraph ¶
func OverviewGraph(ctx context.Context, b exposedserver.BindPlane, configsIDs []string, destinationIDs []string, period string, telemetryType string) (*graph.Graph, error)
OverviewGraph returns a graph of the configurations and destinations
func OverviewMetrics ¶
func OverviewMetrics(ctx context.Context, bindplane exposedserver.BindPlane, period string, configIDs []string, destinationIDs []string) (*model1.GraphMetrics, error)
OverviewMetrics returns a list of metrics for the overview page
Types ¶
type NodeIDResolver ¶
type NodeIDResolver func(metric *record.Metric, position model.MeasurementPosition, pipelineType bpotel.PipelineType, resourceName string) string
NodeIDResolver is a function that assigns the appropriate NodeID to a GraphMetric based on its position, pipelineType, and resourceName parsed out of the metric processor name. If an empty string is returned, this metric will be ignored.
type Resolver ¶
type Resolver struct { Bindplane exposedserver.BindPlane Updates eventbus.Source[store.BasicEventUpdates] }
Resolver is the root resolver for the graphql server.
func NewResolver ¶
func NewResolver(bindplane exposedserver.BindPlane) *Resolver
NewResolver returns a new Resolver and starts a go routine that sends agent updates to observers.
func (*Resolver) Agent ¶
func (r *Resolver) Agent() generated.AgentResolver
Agent returns generated.AgentResolver implementation.
func (*Resolver) AgentChanges ¶
func (r *Resolver) AgentChanges(ctx context.Context, selector *string, query *string) (<-chan []*model1.AgentChange, error)
AgentChanges returns a channel of agent changes
func (*Resolver) AgentMetrics ¶
func (r *Resolver) AgentMetrics(ctx context.Context, period string, ids []string) (<-chan *model1.GraphMetrics, error)
AgentMetrics returns a channel of agent metrics
func (*Resolver) AgentSelector ¶
func (r *Resolver) AgentSelector() generated.AgentSelectorResolver
AgentSelector returns generated.AgentSelectorResolver implementation.
func (*Resolver) AgentUpgrade ¶
func (r *Resolver) AgentUpgrade() generated.AgentUpgradeResolver
AgentUpgrade returns generated.AgentUpgradeResolver implementation.
func (*Resolver) Agents ¶
func (r *Resolver) Agents(ctx context.Context, selector *string, query *string) (*model1.Agents, error)
Agents is the resolver for the agents field.
func (*Resolver) Configuration ¶
func (r *Resolver) Configuration() generated.ConfigurationResolver
Configuration returns generated.ConfigurationResolver implementation.
func (*Resolver) ConfigurationChanges ¶
func (r *Resolver) ConfigurationChanges(ctx context.Context, selector *string, query *string) (<-chan []*model1.ConfigurationChange, error)
ConfigurationChanges returns a channel of configuration changes
func (*Resolver) ConfigurationMetrics ¶
func (r *Resolver) ConfigurationMetrics(ctx context.Context, period string, name *string, agent *string) (<-chan *model1.GraphMetrics, error)
ConfigurationMetrics returns a channel of configuration metrics
func (*Resolver) Configurations ¶
func (r *Resolver) Configurations(ctx context.Context, selector *string, query *string, onlyDeployedConfigurations *bool) (*model1.Configurations, error)
Configurations is the resolver for the configurations field.
func (*Resolver) Destination ¶
func (r *Resolver) Destination() generated.DestinationResolver
Destination returns generated.DestinationResolver implementation.
func (*Resolver) DestinationType ¶
func (r *Resolver) DestinationType() generated.DestinationTypeResolver
DestinationType returns generated.DestinationTypeResolver implementation.
func (*Resolver) DestinationWithType ¶
func (r *Resolver) DestinationWithType(ctx context.Context, name string) (*model1.DestinationWithType, error)
DestinationWithType is the resolver for the destinationWithType field.
func (*Resolver) HasAgentConfigurationChanges ¶
func (r *Resolver) HasAgentConfigurationChanges(updates store.BasicEventUpdates) bool
HasAgentConfigurationChanges determines if there is an agent update in updates that would affect the list of configurations
func (*Resolver) Metadata ¶
func (r *Resolver) Metadata() generated.MetadataResolver
Metadata returns generated.MetadataResolver implementation.
func (*Resolver) Mutation ¶
func (r *Resolver) Mutation() generated.MutationResolver
Mutation returns generated.MutationResolver implementation.
func (*Resolver) OverviewMetrics ¶
func (r *Resolver) OverviewMetrics(ctx context.Context, period string, configIDs []string, destinationIDs []string) (<-chan *model1.GraphMetrics, error)
OverviewMetrics returns a channel of overview metrics
func (*Resolver) OverviewPage ¶
func (r *Resolver) OverviewPage(ctx context.Context, configIDs []string, destinationIDs []string, period string, telemetryType string) (*model1.OverviewPage, error)
OverviewPage is the resolver for the overviewPage field.
func (*Resolver) ParameterDefinition ¶
func (r *Resolver) ParameterDefinition() generated.ParameterDefinitionResolver
ParameterDefinition returns generated.ParameterDefinitionResolver implementation.
func (*Resolver) ParameterOptions ¶
func (r *Resolver) ParameterOptions() generated.ParameterOptionsResolver
ParameterOptions returns generated.ParameterOptionsResolver implementation.
func (*Resolver) ParseSelectorAndQuery ¶
func (r *Resolver) ParseSelectorAndQuery(selector *string, query *string) (*model.Selector, *search.Query, error)
ParseSelectorAndQuery parses the selector and query strings and returns the appropriate options
func (*Resolver) Processor ¶
func (r *Resolver) Processor() generated.ProcessorResolver
Processor returns generated.ProcessorResolver implementation.
func (*Resolver) ProcessorType ¶
func (r *Resolver) ProcessorType() generated.ProcessorTypeResolver
ProcessorType returns generated.ProcessorTypeResolver implementation.
func (*Resolver) ProcessorWithType ¶ added in v1.22.0
func (r *Resolver) ProcessorWithType(ctx context.Context, name string) (*model1.ProcessorWithType, error)
ProcessorWithType is the resolver for the processorWithType field.
func (*Resolver) Query ¶
func (r *Resolver) Query() generated.QueryResolver
Query returns generated.QueryResolver implementation.
func (*Resolver) QueryOptionsAndSuggestions ¶
func (r *Resolver) QueryOptionsAndSuggestions(ctx context.Context, selector *string, query *string, index search.Index) ([]store.QueryOption, []*search.Suggestion, error)
QueryOptionsAndSuggestions parses the selector and query strings and returns the appropriate options
func (*Resolver) RelevantIfCondition ¶
func (r *Resolver) RelevantIfCondition() generated.RelevantIfConditionResolver
RelevantIfCondition returns generated.RelevantIfConditionResolver implementation.
func (*Resolver) RemoveAgentConfiguration ¶
func (r *Resolver) RemoveAgentConfiguration(ctx context.Context, input *model1.RemoveAgentConfigurationInput) (*model.Agent, error)
RemoveAgentConfiguration sets the given agent's `configuration` label to blank
func (*Resolver) Rollout ¶
func (r *Resolver) Rollout() generated.RolloutResolver
Rollout returns generated.RolloutResolver implementation.
func (*Resolver) Snapshot ¶
func (r *Resolver) Snapshot(ctx context.Context, agentID string, pipelineType otel.PipelineType, position *string, resourceName *string) (*model1.Snapshot, error)
Snapshot returns a snapshot of the agent with the specified id and pipeline type
func (*Resolver) Source ¶
func (r *Resolver) Source() generated.SourceResolver
Source returns generated.SourceResolver implementation.
func (*Resolver) SourceType ¶
func (r *Resolver) SourceType() generated.SourceTypeResolver
SourceType returns generated.SourceTypeResolver implementation.
func (*Resolver) SourceWithType ¶ added in v1.22.0
SourceWithType is the resolver for the sourceWithType field.
func (*Resolver) Subscription ¶
func (r *Resolver) Subscription() generated.SubscriptionResolver
Subscription returns generated.SubscriptionResolver implementation.
func (*Resolver) Type ¶
func (r *Resolver) Type(_ context.Context, obj *model.ParameterDefinition) (model1.ParameterType, error)
Type is the resolver for the type field.
func (*Resolver) UpdateProcessors ¶
func (r *Resolver) UpdateProcessors(ctx context.Context, input model1.UpdateProcessorsInput) (*bool, error)
UpdateProcessors is the resolver for the updateProcessors field.