Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoctorCommand ¶
DoctorCommand returns the CLI command definition for the 'doctor' subcommand. This command runs diagnostic checks to verify otlp-mcp is properly configured.
func FindProjectConfig ¶
FindProjectConfig searches for a .otlp-mcp.json config file. It starts in the current directory and walks up looking for the file, stopping when it finds a .git directory (project root) or reaches root.
func GlobalConfigPath ¶
func GlobalConfigPath() string
GlobalConfigPath returns the path to the global config file. This is ~/.config/otlp-mcp/config.json
func ParseOtelConfig ¶
ParseOtelConfig reads an OpenTelemetry Collector config file and extracts base directories from file exporter paths. It looks for exporters with names starting with "file/" and returns the base directory (parent of signal directories).
For example, if the config has:
file/traces: path: /tank/otel/traces/traces.jsonl
This returns ["/tank/otel"] because FileSource expects the base directory and internally looks for traces/, logs/, metrics/ subdirectories.
func ServeCommand ¶
ServeCommand returns the CLI command definition for the 'serve' subcommand. This command starts both the OTLP gRPC receiver and the MCP stdio server.
Types ¶
type Config ¶
type Config struct {
// Comment field for user documentation (ignored by the application)
Comment string `json:"comment,omitempty"`
// Buffer sizes for different signal types (direct JSON mapping to CLI flags)
TraceBufferSize int `json:"trace_buffer_size,omitempty"`
LogBufferSize int `json:"log_buffer_size,omitempty"`
MetricBufferSize int `json:"metric_buffer_size,omitempty"`
// OTLP server configuration
OTLPHost string `json:"otlp_host,omitempty"`
OTLPPort int `json:"otlp_port,omitempty"`
// MCP transport configuration
Transport string `json:"transport,omitempty"` // "stdio" (default) or "http"
HTTPHost string `json:"http_host,omitempty"` // HTTP server bind address
HTTPPort int `json:"http_port,omitempty"` // HTTP server port
AllowedOrigins []string `json:"allowed_origins,omitempty"` // Allowed Origin headers for CORS
SessionTimeout string `json:"session_timeout,omitempty"` // Session idle timeout (e.g., "30m")
Stateless bool `json:"stateless,omitempty"` // Run HTTP transport in stateless mode
// Logging configuration
Verbose bool `json:"verbose,omitempty"`
}
Config holds the runtime configuration for the OTLP MCP server. It can be populated from CLI flags, config files, or both.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with sensible default values. These defaults match the MVP requirements: - 10,000 spans for traces - 50,000 log records (future) - 100,000 metric points (future) - Localhost binding on ephemeral port - stdio transport (or http on port 4380)
func LoadConfigFromFile ¶
LoadConfigFromFile loads configuration from a JSON file at the given path. It returns an error if the file cannot be read or parsed.
func LoadEffectiveConfig ¶
LoadEffectiveConfig loads the effective configuration by merging: 1. Built-in defaults 2. Global config file (if exists) 3. Project config file (if exists) 4. Explicit config file (if specified via configPath) Later sources override earlier ones.
func MergeConfigs ¶
MergeConfigs merges two configs with the overlay taking precedence. Fields in overlay override corresponding fields in base. Returns a new Config with the merged values.
type FileExporter ¶
type FileExporter struct {
Path string `yaml:"path"`
}
FileExporter represents a file exporter configuration.
type OtelCollectorConfig ¶
type OtelCollectorConfig struct {
Exporters map[string]FileExporter `yaml:"exporters"`
}
OtelCollectorConfig represents the relevant parts of an OpenTelemetry Collector config. We only parse the exporters section to find file exporters.