model

package
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 38 Imported by: 2

Documentation

Overview

Package model contains the data model for resources used in BindPlane

Index

Constants

View Source
const (
	// LabelBindPlaneAgentID is the label name for agent id
	LabelBindPlaneAgentID = "bindplane/agent-id"

	// LabelBindPlaneAgentName is the label name for agent name
	LabelBindPlaneAgentName = "bindplane/agent-name"

	// LabelBindPlaneAgentType is the label for the agent type
	LabelBindPlaneAgentType = "bindplane/agent-type"

	// LabelBindPlaneAgentVersion is the label name for agent version
	LabelBindPlaneAgentVersion = "bindplane/agent-version"

	// LabelBindPlaneAgentHost is the label name for agent host
	LabelBindPlaneAgentHost = "bindplane/agent-host"

	// LabelBindPlaneAgentOS is the label name for agent operating system
	LabelBindPlaneAgentOS = "bindplane/agent-os"

	// LabelBindPlaneAgentArch is the label name for agent cpu architecture
	LabelBindPlaneAgentArch = "bindplane/agent-arch"
)
View Source
const (
	// MetadataName TODO(doc)
	MetadataName = "name"
	// MetadataID TODO(doc)
	MetadataID = "id"
)
View Source
const AgentFeaturesDefault = AgentSupportsUpgrade

AgentFeaturesDefault is the default bitmask of features supported by Agents

View Source
const (
	// V1 is the version for the initial resources defined for BindPlane
	V1 = "bindplane.observiq.com/v1"
)

Variables

This section is empty.

Functions

func PrintResourceUpdates

func PrintResourceUpdates(writer io.Writer, resourceStatuses []*AnyResourceStatus)

PrintResourceUpdates TODO(doc)

func PrintableFieldValues

func PrintableFieldValues(p Printable) []string

PrintableFieldValues uses PrintableFieldTitles and PrintableFieldValue of the specified Printable to assemble the list of values to print

func PrintableFieldValuesForTitles

func PrintableFieldValuesForTitles(p Printable, titles []string) []string

PrintableFieldValuesForTitles uses PrintableFieldValue of the specified Printable to assemble the list of values to print for the specified titles

func SortAgentVersionsLatestFirst added in v1.0.0

func SortAgentVersionsLatestFirst(agentVersions []*AgentVersion)

SortAgentVersionsLatestFirst sorts agent versions by their semantic versions, newest first

func SortAgentsByName

func SortAgentsByName(agents []*Agent)

SortAgentsByName TODO(doc)

Types

type Agent

type Agent struct {
	ID              string `json:"id" yaml:"id"`
	Name            string `json:"name" yaml:"name"`
	Type            string `json:"type" yaml:"type"`
	Architecture    string `json:"arch" yaml:"arch"`
	HostName        string `json:"hostname" yaml:"hostname"`
	Labels          Labels `json:"labels,omitempty" yaml:"labels"`
	Version         string `json:"version" yaml:"version"`
	Home            string `json:"home" yaml:"home"`
	Platform        string `json:"platform" yaml:"platform"`
	OperatingSystem string `json:"operatingSystem" yaml:"operatingSystem"`
	MacAddress      string `json:"macAddress" yaml:"macAddress"`
	RemoteAddress   string `json:"remoteAddress,omitempty" yaml:"remoteAddress,omitempty"`

	// SecretKey is provided by the agent to authenticate
	SecretKey string `json:"-" yaml:"-"`

	// Upgrade stores information about an agent upgrade
	Upgrade *AgentUpgrade `json:"upgrade,omitempty" yaml:"upgrade,omitempty"`

	// reported by Status messages
	Status       AgentStatus `json:"status"`
	ErrorMessage string      `json:"errorMessage,omitempty" yaml:"errorMessage,omitempty"`

	// tracked by BindPlane
	Configuration  interface{} `json:"configuration,omitempty" yaml:"configuration,omitempty"`
	ConnectedAt    *time.Time  `json:"connectedAt,omitempty" yaml:"connectedAt,omitempty"`
	DisconnectedAt *time.Time  `json:"disconnectedAt,omitempty" yaml:"disconnectedAt,omitempty"`

	// used by the agent management protocol
	Protocol string      `json:"protocol,omitempty" yaml:"protocol,omitempty"`
	State    interface{} `json:"state,omitempty" yaml:"state,omitempty"`
}

Agent is a single observIQ OTel Collector instance

func (*Agent) Connect

func (a *Agent) Connect(newAgentVersion string)

Connect updates the ConnectedAt and DisconnectedAt fields of the agent and should be called when the agent connects.

func (*Agent) ConnectedDurationDisplayText

func (a *Agent) ConnectedDurationDisplayText() string

ConnectedDurationDisplayText TODO(doc)

func (*Agent) Disconnect

func (a *Agent) Disconnect()

Disconnect updates the DisconnectedAt and Status fields of the agent and should be called when the agent disconnects.

func (*Agent) DisconnectedDurationDisplayText

func (a *Agent) DisconnectedDurationDisplayText() string

DisconnectedDurationDisplayText TODO(doc) What RFC?

func (*Agent) DisconnectedSince

func (a *Agent) DisconnectedSince(since time.Time) bool

DisconnectedSince returns true if the agent has been disconnected since a given time.

func (*Agent) Features added in v1.1.0

func (a *Agent) Features() AgentFeatures

Features returns a bitmask of the features supported by this Agent

func (*Agent) GetLabels

func (a *Agent) GetLabels() Labels

GetLabels implements the Labeled interface for Agents

func (*Agent) HasFeatures added in v1.1.0

func (a *Agent) HasFeatures(feature AgentFeatures) bool

HasFeatures returns true if this Agent supports the specified feature or features.

func (*Agent) IndexFields

func (a *Agent) IndexFields(index search.Indexer)

IndexFields returns a map of field name to field value to be stored in the index

func (*Agent) IndexID

func (a *Agent) IndexID() string

IndexID returns an ID used to identify the resource that is indexed

func (*Agent) IndexLabels

func (a *Agent) IndexLabels(index search.Indexer)

IndexLabels returns a map of label name to label value to be stored in the index

func (*Agent) MatchesSelector

func (a *Agent) MatchesSelector(selector Selector) bool

MatchesSelector returns true if the given selector matches the agent's labels.

func (*Agent) PrintableFieldTitles

func (a *Agent) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Agent) PrintableFieldValue

func (a *Agent) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Agent) PrintableKindPlural

func (a *Agent) PrintableKindPlural() string

PrintableKindPlural returns the singular form of the Kind, e.g. "Agents"

func (*Agent) PrintableKindSingular

func (a *Agent) PrintableKindSingular() string

PrintableKindSingular returns the singular form of the Kind, e.g. "Agent"

func (*Agent) StatusDisplayText

func (a *Agent) StatusDisplayText() string

StatusDisplayText returns the string representation of the agent's status.

func (*Agent) SupportsUpgrade added in v1.0.0

func (a *Agent) SupportsUpgrade() bool

SupportsUpgrade returns true if this agent supports upgrade

func (*Agent) UniqueKey

func (a *Agent) UniqueKey() string

UniqueKey returns the agent ID to uniquely identify an Agent

func (*Agent) UpgradeComplete added in v1.0.0

func (a *Agent) UpgradeComplete(version, errorMessage string)

UpgradeComplete completes an upgrade by setting the status back to either Connected or Error (depending on ErrorMessage) and either removing the AgentUpgrade field or setting the Error on it if the specified errorMessage is not empty.

func (*Agent) UpgradeStarted added in v1.0.0

func (a *Agent) UpgradeStarted(version string, allPackagesHash []byte)

UpgradeStarted it set when the upgrade instructions have actually been sent to the Agent.

func (*Agent) UpgradeTo added in v1.0.0

func (a *Agent) UpgradeTo(version string)

