Documentation ¶
Index ¶
Constants ¶
const DefaultModule = "go.opentelemetry.io/collector"
DefaultModule is the module prefix of otelcol. Can be used to create a DirResolver.
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 config.Type // an instance of the component's configuration struct CfgInstance interface{} }
CfgInfo contains a component config instance, as well as its group name and type.
func GetAllCfgInfos ¶
GetAllCfgInfos accepts a Factories struct, then creates and returns a CfgInfo for each of its components.
type DirResolver ¶
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) PackageDir ¶
func (dr DirResolver) PackageDir(t reflect.Type) string
PackageDir accepts a Type and returns its package dir.
type Field ¶
type Field struct { Name string `yaml:",omitempty"` Type string `yaml:",omitempty"` Kind string `yaml:",omitempty"` Default interface{} `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
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.