OpenTelemetry Weaver Documentation

repository·main·Indexed 19 days ago

https://github.com/open-telemetry/weaver

A toolset for 'Observability by Design' that manages semantic convention registries and telemetry schema workflows. It includes a Policy Engine using Rego to automate the verification of telemetry signals (metrics, traces, logs), ensuring integrity and quality through declarative rules. The tool provides a CLI for registry checks, a hierarchical configuration system via .weaver.toml, and utilities for validating code generation.

Tokens
135.4K
Snippets
346
Records
503
Agent score
62%

What's inside OpenTelemetry Weaver

  1. Overview of Weaver tools and capabilities

    main

    Weaver is a toolset for working with schematized telemetry. Its core capabilities are divided into registry management, code generation, and real-time telemetry validation:

    Registry Management

    • Validation: Lint syntax, semantics, and custom rules for your schema.
    • Resolving: Consolidate a registry and its dependencies into a single artifact.
    • Comparing: Compute differences between two versions of a registry.

    Code Generation

    • Produce non-code artifacts (like Markdown documentation) or code (like Go code) from your schema using templates.

    Real-time Telemetry

    • Live-checking: Validate emitted OTLP telemetry against a schema in real-time.
    • Emitting: Generate example telemetry signals based on a schema to test your receivers.
  2. What is Weaver Forge?

    main

    Weaver Forge is a Jinja-based documentation and code generation engine used by OTEL Weaver. It transforms a resolved semantic convention registry into various artifacts (e.g., Go, HTML, Markdown, or Rust code/docs).

    Key features include:

    • Jinja2 Compatibility: Uses MiniJinja for template logic.
    • JQ Integration: Allows preprocessing resolved registries using JQ filters to transform, group, or sort data before it reaches the templates. This keeps template logic simple by moving complex data manipulation to the JQ layer.
    • Custom Extensions: Includes specialized Jinja filters, functions, and tests specifically designed for semantic conventions.
  3. What is Weaver Live Check?

    main

    Weaver Live Check is a developer tool designed to assess sample telemetry and provide findings for improvement. It works by loading a Semantic Convention Registry and comparing it against incoming samples.

    Core Workflow:

    1. Ingesters: Transform input sources (Files, stdin, or OTLP) into intermediary representations.
    2. Advisors: Assess the data. This includes Built-in advisors (e.g., checking for missing_attribute or type_mismatch) and External advisors defined via Rego policies (e.g., OpenTelemetry Semantic Convention rules).
    3. Output: Findings (PolicyFinding) are transformed via Jinja templates into the desired output format.
  4. Overview of the Weaver Policy Engine

    main

    The Weaver Policy Engine automates the verification of semantic conventions and telemetry schemas to ensure long-term integrity, coherence, and quality. It uses declarative rules to prevent common issues such as:

    • Using attributes marked as deprecated without setting the stability field to deprecated.
    • High cardinality attributes.
    • Using optional attributes where required.
    • Unauthorized name changes or attribute removals from released groups.
    • Missing owners or contacts fields.

    Policies are decoupled from the engine and can be managed in separate repositories, allowing for both OpenTelemetry-standard and company-specific enforcement.

  5. Overview of OpenTelemetry Collector Proto packages

    main

    The OpenTelemetry Collector Proto package defines the protocol used by the OpenTelemetry collector. It is organized into several specialized packages based on the type of telemetry data being handled:

    • common: Contains messages shared across different services.
    • trace: Contains the Trace Service protocol definitions.
    • metrics: Contains the Metrics Service protocol definitions.
    • logs: Contains the Logs Service protocol definitions.
  6. Overview of the Weaver diff library

    main
    The weaver_diff crate is a minimal library designed to provide diffing capabilities with colored output. Its primary purpose is to abstract and hide the specific implementation details of diffing and dependency selection from other parts of the Weaver project, providing a clean interface for comparing changes.
  7. Use the `weaver` CLI to manage semantic conventions

    main

    The weaver command-line tool is used to manage the Semantic Convention Registry and telemetry schema workflows for the OpenTelemetry Project. It provides subcommands for registry management, diagnostics, and serving an API.

    Main Subcommands:

    • registry: Manage the Semantic Convention Registry (check, generate, diff, etc.).
    • diagnostic: Manage diagnostic messages.
    • completion: Generate shell completions.
    • serve: Start the API server (Experimental).

    Global Options:

    • --debug: Enable debugging. Use --debug --debug for trace-level logs.
    • --quiet: Enable minimal output mode.
    • --future: Enable the most recent validation rules for the semconv registry. Recommended when checking a new registry.
    • --allow-git-credentials: Allows git credential helpers (e.g., osxkeychain) to be used when cloning private registries. By default, git operations are isolated.
    • --config <CONFIG>: Path to a .weaver.toml project config file. Setting this skips the upward-walk discovery.
    weaver [OPTIONS] <COMMAND>
  8. Use the weaver_semconv data model for semantic convention registry files

    main

    The weaver_semconv crate provides the data model for the OpenTelemetry semantic convention registry. It is designed to handle the serialization and deserialization of YAML files that follow the semantic convention registry format.

    Because it uses serde annotations, you can easily read from or write to various formats supported by the Serde ecosystem, including YAML and JSON.

    For detailed information on the syntax and semantics used by this data model, refer to the semantic convention Definition language or the JSON schema.

  9. Use weaver_search for querying semantic convention registries

    main

    The weaver_search crate provides search capabilities for OpenTelemetry semantic convention registries. It uses a SearchContext engine to query resolved registries.

    Key features include:

    • Fuzzy text matching: Find conventions even with slight typos or partial names.
    • Type filtering: Narrow results by specific OpenTelemetry types such as attributes, metrics, spans, events, or entities.
    • Stability filtering: Filter by the stability level of the convention.
    • Relevance scoring: Results are ranked based on how well they match the query.
    • Pagination: Handle large result sets through paginated queries.