UpgradeTo begins an upgrade by setting the status to Upgrading and setting the Upgrade field to the specified version.

type AgentDownload added in v1.0.0

type AgentDownload struct {
	URL  string `yaml:"url" json:"url" mapstructure:"url"`
	Hash string `yaml:"hash" json:"hash" mapstructure:"hash"`
}

AgentDownload contains the url to download the agent release and a hash to verify the contents of the download.

func (*AgentDownload) HashBytes added in v1.0.0

func (d *AgentDownload) HashBytes() []byte

HashBytes returns the Hash of the download decoded as a byte array or nil if the hash is unspecified or invalid. This does not return an error because it is expected that errors will be detected in validation and an error in the hash can be treated as if there is no hash.

type AgentFeatures added in v1.1.0

type AgentFeatures uint32

AgentFeatures is a bitmask of features supported by the Agent, usually based on its version.

const (
	// AgentSupportsUpgrade will be set if this Agent can be upgraded remotely.
	AgentSupportsUpgrade AgentFeatures = 1 << iota

	// AgentSupportsSnapshots will be set if this Agent can send snapshots of recent telemetry signals.
	AgentSupportsSnapshots

	// AgentSupportsMeasurements will be set if this Agent supports the throughputmeasurement processor for measuring throughput.
	AgentSupportsMeasurements

	// AgentSupportsLogBasedMetrics will be set if this agent supports the logcount processor and route receiver for creating metrics from logs.
	AgentSupportsLogBasedMetrics
)

func (AgentFeatures) Has added in v1.1.0

func (agentFeatures AgentFeatures) Has(feature AgentFeatures) bool

Has returns true if the AgentFeatures bitmask has the specified features enabled. This is simply implemented as agentFeatures&feature != 0 but I prefer to avoid using bitmasks directly when possible.

type AgentInstaller added in v1.0.0

type AgentInstaller struct {
	URL string `yaml:"url" json:"url" mapstructure:"url"`
}

AgentInstaller contains the url of the install script

type AgentLabelsPayload

type AgentLabelsPayload struct {
	Labels map[string]string `json:"labels"`
}

AgentLabelsPayload is the REST API body for PATCH /v1/agents/{id}/labels

type AgentLabelsResponse

type AgentLabelsResponse struct {
	Errors []string `json:"errors"`
	Labels *Labels  `json:"labels"`
}

AgentLabelsResponse is the REST API response to GET /v1/agents/{id}/labels

type AgentResponse

type AgentResponse struct {
	Agent *Agent `json:"agent"`
}

AgentResponse is the REST API response to GET /v1/agent/:name

type AgentSelector

type AgentSelector struct {
	MatchLabels `json:"matchLabels" yaml:"matchLabels" mapstructure:"matchLabels"`
}

AgentSelector specifies a selector to use to match resources to agents

func (AgentSelector) Selector

func (s AgentSelector) Selector() Selector

Selector creates a Selector struct from an AgentSelector

type AgentStatus

type AgentStatus uint8

AgentStatus TODO(doc)

const (
	// Disconnected is the state of an agent that was formerly Connected to the management platform but is no longer
	// connected. This could mean that the agent has stopped running, the network connection has been interrupted, or that
	// the server terminated the connection.
	Disconnected AgentStatus = 0

	// Connected is the normal state of a healthy agent that is Connected to the management platform.
	Connected AgentStatus = 1

	// Error occurs if there is an error running or Configuring the agent.
	Error AgentStatus = 2

	// ComponentFailed is deprecated.
	ComponentFailed AgentStatus = 4

	// Deleted is set on a deleted Agent before notifying observers of the change.
	Deleted AgentStatus = 5

	// Configuring is set on an Agent when it is sent a new configuration that has not been applied. After successful
	// Configuring, it will transition back to Connected. If there is an error Configuring, it will transition to Error.
	Configuring AgentStatus = 6

	// Upgrading is set on an Agent when it has been sent a new package that is being applied. After Upgrading, it will
	// transition back to Connected or Error unless it already has the Configuring status.
	Upgrading AgentStatus = 7
)

type AgentTypeName added in v1.0.0

type AgentTypeName string

AgentTypeName is the name of a type of agent

const (
	// AgentTypeNameObservIQOtelCollector is the name of the observIQ Distro for OpenTelemetry Collector
	AgentTypeNameObservIQOtelCollector AgentTypeName = "observiq-otel-collector"
)

type AgentUpgrade added in v1.0.0

type AgentUpgrade struct {
	// Status indicates the progress of the agent upgrade
	Status AgentUpgradeStatus `json:"status" yaml:"status"`

	// Version is used to indicate that an agent should be or is being upgraded. The agent status will be set to Upgrading
	// when the upgrade begins.
	Version string `json:"version,omitempty" yaml:"version,omitempty"`

	// AllPackagesHash is the hash of the packages sent to the agent to upgrade
	AllPackagesHash []byte `json:"allPackagesHash,omitempty" yaml:"allPackagesHash,omitempty"`

	// Error is set if there were errors upgrading the agent
	Error string `json:"error,omitempty" yaml:"error,omitempty"`
}

AgentUpgrade stores information on an Agent about the upgrade process.

type AgentUpgradeStatus added in v1.0.0

type AgentUpgradeStatus uint8

AgentUpgradeStatus is the status of the AgentUpgrade

const (
	// UpgradePending is set when the upgrade is initially started
	UpgradePending AgentUpgradeStatus = 0
	// UpgradeStarted is set when the upgrade has been sent to the agent
	UpgradeStarted AgentUpgradeStatus = 1
	// UpgradeFailed is set when the upgrade is complete but there was an error. If the upgrade is successful, the Agent
	// Upgrade field will be set to nil and there is no corresponding status.
	UpgradeFailed AgentUpgradeStatus = 2
)

type AgentVersion added in v1.0.0

type AgentVersion struct {
	// ResourceMeta TODO(doc)
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	// Spec TODO(doc)
	Spec AgentVersionSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
}

AgentVersion is the resource for a version of an agent and includes links to install scripts and downloads links for the agent release.

func NewAgentVersion added in v1.0.0

func NewAgentVersion(spec AgentVersionSpec) *AgentVersion

NewAgentVersion constructs a new AgentVersion with the specific spec. The name will be created based on the type and version.

func (*AgentVersion) AgentType added in v1.0.0

func (v *AgentVersion) AgentType() string

AgentType returns the type of agent for this AgentVersion

func (*AgentVersion) Download added in v1.0.0

func (v *AgentVersion) Download(platform string) *AgentDownload

Download returns the agent download for the specified platform in the form os or os/arch.

func (*AgentVersion) GetKind added in v1.0.0

func (v *AgentVersion) GetKind() Kind

GetKind returns "AgentVersion"

func (*AgentVersion) Installer added in v1.0.0

func (v *AgentVersion) Installer(platform string) *AgentInstaller

Installer returns the agent installer for the specified platform in the form os or os/arch.

func (*AgentVersion) PrintableFieldTitles added in v1.0.0

func (v *AgentVersion) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*AgentVersion) PrintableFieldValue added in v1.0.0

func (v *AgentVersion) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*AgentVersion) Public added in v1.0.0

func (v *AgentVersion) Public() bool

Public returns true if the version is not a draft or prerelease

func (*AgentVersion) SemanticVersion added in v1.0.0

func (v *AgentVersion) SemanticVersion() *semver.Version

SemanticVersion returns a parsed semantic version that can be used to compare to other versions

func (*AgentVersion) Validate added in v1.0.0

func (v *AgentVersion) Validate() (warnings string, errors error)

Validate ensures that each of the fields of an AgentVersion is valid. The name must equal "Type-Version"

func (*AgentVersion) Version added in v1.0.0

func (v *AgentVersion) Version() string

Version returns the version of the AgentVersion

type AgentVersionResponse added in v1.0.0

