registry

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package registry reads ynf's telemetry registry (telemetry/registry), an OpenTelemetry Weaver registry, and writes the Go constants generated from it. Weaver is not needed to build ynf: this reads the subset of its format ynf's registry uses, and CI checks the registry itself with Weaver's own `registry check`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(r *Registry, pkg string) ([]byte, error)

Generate writes the Go constants for a registry: one for every attribute, span, event and metric name, and one for every value of an enumerated attribute. Code uses these and never a string literal, so a name that is not in the registry does not compile.

Types

type Attribute

type Attribute struct {
	ID          string         `json:"id"`
	Type        string         `json:"type"`
	Members     []Member       `json:"members,omitempty"`
	Brief       string         `json:"brief"`
	Stability   string         `json:"stability"`
	Examples    []any          `json:"examples,omitempty"`
	Annotations map[string]any `json:"annotations,omitempty"`
}

Attribute is an attribute ynf defines.

type Event

type Event struct {
	Name       string `json:"name"`
	Brief      string `json:"brief"`
	Attributes []Use  `json:"attributes"`
}

Event is a kind of event: a log record with an event name.

type Member

type Member struct {
	ID    string `json:"id"`
	Value string `json:"value"`
	Brief string `json:"brief"`
}

Member is one value of an enumerated attribute.

type Metric

type Metric struct {
	Name       string `json:"name"`
	Instrument string `json:"instrument"`
	Unit       string `json:"unit"`
	Brief      string `json:"brief"`
	Attributes []Use  `json:"attributes"`
}

Metric is a metric ynf records.

type Registry

type Registry struct {
	Tool    string `json:"tool"`
	Version string `json:"version"`
	// Semconv is the upstream semantic-conventions release the registry is pinned to.
	Semconv Semconv `json:"semantic_conventions"`
	// Attributes are the attributes ynf defines, under its own prefix.
	Attributes []Attribute `json:"attributes"`
	// Standard are the OpenTelemetry attributes ynf uses by name, defined upstream.
	Standard []string `json:"standard_attributes"`
	Spans    []Span   `json:"spans"`
	Events   []Event  `json:"events"`
	Metrics  []Metric `json:"metrics"`
}

Registry is a tool's telemetry names, as `ynf telemetry registry --format json` prints them.

func Load

func Load(fsys fs.FS, version string) (*Registry, error)

Load reads the registry in fsys: manifest.yaml and every other .yaml file, each a list of groups. version is the tool's version, which with its name identifies the registry.

type Semconv

type Semconv struct {
	Name      string `json:"name"`
	Version   string `json:"version"`
	SchemaURL string `json:"schema_url"`
}

Semconv names the upstream conventions a registry follows.

type Span

type Span struct {
	Name       string `json:"name"`
	Kind       string `json:"kind"`
	Brief      string `json:"brief"`
	Attributes []Use  `json:"attributes"`
}

Span is a kind of span.

type Use

type Use struct {
	Name             string `json:"name"`
	RequirementLevel string `json:"requirement_level"`
	// Cardinality is the most distinct values the attribute may take on a metric (the
	// ynr.cardinality annotation), where the registry declares one.
	Cardinality int `json:"cardinality,omitempty"`
}

Use is an attribute a signal carries.

Jump to

Keyboard shortcuts

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