otelcol

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ServerPrompt = `` /* 371-byte string literal not displayed */

ServerPrompt provides instructions for LLMs using the OpenTelemetry Collector toolset.

View Source
const ToolsetName = "observability/otelcol"

Variables

This section is empty.

Functions

func GetComponentSchemaHandler

func GetComponentSchemaHandler(params api.ToolHandlerParams) (*api.ToolCallResult, error)

func GetVersionsHandler

func GetVersionsHandler(params api.ToolHandlerParams) (*api.ToolCallResult, error)

func ListComponentsHandler

func ListComponentsHandler(params api.ToolHandlerParams) (*api.ToolCallResult, error)

func ValidateConfigHandler

func ValidateConfigHandler(params api.ToolHandlerParams) (*api.ToolCallResult, error)

Types

type ComponentType

type ComponentType string

ComponentType represents the type of OpenTelemetry component.

const (
	ComponentTypeReceiver  ComponentType = "receiver"
	ComponentTypeProcessor ComponentType = "processor"
	ComponentTypeExporter  ComponentType = "exporter"
	ComponentTypeExtension ComponentType = "extension"
	ComponentTypeConnector ComponentType = "connector"
)

func ValidComponentTypes

func ValidComponentTypes() []ComponentType

ValidComponentTypes returns all valid component types.

func (ComponentType) IsValid

func (ct ComponentType) IsValid() bool

IsValid checks if the component type is valid.

type Config

type Config struct {
	// SchemaFS is an embedded filesystem containing component schemas.
	// Expected structure: schemas/0.143.0/receivers/..., schemas/0.144.0/...
	SchemaFS fs.FS
}

Config holds OpenTelemetry Collector toolset configuration.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns the default otelcol configuration using the embedded schemas from redhat-opentelemetry-collector.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that the configuration values are valid.

type GetComponentSchemaInput

type GetComponentSchemaInput struct {
	ComponentType ComponentType `json:"component_type"`
	ComponentName string        `json:"component_name"`
	Version       string        `json:"version,omitempty"`
}

GetComponentSchemaInput defines the input parameters for GetComponentSchemaHandler.

type GetComponentSchemaOutput

type GetComponentSchemaOutput struct {
	Name    string         `json:"name" jsonschema:"The component name"`
	Type    string         `json:"type" jsonschema:"The component type (receiver, processor, exporter, extension, connector)"`
	Version string         `json:"version" jsonschema:"The OpenTelemetry Collector version"`
	Schema  map[string]any `json:"schema" jsonschema:"The JSON schema for the component configuration"`
}

GetComponentSchemaOutput defines the output schema for the otelcol_get_component_schema tool.

type GetVersionsInput

type GetVersionsInput struct{}

GetVersionsInput defines the input parameters for GetVersionsHandler.

type GetVersionsOutput

type GetVersionsOutput struct {
	Versions      []string `json:"versions" jsonschema:"List of available OpenTelemetry Collector versions"`
	LatestVersion string   `json:"latest_version" jsonschema:"The latest available version"`
}

GetVersionsOutput defines the output schema for the otelcol_get_versions tool.

type ListComponentsInput

type ListComponentsInput struct {
	Version string `json:"version,omitempty"`
}

ListComponentsInput defines the input parameters for ListComponentsHandler.

type ListComponentsOutput

type ListComponentsOutput struct {
	Version    string              `json:"version" jsonschema:"The OpenTelemetry Collector version"`
	Receivers  []string            `json:"receivers" jsonschema:"List of available receiver component names"`
	Processors []string            `json:"processors" jsonschema:"List of available processor component names"`
	Exporters  []string            `json:"exporters" jsonschema:"List of available exporter component names"`
	Extensions []string            `json:"extensions" jsonschema:"List of available extension component names"`
	Connectors []string            `json:"connectors" jsonschema:"List of available connector component names"`
	Components map[string][]string `json:"components" jsonschema:"Map of component type to component names"`
}

ListComponentsOutput defines the output schema for the otelcol_list_components tool.

type SchemaLoader

type SchemaLoader interface {
	GetComponentSchema(componentType schemagen.ComponentType, componentName string, version string) (*schemagen.ComponentSchema, error)
	GetComponentSchemaJSON(componentType schemagen.ComponentType, componentName string, version string) ([]byte, error)
	ListAvailableComponents(version string) (map[schemagen.ComponentType][]string, error)
	ValidateComponentYAML(componentType schemagen.ComponentType, componentName string, version string, yamlData []byte) (*ValidationResult, error)
	ValidateComponentJSON(componentType schemagen.ComponentType, componentName string, version string, jsonData []byte) (*ValidationResult, error)
	GetLatestVersion() (string, error)
	GetAllVersions() ([]string, error)
}

SchemaLoader defines the interface for loading OpenTelemetry Collector schemas.

func NewSchemaLoaderFromFS

func NewSchemaLoaderFromFS(filesystem fs.FS, basePath string) SchemaLoader

NewSchemaLoaderFromFS creates a new SchemaLoader using schemas from the provided filesystem. This allows using an embed.FS or any other fs.FS implementation. The basePath should be the path within the filesystem where version subdirectories are located.

type Toolset

type Toolset struct{}

Toolset implements the OpenTelemetry Collector toolset.

func (*Toolset) GetDescription

func (t *Toolset) GetDescription() string

GetDescription returns a human-readable description of the toolset.

func (*Toolset) GetName

func (t *Toolset) GetName() string

GetName returns the name of the toolset.

func (*Toolset) GetPrompts

func (t *Toolset) GetPrompts() []api.ServerPrompt

GetPrompts returns prompts provided by this toolset.

func (*Toolset) GetResourceTemplates

func (t *Toolset) GetResourceTemplates() []api.ServerResourceTemplate

GetResourceTemplates returns resource templates provided by this toolset.

func (*Toolset) GetResources

func (t *Toolset) GetResources() []api.ServerResource

GetResources returns resources provided by this toolset.

func (*Toolset) GetTools

func (t *Toolset) GetTools(p api.FilteringProvider) []api.ServerTool

GetTools returns all tools provided by this toolset.

type ValidateConfigInput

type ValidateConfigInput struct {
	ComponentType ComponentType `json:"component_type"`
	ComponentName string        `json:"component_name"`
	Config        string        `json:"config"`
	Format        string        `json:"format,omitempty"`
	Version       string        `json:"version,omitempty"`
}

ValidateConfigInput defines the input parameters for ValidateConfigHandler.

type ValidateConfigOutput

type ValidateConfigOutput struct {
	Valid   bool              `json:"valid" jsonschema:"Whether the configuration is valid"`
	Errors  []ValidationError `json:"errors,omitempty" jsonschema:"List of validation errors if invalid"`
	Version string            `json:"version" jsonschema:"The OpenTelemetry Collector version used for validation"`
}

ValidateConfigOutput defines the output schema for the otelcol_validate_config tool.

type ValidationError

type ValidationError struct {
	Field       string `json:"field" jsonschema:"The field path that has the error"`
	Description string `json:"description" jsonschema:"Description of the validation error"`
	Type        string `json:"type,omitempty" jsonschema:"The error type"`
}

ValidationError represents a single validation error.

type ValidationResult

type ValidationResult struct {
	Valid  bool
	Errors []ValidationError
}

ValidationResult wraps the validation result from JSON schema validation.

Jump to

Keyboard shortcuts

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