type AgentVersionResponse struct {
	AgentVersion *AgentVersion `json:"agentVersion"`
}

AgentVersionResponse is the REST API response to GET /v1/agent-versions/:name

type AgentVersionSpec added in v1.0.0

type AgentVersionSpec struct {
	Type            string                    `yaml:"type" json:"type" mapstructure:"type"`
	Version         string                    `yaml:"version" json:"version" mapstructure:"version"`
	ReleaseNotesURL string                    `yaml:"releaseNotesURL" json:"releaseNotesURL" mapstructure:"releaseNotesURL"`
	Draft           bool                      `yaml:"draft" json:"draft" mapstructure:"draft"`
	Prerelease      bool                      `yaml:"prerelease" json:"prerelease" mapstructure:"prerelease"`
	Installer       map[string]AgentInstaller `yaml:"installer" json:"installer" mapstructure:"installer"`
	Download        map[string]AgentDownload  `yaml:"download" json:"download" mapstructure:"download"`

	// ReleaseDate is an RFC3339 encoded date in a string
	ReleaseDate string `yaml:"releaseDate" json:"releaseDate" mapstructure:"releaseDate"`
}

AgentVersionSpec is the spec for an AgentVersion

type AgentVersionsResponse added in v1.0.0

type AgentVersionsResponse struct {
	AgentVersions []*AgentVersion `json:"agentVersions"`
}

AgentVersionsResponse is the REST API response to GET /v1/agent-versions

type AgentsResponse

type AgentsResponse struct {
	Agents []*Agent `json:"agents"`
}

AgentsResponse is the REST API response to GET /v1/agents endpoint.

type AnyResource

type AnyResource struct {
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	Spec         map[string]interface{} `yaml:"spec" json:"spec" mapstructure:"spec"`
}

AnyResource is a resource not yet fully parsed and is the common structure of all Resources. The Spec, which is different for each kind of resource, is represented as a map[string]interface{} and can be further parsed using mapstructure. Use ParseResource or ParseResources to obtain a fully parsed Resource.

func ResourcesFromFile

func ResourcesFromFile(filename string) ([]*AnyResource, error)

ResourcesFromFile creates an io.Reader from reading the given file and uses unmarshalResources to return a slice of *AnyResource read from the file.

func ResourcesFromReader

func ResourcesFromReader(reader io.Reader) ([]*AnyResource, error)

ResourcesFromReader creates a yaml decoder from an io.Reader and returns a slice of *AnyResource and an error. If the decoder is able to reach the end of the reader with no error, err will be nil.

type AnyResourceStatus

type AnyResourceStatus struct {
	Resource AnyResource  `json:"resource" mapstructure:"resource"`
	Status   UpdateStatus `json:"status" mapstructure:"status"`
	Reason   string       `json:"reason" mapstructure:"reason"`
}

AnyResourceStatus TODO(doc) Same as ResourceStatus but used by cli to parse response from the rest api.

func (*AnyResourceStatus) Message

func (s *AnyResourceStatus) Message() string

Message returns the summary of the ResourceStatus, e.g. "exporter updated"

type ApplyPayload

type ApplyPayload struct {
	Resources []*AnyResource `json:"resources"`
}

ApplyPayload is the REST API body for POST /v1/apply

type ApplyResponse

type ApplyResponse struct {
	Updates []ResourceStatus `json:"updates"`
}

ApplyResponse is the REST API response to POST /v1/apply. This is used on the server side to return updates consisting of generic ResourceStatuses.

type ApplyResponseClientSide

type ApplyResponseClientSide struct {
	Updates []*AnyResourceStatus `json:"updates"`
}

ApplyResponseClientSide is the REST API Response. This is used on the client side where updates consists of AnyResourceStatuses.

type AwsCloudWatchNamedFieldItem added in v1.5.0

type AwsCloudWatchNamedFieldItem struct {
	ID       string   `mapstructure:"id" yaml:"id,omitempty"`
	Names    []string `mapstructure:"names" yaml:"names,omitempty"`
	Prefixes []string `mapstructure:"prefixes" yaml:"prefixes,omitempty"`
}

AwsCloudWatchNamedFieldItem is the specified log group name which holds custom stream prefix and name filters

type BindPlaneConfiguration added in v1.3.0

type BindPlaneConfiguration interface {
	BindPlaneURL() string
	BindPlaneInsecureSkipVerify() bool
}

BindPlaneConfiguration includes configuration information needed to render configurations

type BulkAgentLabelsPayload

type BulkAgentLabelsPayload struct {
	IDs       []string          `json:"ids"`
	Labels    map[string]string `json:"labels"`
	Overwrite bool              `json:"overwrite"`
}

BulkAgentLabelsPayload is the REST API body for PATCH /v1/agents/labels

type BulkAgentLabelsResponse

type BulkAgentLabelsResponse struct {
	Errors []string `json:"errors"`
}

BulkAgentLabelsResponse is the REST API response to PATCH /v1/agents/labels

type CloudWatchNamedFieldValue added in v1.5.0

type CloudWatchNamedFieldValue []AwsCloudWatchNamedFieldItem

CloudWatchNamedFieldValue is type for storing multiple instances of named log groups

type Configuration

type Configuration struct {
	// ResourceMeta TODO(doc)
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	// Spec TODO(doc)
	Spec ConfigurationSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
}

Configuration is the resource for the entire agent configuration

func NewConfiguration

func NewConfiguration(name string) *Configuration

NewConfiguration creates a new configuration with the specified name

func NewConfigurationWithSpec

func NewConfigurationWithSpec(name string, spec ConfigurationSpec) *Configuration

NewConfigurationWithSpec creates a new configuration with the specified name and spec

func NewRawConfiguration

func NewRawConfiguration(name string, raw string) *Configuration

NewRawConfiguration creates a new configuration with the specified name and raw configuration

func (*Configuration) AgentSelector

func (c *Configuration) AgentSelector() Selector

AgentSelector returns the Selector for this configuration that can be used to match this resource to agents.

func (*Configuration) Duplicate added in v1.0.0

func (c *Configuration) Duplicate(name string) *Configuration

Duplicate copies the value of the current configuration and returns a duplicate with the new name. It should be identical except for the Metadata.Name, Metadata.ID, and Spec.Selector fields.

func (*Configuration) GetKind

func (c *Configuration) GetKind() Kind

GetKind returns "Configuration"

func (*Configuration) Graph added in v1.3.0

func (c *Configuration) Graph(ctx context.Context, store ResourceStore) (*graph.Graph, error)

Graph returns a graph representing the topology of a configuration

func (*Configuration) IndexFields

func (c *Configuration) IndexFields(index search.Indexer)

IndexFields returns a map of field name to field value to be stored in the index

func (*Configuration) IsForAgent

func (c *Configuration) IsForAgent(agent *Agent) bool

IsForAgent returns true if this configuration matches a given agent's labels.

func (*Configuration) PrintableFieldTitles

func (c *Configuration) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Configuration) PrintableFieldValue

func (c *Configuration) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Configuration) Render

func (c *Configuration) Render(ctx context.Context, agent *Agent, config BindPlaneConfiguration, store ResourceStore) (string, error)

Render converts the Configuration model to a configuration yaml that can be sent to an agent. The specified Agent can be nil if this configuration is not being rendered for a specific agent.

func (*Configuration) Type

func (c *Configuration) Type() ConfigurationType

Type returns the ConfigurationType. It is based on the presence of the Raw, Sources, and Destinations fields.

func (*Configuration) Usage added in v1.3.0

Usage returns a PipelineTypeUsage struct which contains information about the active and supported telemetry types on a configuration.

func (*Configuration) Validate

func (c *Configuration) Validate() (warnings string, errors error)

Validate validates most of the configuration, but if a store is available, ValidateWithStore should be used to validate the sources and destinations.

func (*Configuration) ValidateWithStore

