Debian Codegraph @

confmap/confmap.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 //go:generate mdatagen metadata.yaml
5
6 package confmap // import "go.opentelemetry.io/collector/confmap"
7
8 import (
9 "go.opentelemetry.io/collector/confmap/internal"
10 )
11
12 // KeyDelimiter is used as the default key delimiter in the default koanf instance.
13 var KeyDelimiter = internal.KeyDelimiter
14
15 // MapstructureTag is the struct field tag used to record marshaling/unmarshaling settings.
16 // See https://pkg.go.dev/github.com/go-viper/mapstructure/v2 for supported values.
17 var MapstructureTag = internal.MapstructureTag
18
19 // New creates a new empty confmap.Conf instance.
20 func New() *Conf {
21 return internal.New()
22 }
23
24 // NewFromStringMap creates a confmap.Conf from a map[string]any.
25 func NewFromStringMap(data map[string]any) *Conf {
26 return internal.NewFromStringMap(data)
27 }
28
29 // Conf represents the raw configuration map for the OpenTelemetry Collector.
30 // The confmap.Conf can be unmarshalled into the Collector's config using the "service" package.
31 type Conf = internal.Conf
32
33 type UnmarshalOption = internal.UnmarshalOption
34
35 // WithIgnoreUnused sets an option to ignore errors if existing
36 // keys in the original Conf were unused in the decoding process
37 // (extra keys).
38 func WithIgnoreUnused() UnmarshalOption {
39 return internal.WithIgnoreUnused()
40 }
41
42 type MarshalOption = internal.MarshalOption
43
44 // Unmarshaler interface may be implemented by types to customize their behavior when being unmarshaled from a Conf.
45 // Only types with struct or pointer to struct kind are supported.
46 type Unmarshaler = internal.Unmarshaler
47
48 // Marshaler defines an optional interface for custom configuration marshaling.
49 // A configuration struct can implement this interface to override the default
50 // marshaling.
51 type Marshaler = internal.Marshaler