-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathconfig.go
51 lines (40 loc) · 2.04 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package consul // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/consul"
import (
"go.opentelemetry.io/collector/config/configopaque"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor/internal/consul/internal/metadata"
)
// The struct requires no user-specified fields by default as consul agent's default
// configuration will be provided to the API client.
// See `consul.go#NewDetector` for more information.
type Config struct {
// Address is the address of the Consul server
Address string `mapstructure:"address"`
// Datacenter to use. If not provided, the default agent datacenter is used.
Datacenter string `mapstructure:"datacenter"`
// Token is used to provide a per-request ACL token
// which overrides the agent's default (empty) token.
// Token or Tokenfile are only required if [Consul's ACL
// System](https://www.consul.io/docs/security/acl/acl-system) is enabled.
Token configopaque.String `mapstructure:"token"`
// TokenFile is a file containing the current token to use for this client.
// If provided it is read once at startup and never again.
// Token or Tokenfile are only required if [Consul's ACL
// System](https://www.consul.io/docs/security/acl/acl-system) is enabled.
TokenFile string `mapstructure:"token_file"`
// Namespace is the name of the namespace to send along for the request
// when no other Namespace is present in the QueryOptions
Namespace string `mapstructure:"namespace"`
// Allowlist of [Consul
// Metadata](https://www.consul.io/docs/agent/options#node_meta) keys to use as
// resource attributes.
MetaLabels map[string]any `mapstructure:"meta"`
// ResourceAttributes configuration for Consul detector
ResourceAttributes metadata.ResourceAttributesConfig `mapstructure:"resource_attributes"`
}
func CreateDefaultConfig() Config {
return Config{
ResourceAttributes: metadata.DefaultResourceAttributesConfig(),
}
}