func (c *Configuration) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the configuration is valid, returning an error if it is not. It uses the store to retrieve source types and destination types so that parameter values can be validated against the parameter definitions.

type ConfigurationResponse

type ConfigurationResponse struct {
	Configuration *Configuration `json:"configuration"`
	Raw           string         `json:"raw"`
}

ConfigurationResponse is the REST API response to GET /v1/configuration/:name

type ConfigurationSpec

type ConfigurationSpec struct {
	ContentType  string                  `json:"contentType" yaml:"contentType" mapstructure:"contentType"`
	Raw          string                  `json:"raw,omitempty" yaml:"raw,omitempty" mapstructure:"raw"`
	Sources      []ResourceConfiguration `json:"sources,omitempty" yaml:"sources,omitempty" mapstructure:"sources"`
	Destinations []ResourceConfiguration `json:"destinations,omitempty" yaml:"destinations,omitempty" mapstructure:"destinations"`
	Selector     AgentSelector           `json:"selector" yaml:"selector" mapstructure:"selector"`
}

ConfigurationSpec is the spec for a configuration resource

type ConfigurationType

type ConfigurationType string

ConfigurationType indicates the kind of configuration. It is based on the presence of the Raw, Sources, and Destinations fields.

const (
	// ConfigurationTypeRaw configurations have a configuration in the Raw field that is passed directly to the agent.
	ConfigurationTypeRaw ConfigurationType = "raw"

	// ConfigurationTypeModular configurations have Sources and Destinations that are used to generate the configuration to pass to an agent.
	ConfigurationTypeModular ConfigurationType = "modular"
)

type ConfigurationsResponse

type ConfigurationsResponse struct {
	Configurations []*Configuration `json:"configurations"`
}

ConfigurationsResponse is the REST API response to GET /v1/configurations

type Context

type Context struct {
	// ResourceMeta TODO(doc)
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	// Spec TODO(doc)
	Spec ContextSpec `json:"spec" yaml:"spec,omitempty" mapstructure:"spec"`
}

Context TODO(doc)

func NewContext

func NewContext(name string, spec ContextSpec) *Context

NewContext rtakes a name and ContextSpec and returns a *Context.

func NewContextWithMetadata

func NewContextWithMetadata(metadata Metadata, spec ContextSpec) *Context

NewContextWithMetadata takes a Metadata and ContextSpec and returns a *Context.

type ContextSpec

type ContextSpec struct {
	// CurrentContext TODO(doc)
	CurrentContext string `json:"currentContext" yaml:"currentContext" mapstructure:"currentContext"`
}

ContextSpec TODO(doc)

type DeleteAgentsPayload

type DeleteAgentsPayload struct {
	IDs []string `json:"ids"`
}

DeleteAgentsPayload is the REST API body to DELETE /v1/agents

type DeleteAgentsResponse

type DeleteAgentsResponse = AgentsResponse

DeleteAgentsResponse is the REST API response to DELETE /v1/agents

type DeletePayload

type DeletePayload struct {
	Resources []*AnyResource `json:"resources"`
}

DeletePayload is the REST API body for POST /v1/delete. Though resources with full Spec can be included its only necessary for the Kind and Metadata.Name fields to be present.

type DeleteResponse

type DeleteResponse struct {
	Errors  []string         `json:"errors"`
	Updates []ResourceStatus `json:"updates"`
}

DeleteResponse is the REST API response to POST /v1/delete

type DeleteResponseClientSide

type DeleteResponseClientSide struct {
	Errors  []string             `json:"errors"`
	Updates []*AnyResourceStatus `json:"updates"`
}

DeleteResponseClientSide is the REST API response to POST /v1/delete

type Destination

type Destination struct {
	// ResourceMeta TODO(doc)
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	// Spec TODO(doc)
	Spec ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
}

Destination will generate an exporter and be at the end of a pipeline

func FindDestination

func FindDestination(ctx context.Context, destination *ResourceConfiguration, defaultName string, store ResourceStore) (*Destination, error)

FindDestination returns a Destination from the store if it exists. If it doesn't exist, it creates a new Destination with the specified defaultName.

func NewDestination

func NewDestination(name string, typeValue string, parameters []Parameter) *Destination

NewDestination creates a new Destination with the specified name, type, and parameters

func NewDestinationWithSpec

func NewDestinationWithSpec(name string, spec ParameterizedSpec) *Destination

NewDestinationWithSpec creates a new Destination with the specified spec

func (*Destination) ComponentID

func (d *Destination) ComponentID(name string) otel.ComponentID

ComponentID provides a unique component id for the specified component name

func (*Destination) GetKind

func (d *Destination) GetKind() Kind

GetKind returns "Destination"

func (*Destination) PrintableFieldTitles

func (d *Destination) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Destination) PrintableFieldValue

func (d *Destination) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Destination) ResourceParameters

func (d *Destination) ResourceParameters() []Parameter

ResourceParameters are the parameters passed to the ResourceType to generate the configuration

func (*Destination) ResourceTypeName

func (d *Destination) ResourceTypeName() string

ResourceTypeName is the name of the ResourceType that renders this resource type

func (*Destination) ValidateWithStore

func (d *Destination) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the destination is valid, returning an error if it is not. It uses the store to retrieve the destination type so that parameter values can be validated against the parameter definitions.

type DestinationResponse

type DestinationResponse struct {
	Destination *Destination `json:"destination"`
}

DestinationResponse is the REST API response to GET /v1/destinations/:name

type DestinationType

type DestinationType struct {
	ResourceType `yaml:",inline" json:",inline" mapstructure:",squash"`
}

DestinationType is a ResourceType used to define destinations

func NewDestinationType

func NewDestinationType(name string, parameters []ParameterDefinition) *DestinationType

NewDestinationType creates a new sourtype with the specified name,

func NewDestinationTypeWithSpec

func NewDestinationTypeWithSpec(name string, spec ResourceTypeSpec) *DestinationType

NewDestinationTypeWithSpec creates a new sourtype with the specified name and spec.

func (*DestinationType) GetKind

func (d *DestinationType) GetKind() Kind

GetKind returns "DestinationType"

type DestinationTypeResponse

type DestinationTypeResponse struct {
	DestinationType *DestinationType `json:"destinationType"`
}

DestinationTypeResponse is the REST API response to GET /v1/destinationType/:name

type DestinationTypesResponse

type DestinationTypesResponse struct {
	DestinationTypes []*DestinationType `json:"destinationTypes"`
}

DestinationTypesResponse is the REST API response to GET /v1/destinationTypes

type DestinationsResponse

type DestinationsResponse struct {
	Destinations []*Destination `json:"destinations"`
}

DestinationsResponse is the REST API response to GET /v1/destinations

type DocumentationLink struct {
	Text string `json:"text" yaml:"text"`
	URL  string `json:"url" yaml:"url"`
}

DocumentationLink contains the text and url for documentation of a ParameterDefinition

type ErrorResponse added in v1.0.0

type ErrorResponse struct {
	Errors []string `json:"errors"`
}

ErrorResponse is the expected response when receiving non 2xx status codes.

type HasAgentSelector

type HasAgentSelector interface {
	// AgentSelector TODO(docs)
	AgentSelector() Selector
	IsForAgent(agent *Agent) bool
}

HasAgentSelector TODO(docs)

type HasUniqueKey

type HasUniqueKey interface {
	UniqueKey() string
}

HasUniqueKey is an interface that provides access to a unique key for an item. For Agents this is the ID and for Resources this is the Name.

type InstallCommandResponse

type InstallCommandResponse struct {
	Command string `json:"command"`
}

InstallCommandResponse is the REST API response to GET /v1/agent-versions/{version}/install-command

type Kind

type Kind string

Kind indicates the kind of resource, e.g. Configuration

