configschema

package module
v0.102.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

Deprecated: [v0.92.0] This tool is deprecated and will be removed in a future release. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/30187

ConfigSchema API

This package contains an API that can be used to introspect the configuration struct of a collector component. It can be used to generate documentation or tools to help users configure the collector.

Documentation

Overview

Deprecated: [v0.92.0] This package is deprecated and will be removed in a future release. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/30187

Index

Constants

View Source
const DefaultModule = "github.com/open-telemetry/opentelemetry-collector-contrib"

DefaultModule is the module prefix of contrib. Can be used to create a DirResolver.

View Source
const DefaultSrcRoot = "."

DefaultSrcRoot is the default root of the collector repo, relative to the current working directory. Can be used to create a DirResolver.

Variables

This section is empty.

Functions

This section is empty.

Types

type CfgInfo

type CfgInfo struct {
	// the name of the component group, e.g. "receiver"
	Group string
	// the component type, e.g. "otlpreceiver.Config"
	Type component.Type
	// an instance of the component's configuration struct
	CfgInstance any
}

CfgInfo contains a component config instance, as well as its group name and type.

func GetAllCfgInfos

func GetAllCfgInfos(components otelcol.Factories) []CfgInfo

GetAllCfgInfos accepts a Factories struct, then creates and returns a CfgInfo for each of its components.

func GetCfgInfo

func GetCfgInfo(components otelcol.Factories, componentType, componentName string) (CfgInfo, error)

GetCfgInfo accepts a Factories struct, then creates and returns the default config for the component specified by the passed-in componentType and componentName.

type DirResolver

type DirResolver struct {
	SrcRoot    string
	ModuleName string
}

DirResolver is used to resolve the base directory of a given reflect.Type.

func NewDefaultDirResolver

func NewDefaultDirResolver() DirResolver

NewDefaultDirResolver creates a DirResolver with a default SrcRoot and ModuleName, suitable for using this package's API using otelcol with an executable running from the otelcol's source root (not tests).

func NewDirResolver

func NewDirResolver(srcRoot string, moduleName string) DirResolver

NewDirResolver creates a DirResolver with a custom SrcRoot and ModuleName. Useful for testing and for using this package's API from a repository other than otelcol (e.g. contrib).

func (DirResolver) ReflectValueToProjectPath added in v0.67.0

func (dr DirResolver) ReflectValueToProjectPath(v reflect.Value) string

ReflectValueToProjectPath accepts a reflect.Value and returns its directory in the current project. If the type doesn't live in the current project, returns "".

func (DirResolver) TypeToPackagePath added in v0.59.0

func (dr DirResolver) TypeToPackagePath(t reflect.Type) (string, error)

TypeToPackagePath accepts a Type and returns the filesystem path. If the path does not exist in the current project, returns location in GOPATH.

type DirResolverIntf added in v0.67.0

type DirResolverIntf interface {
	TypeToPackagePath(t reflect.Type) (string, error)
	ReflectValueToProjectPath(v reflect.Value) string
}

type Field

type Field struct {
	Name    string   `yaml:",omitempty"`
	Type    string   `yaml:",omitempty"`
	Kind    string   `yaml:",omitempty"`
	Default any      `yaml:",omitempty"`
	Doc     string   `yaml:",omitempty"`
	Fields  []*Field `yaml:",omitempty"`
}

Field holds attributes and subfields of a config struct.

func ReadFields

func ReadFields(v reflect.Value, dr DirResolver) (*Field, error)

ReadFields accepts both a config struct's Value, as well as a DirResolver, and returns a Field pointer for the top level struct as well as all of its recursive subfields.

Directories

Path Synopsis
Deprecated: [v0.92.0] This package is deprecated and will be removed in a future release.
Deprecated: [v0.92.0] This package is deprecated and will be removed in a future release.
Deprecated: [v0.92.0] This package is deprecated and will be removed in a future release.
Deprecated: [v0.92.0] This package is deprecated and will be removed in a future release.

Jump to

Keyboard shortcuts

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