otelcol-lsp

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0

README

otelcol-lsp

Release GoDoc CI License

A WIP Implementation of an LSP for OpenTelemetry Collector configurations.

⚠ This is currently not designed for standalone IDE usage. This package is meant to be used as an LSP API to be embedded in other applications.

Supports:

  • Validates yaml format
  • Validates top-level OpenTelemetry Collector structure:
    • Can only specify receivers, connectors, processors, extensions, exporters and service as top-level keys
    • Validates component and pipeline ID syntax (type / type/name)
    • Validates that components referenced in service pipelines are defined in their component sections
    • Validates that component types are valid for their kind, and that connectors are referenced as exporter/receiver on valid signals
    • Validates that pipelines have the minimum required references
  • Distribution-aware validation:
    • Detects the target collector distribution and version
    • Validates configs against real OpenTelemetry Collector binaries and their per-distribution component metadata

Planned:

  • Hover and complete functionality for top level components
  • Per-component static validation against a YAML schema
  • Per-component hover and complete functionality
  • Validating extension ID where applicable. E.g. a processor that requires a storage extension type/ID must have that type/id defined.
  • OTTL LSP
  • Validating yaml of specific components, e.g. a standalone receiver definition, by adding support for components using document URIs, e.g. receiver://<...>

Not planned, but would be nice to have:

  • Support formats other than YAML
  • Publishing LSP as IDE extensions, vscode, jetbrains, etc...

Distribution aware validation

Clients connecting to this LSP should specify distribution=<otel-distro> and version=<otel-distro-version> in the Document URI.

Relies on a filesystem structure that looks like <base-path>/<distribution>/<version>/otelcol.

For the lsp you can specify the base path at with the flag --cache <base-path>. Defaults to var/lib/cache/otelconf.

For example:

├── otelcol
│   ├── 0.156.0
│   │   └── otelcol
│   └── 0.157.0
│       └── otelcol
├── otelcol-contrib
│   ├── 0.156.0
│   │   └── otelcol
│   └── 0.157.0
│       └── otelcol
├── otelcol-ebpf-profiler
│   ├── 0.156.0
│   │   └── otelcol
│   └── 0.157.0
│       └── otelcol
├── otelcol-k8s
│   ├── 0.156.0
│   │   └── otelcol
│   └── 0.157.0
│       └── otelcol
└── otelcol-otlp
    ├── 0.156.0
    │   └── otelcol
    └── 0.157.0
        └── otelcol

bindistgen is available to generate these paths based on a config file. See examples

Special thanks

Directories

Path Synopsis
cmd
bindistgen command
otelcol-lsp command
pkg
docstore
Package docstore tracks the text and version of documents an LSP client currently has open, keyed by URI.
Package docstore tracks the text and version of documents an LSP client currently has open, keyed by URI.
lsp
Package lsp implements the language server itself.
Package lsp implements the language server itself.
lsperrors
Package lsperrors defines stable diagnostic codes for otelcol-lsp.
Package lsperrors defines stable diagnostic codes for otelcol-lsp.
lspws
Package lspws serves the language server over WebSocket: each connection gets its own LSP session, and each WebSocket text frame carries exactly one JSON-RPC message (the framing used by browser LSP clients).
Package lspws serves the language server over WebSocket: each connection gets its own LSP session, and each WebSocket text frame carries exactly one JSON-RPC message (the framing used by browser LSP clients).
otelcfg
Package otelcfg validates the OpenTelemetry Collector-specific structure of a YAML configuration document: component and pipeline ID syntax, and cross-references between the component sections and the service section.
Package otelcfg validates the OpenTelemetry Collector-specific structure of a YAML configuration document: component and pipeline ID syntax, and cross-references between the component sections and the service section.
otelcfg/distro
Package distro identifies the OpenTelemetry Collector distribution a configuration document targets.
Package distro identifies the OpenTelemetry Collector distribution a configuration document targets.
otelcfg/lspbridge
Package lspbridge adapts the distribution-aware validators (metadist, bindist) to the contracts the LSP server consumes, keeping those packages decoupled.
Package lspbridge adapts the distribution-aware validators (metadist, bindist) to the contracts the LSP server consumes, keeping those packages decoupled.
yamlast
Package yamlast wraps github.com/goccy/go-yaml with an editor-oriented API.
Package yamlast wraps github.com/goccy/go-yaml with an editor-oriented API.
yamlschema
Package yamlschema validates YAML documents against JSON Schemas that are themselves written in YAML (defaulting to draft-4, as used by the asdf yaml-schema convention).
Package yamlschema validates YAML documents against JSON Schemas that are themselves written in YAML (defaulting to draft-4, as used by the asdf yaml-schema convention).

Jump to

Keyboard shortcuts

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