const (
	KindProfile         Kind = "Profile"
	KindContext         Kind = "Context"
	KindConfiguration   Kind = "Configuration"
	KindAgent           Kind = "Agent"
	KindAgentVersion    Kind = "AgentVersion"
	KindSource          Kind = "Source"
	KindProcessor       Kind = "Processor"
	KindDestination     Kind = "Destination"
	KindSourceType      Kind = "SourceType"
	KindProcessorType   Kind = "ProcessorType"
	KindDestinationType Kind = "DestinationType"
	KindUnknown         Kind = "Unknown"
)

Kind values correspond to the kinds of resources currently supported by BindPlane

func ParseKind

func ParseKind(kind string) Kind

ParseKind parses a kind from a specified string parameter, validating that it matches an existing kind. It ignores the case of the string parameter and also allows plurals, e.g. configurations => KindConfiguration. KindUnknown is returned if that specified kind does not match any known Kinds.

type Labeled

type Labeled interface {
	// GetLabels TODO(doc)
	GetLabels() Labels
}

Labeled TODO(doc)

type Labels

type Labels struct {
	labels.Set `json:"-" yaml:",inline"`
}

Labels is a wrapper around Kubernetes labels.Set struct, which is just a type definition for map[string]string.

func LabelsFromMap

func LabelsFromMap(labels map[string]string) (Labels, error)

LabelsFromMap will create a set of labels from a map of name/value pairs. It will validate that the names and values conform to the requirements, matching those of kubernetes labels. See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/. Valid labels will be added to the Labels returned and any invalid labels will produce an error. This makes it possible for callers to ignore the errors and accept any valid values specified.

func LabelsFromMerge

func LabelsFromMerge(existing, new Labels) Labels

LabelsFromMerge merges new labels into existing labels. Any labels with blank values in the merged labels will be removed

func LabelsFromSelector

func LabelsFromSelector(selector string) (Labels, error)

LabelsFromSelector TODO(doc)

func LabelsFromValidatedMap

func LabelsFromValidatedMap(labels map[string]string) Labels

LabelsFromValidatedMap returns a set of labels from map that is assumed to already be validated.

func MakeLabels

func MakeLabels() Labels

MakeLabels returns a new, empty Labels object

func (*Labels) AsMap

func (l *Labels) AsMap() map[string]string

AsMap returns the labels as a map of name/value pairs

func (Labels) BindPlane

func (l Labels) BindPlane() Labels

BindPlane returns the BindPlane labels, i.e. labels starting with "bindplane/"

func (Labels) Conflicts

func (l Labels) Conflicts(o Labels) bool

Conflicts returns true if the specified set of labels has a label with the same name as this set of labels but with a different value.

func (Labels) Custom

func (l Labels) Custom() Labels

Custom returns the custom labels, i.e. labels not starting with "bindplane/"

func (*Labels) MarshalJSON

func (l *Labels) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Labels as JSON. An empty Labels will be marshalled as `{}`

func (*Labels) UnmarshalJSON

func (l *Labels) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals JSON bytes into the Label's internal Set

type MatchLabels

type MatchLabels map[string]string

MatchLabels represents the labels used to match Pipelines with Agents.

type MeasurementPosition added in v1.3.0

type MeasurementPosition string

MeasurementPosition is a position within the graph of the measurements processor

const (
	// MeasurementPositionSourceBeforeProcessors is the initial throughput of the source
	MeasurementPositionSourceBeforeProcessors MeasurementPosition = "s0"

	// MeasurementPositionSourceAfterProcessors is the throughput after source processors
	MeasurementPositionSourceAfterProcessors MeasurementPosition = "s1"

	// MeasurementPositionDestinationBeforeProcessors is the throughput to the destination (from all sources) before
	// destination processors
	MeasurementPositionDestinationBeforeProcessors MeasurementPosition = "d0"

	// MeasurementPositionDestinationAfterProcessors is the throughput to the destination (from all sources) after
	// destination processors
	MeasurementPositionDestinationAfterProcessors MeasurementPosition = "d1"
)

type Metadata

type Metadata struct {
	ID          string `yaml:"id,omitempty" json:"id" mapstructure:"id"`
	Name        string `yaml:"name,omitempty" json:"name" mapstructure:"name"`
	DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty" mapstructure:"displayName"`
	Description string `yaml:"description,omitempty" json:"description,omitempty" mapstructure:"description"`
	Icon        string `yaml:"icon,omitempty" json:"icon,omitempty" mapstructure:"icon"`
	Labels      Labels `yaml:"labels,omitempty" json:"labels" mapstructure:"labels"`
}

Metadata TODO(doc)

type MetricCategory added in v1.1.0

type MetricCategory struct {
	Label string `json:"label" yaml:"label"`
	// 0 or 1
	Column int `json:"column" yaml:"column"`

	Metrics []MetricOption `json:"metrics" yaml:"metrics"`
}

MetricCategory consists of the label, optional column, and metrics for a metricsType Parameter

type MetricOption added in v1.1.0

type MetricOption struct {
	Name            string  `json:"name" yaml:"name"`
	Description     *string `json:"description" yaml:"description"`
	KPI             *bool   `json:"kpi" yaml:"kpi"`
	DefaultDisabled bool    `json:"defaultDisabled" yaml:"defaultDisabled"`
}

MetricOption is an individual metric that can be specified for a metricsType Parameter

type Parameter

type Parameter struct {
	Name string `json:"name" yaml:"name" mapstructure:"name"`
	// This could be any of the following: string, bool, int, enum (string), float, []string
	Value interface{} `json:"value" yaml:"value" mapstructure:"value"`
}

Parameter TODO(doc)

type ParameterDefinition

type ParameterDefinition struct {
	Name        string `json:"name" yaml:"name"`
	Label       string `json:"label" yaml:"label"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Required    bool   `json:"required,omitempty" yaml:"required,omitempty"`

	// "string", "int", "bool", "strings", or "enum"
	Type string `json:"type" yaml:"type"`

	// only useable if Type == "enum"
	ValidValues []string `json:"validValues,omitempty" yaml:"validValues,omitempty" mapstructure:"validValues"`

	// Must be valid according to Type & ValidValues
	Default        interface{}           `json:"default,omitempty" yaml:"default,omitempty"`
	RelevantIf     []RelevantIfCondition `json:"relevantIf,omitempty" yaml:"relevantIf,omitempty" mapstructure:"relevantIf"`
	Hidden         bool                  `json:"hidden,omitempty" yaml:"hidden,omitempty"`
	AdvancedConfig bool                  `json:"advancedConfig,omitempty" yaml:"advancedConfig,omitempty" mapstructure:"advancedConfig"`

	Options ParameterOptions `json:"options,omitempty" yaml:"options,omitempty"`

	Documentation []DocumentationLink `json:"documentation,omitempty" yaml:"documentation,omitempty"`
}

ParameterDefinition is a basic description of a definition's parameter. This implementation comes directly from stanza plugin parameters with slight modifications for mapstructure.

type ParameterOptions added in v1.0.0

type ParameterOptions struct {
	// Creatable will modify the "enum" parameter from a select to
	// a creatable select where a user can specify a custom value
	Creatable bool `json:"creatable,omitempty" yaml:"creatable,omitempty"`

	// TrackUnchecked will modify the "enums" parameter to store the
	// unchecked values as the value.
	TrackUnchecked bool `json:"trackUnchecked,omitempty" yaml:"trackUnchecked,omitempty"`

	// GridColumns will specify the number of flex-grid columns the
	// control will take up, must be an integer between 1 and 12 or
	// unspecified.
	GridColumns *int `json:"gridColumns,omitempty" yaml:"gridColumns,omitempty"`

	// SectionHeader is used to indicate that the bool parameter input is
	// a switch for further configuration for UI styling.
	SectionHeader *bool `json:"sectionHeader,omitempty" yaml:"sectionHeader,omitempty"`

	MetricCategories []MetricCategory `json:"metricCategories,omitempty" yaml:"metricCategories,omitempty"`

	// Multiline indicates that a multiline textarea should be used for editing a "string" parameter.
	Multiline bool `json:"multiline,omitempty" yaml:"multiline,omitempty"`

	// Labels indicate labels that can be used when rendering the parameter. This was added for the "map" parameter type
	// to make the "key" and "value" labels configurable.
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}

ParameterOptions specify further customization for input parameters

type ParameterizedSpec

type ParameterizedSpec struct {
	Type       string                  `yaml:"type" json:"type" mapstructure:"type"`
	Parameters []Parameter             `yaml:"parameters" json:"parameters" mapstructure:"parameters"`
	Processors []ResourceConfiguration `yaml:"processors,omitempty" json:"processors,omitempty" mapstructure:"processors"`
	Disabled   bool                    `yaml:"disabled" json:"disabled" mapstructure:"disabled"`
}

ParameterizedSpec is the spec for a ParameterizedResource

type PatchAgentVersionsRequest added in v1.0.0

type PatchAgentVersionsRequest struct {
	Version string   `json:"version"`
	IDs     []string `json:"ids"`
}

PatchAgentVersionsRequest is the REST API body for PATCH /v1/agents/version

type PipelineTypeUsage added in v1.3.0

type PipelineTypeUsage struct {
	// contains filtered or unexported fields
}

PipelineTypeUsage contains information about active telemetry on the Configuration and its sources and destinations.

func (*PipelineTypeUsage) ActiveFlags added in v1.3.0

func (p *PipelineTypeUsage) ActiveFlags() otel.PipelineTypeFlags

ActiveFlags returns the pipeline type flags that are in use by the configuration.

func (*PipelineTypeUsage) ActiveFlagsForDestination added in v1.3.0

func (p *PipelineTypeUsage) ActiveFlagsForDestination(name string) otel.PipelineTypeFlags

ActiveFlagsForDestination returns the PipelineTypeFlags that are active for a destination with given name.

type PostAgentVersionRequest

type PostAgentVersionRequest struct {
	Version string `json:"version"`
}

PostAgentVersionRequest is the REST API body for POST /v1/agents/{id}/version

type PostCopyConfigRequest added in v1.0.0

type PostCopyConfigRequest struct {
	// The intended name of the duplicated config
	Name string `json:"name"`
}

PostCopyConfigRequest is the REST API body for PUT /v1/configurations/{name}/copy

type PostCopyConfigResponse added in v1.0.0

type PostCopyConfigResponse = PostCopyConfigRequest

PostCopyConfigResponse is the REST API response to PUT /v1/configurations/{name}/copy

type Printable

type Printable interface {
	// PrintableKindSingular returns the singular form of the Kind, e.g. "Configuration"
	PrintableKindSingular() string

	// PrintableKindPlural returns the plural form of the Kind, e.g. "Configurations"
	PrintableKindPlural() string

	// PrintableFieldTitles returns the list of field titles, used for printing a table of resources
	PrintableFieldTitles() []string

	// PrintableFieldValue returns the field value for a title, used for printing a table of resources
	PrintableFieldValue(title string) string
}

Printable is implemented for resources so that they can be printed by the CLI.

type Processor added in v0.5.2

type Processor struct {
	// ResourceMeta TODO(doc)
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	// Spec TODO(doc)
	Spec ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
}

Processor will generate an exporter and be at the end of a pipeline

func FindProcessor added in v0.5.2

func FindProcessor(ctx context.Context, processor *ResourceConfiguration, defaultName string, store ResourceStore) (*Processor, error)

FindProcessor returns a Processor from the store if it exists. If it doesn't exist, it creates a new Processor with the specified defaultName.

func NewProcessor added in v0.5.2

func NewProcessor(name string, processorTypeName string, parameters []Parameter) *Processor

NewProcessor creates a new Processor with the specified name, type, and parameters

func NewProcessorWithSpec added in v0.5.2

func NewProcessorWithSpec(name string, spec ParameterizedSpec) *Processor

NewProcessorWithSpec creates a new Processor with the specified spec

func (*Processor) ComponentID added in v0.5.2

func (s *Processor) ComponentID(name string) otel.ComponentID

ComponentID provides a unique component id for the specified component name

func (*Processor) GetKind added in v0.5.2

func (s *Processor) GetKind() Kind

GetKind returns "Processor"

func (*Processor) PrintableFieldTitles added in v0.5.2

func (s *Processor) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Processor) PrintableFieldValue added in v0.5.2

func (s *Processor) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Processor) ResourceParameters added in v0.5.2

func (s *Processor) ResourceParameters() []Parameter

ResourceParameters are the parameters passed to the ResourceType to generate the configuration

func (*Processor) ResourceTypeName added in v0.5.2

func (s *Processor) ResourceTypeName() string

ResourceTypeName is the name of the ResourceType that renders this resource type

func (*Processor) ValidateWithStore added in v0.5.2

func (s *Processor) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the processor is valid, returning an error if it is not. It uses the store to retrieve the processor type so that parameter values can be validated against the parameter definitions.

type ProcessorResponse added in v0.5.2

type ProcessorResponse struct {
	Processor *Processor `json:"processor"`
}

ProcessorResponse is the REST API response to GET /v1/processors/:name

type ProcessorType added in v0.5.2

type ProcessorType struct {
	ResourceType `yaml:",inline" json:",inline" mapstructure:",squash"`
}

ProcessorType is a ResourceType used to define sources

func NewProcessorType added in v0.5.2

func NewProcessorType(name string, parameters []ParameterDefinition) *ProcessorType

NewProcessorType creates a new processor-type with the specified name,

func NewProcessorTypeWithSpec added in v0.5.2

func NewProcessorTypeWithSpec(name string, spec ResourceTypeSpec) *ProcessorType

NewProcessorTypeWithSpec creates a new processor-type with the specified name and spec.

func (*ProcessorType) GetKind added in v0.5.2

func (s *ProcessorType) GetKind() Kind

GetKind returns "ProcessorType"

type ProcessorTypeResponse added in v0.5.2

type ProcessorTypeResponse struct {
	ProcessorType *ProcessorType `json:"processorType"`
}

ProcessorTypeResponse is the REST API response to GET /v1/processorType/:name

type ProcessorTypesResponse added in v0.5.2

type ProcessorTypesResponse struct {
	ProcessorTypes []*ProcessorType `json:"processorTypes"`
}

ProcessorTypesResponse is the REST API response to GET /v1/processorTypes

type ProcessorsResponse added in v0.5.2

type ProcessorsResponse struct {
	Processors []*Processor `json:"processors"`
}

ProcessorsResponse is the REST API response to GET /v1/processors

type Profile

type Profile struct {
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	Spec         ProfileSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
}

Profile TODO(doc)

func NewProfile

func NewProfile(name string, spec ProfileSpec) *Profile

NewProfile takes a name and ProfileSpec and returns a *Profile.

func NewProfileWithMetadata

func NewProfileWithMetadata(metadata Metadata, spec ProfileSpec) *Profile

NewProfileWithMetadata takes a Metadata and ProfileSpec and returns a *Profile.

type ProfileSpec

type ProfileSpec struct {
	common.Common  `mapstructure:",squash" yaml:",inline,omitempty"`
	common.Server  `mapstructure:"server" yaml:"server,omitempty"`
	common.Client  `mapstructure:"client" yaml:"client,omitempty"`
	common.Command `mapstructure:"command" yaml:"command,omitempty"`
}

ProfileSpec TODO(doc)

type RelevantIfCondition

type RelevantIfCondition struct {
	Name     string `json:"name" yaml:"name" mapstructure:"name"`
	Operator string `json:"operator" yaml:"operator" mapstructure:"operator"`
	Value    any    `json:"value" yaml:"value" mapstructure:"value"`
}

RelevantIfCondition specifies a condition under which a parameter is deemed relevant.

type Resource

type Resource interface {
	// all resources can be labeled
	Labeled

	// all resources can be indexed
	search.Indexed

	// all resources have a unique key
	HasUniqueKey

	// ID returns the uuid for this resource
	ID() string

	// SetID replaces the uuid for this resource
	SetID(id string)

	// EnsureID generates a new uuid for a resource if none exists
	EnsureID()

	// Name returns the name for this resource
	Name() string

	// GetKind returns the Kind of this resource
	GetKind() Kind

	// Description returns a description of the resource
	Description() string

	// Validate ensures that the resource is valid
	Validate() (warnings string, errors error)

	// ValidateWithStore ensures that the resource is valid and allows for extra validation given a store
	ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)
}

Resource is implemented by all resources, e.g. SourceType, DestinationType, Configuration, etc.

func NewEmptyResource

func NewEmptyResource(kind Kind) (Resource, error)

NewEmptyResource will return a zero value struct for the given resource kind.

func ParseResource

func ParseResource(r *AnyResource) (Resource, error)

ParseResource maps the Spec of the provided resource to a specific type of Resource

func ParseResources

func ParseResources(resources []*AnyResource) ([]Resource, error)

ParseResources TODO(doc)

type ResourceConfiguration

type ResourceConfiguration struct {
	Name              string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name"`
	ParameterizedSpec `yaml:",inline" json:",inline" mapstructure:",squash"`
}

ResourceConfiguration represents a source or destination configuration

type ResourceMeta

type ResourceMeta struct {
	APIVersion string   `yaml:"apiVersion,omitempty" json:"apiVersion"`
	Kind       Kind     `yaml:"kind,omitempty" json:"kind"`
	Metadata   Metadata `yaml:"metadata,omitempty" json:"metadata"`
}

ResourceMeta TODO(doc)

func (*ResourceMeta) Description

func (r *ResourceMeta) Description() string

Description returns the description.

func (*ResourceMeta) EnsureID

func (r *ResourceMeta) EnsureID()

EnsureID sets the ID to a random uuid if not already set.

func (*ResourceMeta) GetKind

func (r *ResourceMeta) GetKind() Kind

GetKind returns the Kind of this resource.

func (*ResourceMeta) GetLabels

func (r *ResourceMeta) GetLabels() Labels

GetLabels implements the Labeled interface for Agents

func (*ResourceMeta) ID

func (r *ResourceMeta) ID() string

ID returns the ID

func (*ResourceMeta) IndexFields

func (r *ResourceMeta) IndexFields(index search.Indexer)

IndexFields returns a map of field name to field value to be stored in the index

func (*ResourceMeta) IndexID

func (r *ResourceMeta) IndexID() string

IndexID returns an ID used to identify the resource that is indexed

func (*ResourceMeta) IndexLabels

func (r *ResourceMeta) IndexLabels(index search.Indexer)

IndexLabels returns a map of label name to label value to be stored in the index

func (*ResourceMeta) Name

func (r *ResourceMeta) Name() string

Name returns the name.

func (*ResourceMeta) PrintableFieldTitles

func (r *ResourceMeta) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*ResourceMeta) PrintableFieldValue

func (r *ResourceMeta) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*ResourceMeta) PrintableKindPlural

func (r *ResourceMeta) PrintableKindPlural() string

PrintableKindPlural returns the plural form of the Kind, e.g. "Configurations"

func (*ResourceMeta) PrintableKindSingular

func (r *ResourceMeta) PrintableKindSingular() string

PrintableKindSingular returns the singular form of the Kind, e.g. "Configuration"

func (*ResourceMeta) SetID

func (r *ResourceMeta) SetID(id string)

SetID replaces the uuid for this resource

func (*ResourceMeta) UniqueKey

func (r *ResourceMeta) UniqueKey() string

UniqueKey returns the resource Name to uniquely identify a resource

func (*ResourceMeta) Validate

func (r *ResourceMeta) Validate() (warnings string, errors error)

Validate checks that the resource is valid, returning an error if it is not. This provides generic validation for all resources. Specific resources should provide their own Validate method and call this to validate the ResourceMeta.

func (*ResourceMeta) ValidateWithStore

func (r *ResourceMeta) ValidateWithStore(_ context.Context, _ ResourceStore) (warnings string, errors error)

ValidateWithStore allows for additional validation when a store is available.

type ResourceStatus

type ResourceStatus struct {
	// Resource TODO(doc)
	Resource Resource `json:"resource" mapstructure:"resource"`
	// Status TODO(doc)
	Status UpdateStatus `json:"status" mapstructure:"status"`
	// Reason will be set if status is invalid or error
	Reason string `json:"reason" mapstructure:"reason"`
}

ResourceStatus contains a resource and its status after an update, which is of type UpdateStatus used in store and rest packages.

func NewResourceStatus

func NewResourceStatus(r Resource, s UpdateStatus) *ResourceStatus

NewResourceStatus TODO(doc)

func NewResourceStatusWithReason

func NewResourceStatusWithReason(r Resource, s UpdateStatus, reason string) *ResourceStatus

NewResourceStatusWithReason returns a status for an invalid resource

func (*ResourceStatus) String added in v0.5.2

func (s *ResourceStatus) String() string

type ResourceStore

type ResourceStore interface {
	Source(ctx context.Context, name string) (*Source, error)
	SourceType(ctx context.Context, name string) (*SourceType, error)
	Processor(ctx context.Context, name string) (*Processor, error)
	ProcessorType(ctx context.Context, name string) (*ProcessorType, error)
	Destination(ctx context.Context, name string) (*Destination, error)
	DestinationType(ctx context.Context, name string) (*DestinationType, error)
}

ResourceStore provides access to resources required to render configurations that use Sources and Destinations.

type ResourceType

type ResourceType struct {
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	Spec         ResourceTypeSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
}

ResourceType is a resource that describes a type of resource including parameters for creating that resource and a template for formatting the resource configuration.

There will be separate ResourceTypes for each type of resource, e.g. SourceType for Source resources.

func (*ResourceType) PrintableFieldTitles

func (rt *ResourceType) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*ResourceType) Validate

func (rt *ResourceType) Validate() (warnings string, errors error)

Validate returns an error if any part of the ResourceType is invalid

func (*ResourceType) ValidateWithStore

func (rt *ResourceType) ValidateWithStore(_ context.Context, _ ResourceStore) (warnings string, errors error)

ValidateWithStore returns an error if any part of the ResourceType is invalid

type ResourceTypeOutput

type ResourceTypeOutput struct {
	Receivers  ResourceTypeTemplate `json:"receivers,omitempty"  yaml:"receivers,omitempty"  mapstructure:"receivers"`
	Processors ResourceTypeTemplate `json:"processors,omitempty" yaml:"processors,omitempty" mapstructure:"processors"`
	Exporters  ResourceTypeTemplate `json:"exporters,omitempty"  yaml:"exporters,omitempty"  mapstructure:"exporters"`
	Extensions ResourceTypeTemplate `json:"extensions,omitempty" yaml:"extensions,omitempty" mapstructure:"extensions"`
}

ResourceTypeOutput describes the output of the resource type

func (ResourceTypeOutput) Empty

func (s ResourceTypeOutput) Empty() bool

Empty returns true if Receivers, Processors, Exporters, and Extensions are the zero value ""

type ResourceTypeSpec

type ResourceTypeSpec struct {
	Version string `json:"version,omitempty" yaml:"version,omitempty" mapstructure:"version"`

	// Parameters currently uses the model from stanza. Eventually we will probably create a separate definition for
	// BindPlane.
	Parameters         []ParameterDefinition `json:"parameters"  yaml:"parameters"  mapstructure:"parameters"`
	SupportedPlatforms []string              `json:"supportedPlatforms,omitempty" yaml:"supportedPlatforms,omitempty" mapstructure:"supportedPlatforms"`

	// individual
	Logs    ResourceTypeOutput `json:"logs,omitempty"    yaml:"logs,omitempty"    mapstructure:"logs"`
	Metrics ResourceTypeOutput `json:"metrics,omitempty" yaml:"metrics,omitempty" mapstructure:"metrics"`
	Traces  ResourceTypeOutput `json:"traces,omitempty"  yaml:"traces,omitempty"  mapstructure:"traces"`

	// pairs (alphabetical order)
	LogsMetrics   ResourceTypeOutput `json:"logs+metrics,omitempty"   yaml:"logs+metrics,omitempty"   mapstructure:"logs+metrics"`
	LogsTraces    ResourceTypeOutput `json:"logs+traces,omitempty"    yaml:"logs+traces,omitempty"    mapstructure:"logs+traces"`
	MetricsTraces ResourceTypeOutput `json:"metrics+traces,omitempty" yaml:"metrics+traces,omitempty" mapstructure:"metrics+traces"`

	// all three (alphabetical order)
	LogsMetricsTraces ResourceTypeOutput `json:"logs+metrics+traces,omitempty" yaml:"logs+metrics+traces,omitempty" mapstructure:"logs+metrics+traces"`
}

ResourceTypeSpec is the spec for a resourceType to

func (*ResourceTypeSpec) ParameterDefinition

func (s *ResourceTypeSpec) ParameterDefinition(name string) *ParameterDefinition

ParameterDefinition returns the ParameterDefinition with the specified name or nil if no such parameter exists

func (*ResourceTypeSpec) TelemetryTypes

func (s *ResourceTypeSpec) TelemetryTypes() []otel.PipelineType

TelemetryTypes returns the supported telemetry types (logs, metrics, or traces). Only applicable to SourceTypes.

type ResourceTypeTemplate

type ResourceTypeTemplate string

ResourceTypeTemplate is a go-template that evaluates to an array of OpenTelemetry resources

type Selector

type Selector struct {
	labels.Selector
}

Selector TODO(docs)

func EmptySelector

func EmptySelector() Selector

EmptySelector returns a Selector that has no labels and matches nothing

func EverythingSelector

func EverythingSelector() Selector

EverythingSelector returns a Selector that matches everything

func SelectorFromMap

func SelectorFromMap(m map[string]string) (Selector, error)

SelectorFromMap takes a map[string]string and returns a Selector and error.

func SelectorFromString

func SelectorFromString(selector string) (Selector, error)

SelectorFromString takes a string and returns a Selector and error

func (*Selector) MatchLabels

func (s *Selector) MatchLabels() (labels MatchLabels, complete bool)

MatchLabels returns the portion of the Selector that consists of simple name=value label matches. A Selector supports more complex selection and this should only be used in cases where Matches() would have terrible performance and partial selection is ok. This will return false for complete if there are selectors requirements that cannot be expressed with match labels.

type Source

type Source struct {
	// ResourceMeta TODO(doc)
	ResourceMeta `yaml:",inline" json:",inline" mapstructure:",squash"`
	// Spec TODO(doc)
	Spec ParameterizedSpec `json:"spec" yaml:"spec" mapstructure:"spec"`
}

Source will generate an exporter and be at the end of a pipeline

func FindSource

func FindSource(ctx context.Context, source *ResourceConfiguration, defaultName string, store ResourceStore) (*Source, error)

FindSource returns a Source from the store if it exists. If it doesn't exist, it creates a new Source with the specified defaultName.

func NewSource

func NewSource(name string, sourceTypeName string, parameters []Parameter) *Source

NewSource creates a new Source with the specified name, type, and parameters

func NewSourceWithSpec

func NewSourceWithSpec(name string, spec ParameterizedSpec) *Source

NewSourceWithSpec creates a new Source with the specified spec

func (*Source) ComponentID

func (s *Source) ComponentID(name string) otel.ComponentID

ComponentID provides a unique component id for the specified component name

func (*Source) GetKind

func (s *Source) GetKind() Kind

GetKind returns "Source"

func (*Source) PrintableFieldTitles

func (s *Source) PrintableFieldTitles() []string

PrintableFieldTitles returns the list of field titles, used for printing a table of resources

func (*Source) PrintableFieldValue

func (s *Source) PrintableFieldValue(title string) string

PrintableFieldValue returns the field value for a title, used for printing a table of resources

func (*Source) ResourceParameters

func (s *Source) ResourceParameters() []Parameter

ResourceParameters are the parameters passed to the ResourceType to generate the configuration

func (*Source) ResourceTypeName

func (s *Source) ResourceTypeName() string

ResourceTypeName is the name of the ResourceType that renders this resource type

func (*Source) ValidateWithStore

func (s *Source) ValidateWithStore(ctx context.Context, store ResourceStore) (warnings string, errors error)

ValidateWithStore checks that the source is valid, returning an error if it is not. It uses the store to retrieve the source type so that parameter values can be validated against the parameter definitions.

type SourceResponse

type SourceResponse struct {
	Source *Source `json:"source"`
}

SourceResponse is the REST API response to GET /v1/sources/:name

type SourceType

type SourceType struct {
	ResourceType `yaml:",inline" json:",inline" mapstructure:",squash"`
}

SourceType is a ResourceType used to define sources

func NewSourceType

func NewSourceType(name string, parameters []ParameterDefinition) *SourceType

NewSourceType creates a new source-type with the specified name,

func NewSourceTypeWithSpec

func NewSourceTypeWithSpec(name string, spec ResourceTypeSpec) *SourceType

NewSourceTypeWithSpec creates a new source-type with the specified name and spec.

func (*SourceType) GetKind

func (s *SourceType) GetKind() Kind

GetKind returns "SourceType"

type SourceTypeResponse

type SourceTypeResponse struct {
	SourceType *SourceType `json:"sourceType"`
}

SourceTypeResponse is the REST API response to GET /v1/sourceType/:name

type SourceTypesResponse

type SourceTypesResponse struct {
	SourceTypes []*SourceType `json:"sourceTypes"`
}

SourceTypesResponse is the REST API response to GET /v1/sourceTypes

type SourcesResponse

type SourcesResponse struct {
	Sources []*Source `json:"sources"`
}

SourcesResponse is the REST API response to GET /v1/sources

type TemplateErrorHandler

type TemplateErrorHandler func(error)

TemplateErrorHandler handles errors during template evaluation. Typically these will be logged but they could be accumulated and reported to the user.

type UpdateStatus

type UpdateStatus string

UpdateStatus is part of ResourceStatus that indicates the result of ApplyResources and DeleteResources on the Store.

const (
	// StatusUnchanged indicates that there were no changes to a modified resource because the existing resource is the same
	StatusUnchanged UpdateStatus = "unchanged"

	// StatusConfigured indicates that changes were applied to an existing resource
	StatusConfigured UpdateStatus = "configured"

	// StatusCreated indicates that a new resource was created
	StatusCreated UpdateStatus = "created"

	// StatusDeleted indicates that a resource was deleted, either from the store or the current filtered view of resources
	StatusDeleted UpdateStatus = "deleted"

	// StatusInvalid represents an attempt to add or update a resource with an invalid resource
	StatusInvalid UpdateStatus = "invalid"

	// StatusError is used when an individual resource cannot be applied because of an error
	StatusError UpdateStatus = "error"

	// StatusInUse is used when attempting to delete a resource that is being referenced by another
	StatusInUse UpdateStatus = "in-use"
)

Directories

Path Synopsis
Package graph provides the Graph type, which is used to display topology in the UI
Package graph provides the Graph type, which is used to display topology in the UI
Package observiq provides models and functions for interacting with managed observIQ OTel agents.
Package observiq provides models and functions for interacting with managed observIQ OTel agents.
Package otel provides functions for working with OTel pipelines
Package otel provides functions for working with OTel pipelines
Package validation contains functions for validating constraints are met for given strings
Package validation contains functions for validating constraints are met for given strings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL