/
config.go
69 lines (57 loc) · 2.3 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package loadbalancingexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/loadbalancingexporter"
import (
"time"
"github.com/aws/aws-sdk-go-v2/service/servicediscovery/types"
"go.opentelemetry.io/collector/exporter/otlpexporter"
)
type routingKey int
const (
traceIDRouting routingKey = iota
svcRouting
metricNameRouting
resourceRouting
)
// Config defines configuration for the exporter.
type Config struct {
Protocol Protocol `mapstructure:"protocol"`
Resolver ResolverSettings `mapstructure:"resolver"`
RoutingKey string `mapstructure:"routing_key"`
}
// Protocol holds the individual protocol-specific settings. Only OTLP is supported at the moment.
type Protocol struct {
OTLP otlpexporter.Config `mapstructure:"otlp"`
}
// ResolverSettings defines the configurations for the backend resolver
type ResolverSettings struct {
Static *StaticResolver `mapstructure:"static"`
DNS *DNSResolver `mapstructure:"dns"`
K8sSvc *K8sSvcResolver `mapstructure:"k8s"`
AWSCloudMap *AWSCloudMapResolver `mapstructure:"aws_cloud_map"`
}
// StaticResolver defines the configuration for the resolver providing a fixed list of backends
type StaticResolver struct {
Hostnames []string `mapstructure:"hostnames"`
}
// DNSResolver defines the configuration for the DNS resolver
type DNSResolver struct {
Hostname string `mapstructure:"hostname"`
Port string `mapstructure:"port"`
Interval time.Duration `mapstructure:"interval"`
Timeout time.Duration `mapstructure:"timeout"`
}
// K8sSvcResolver defines the configuration for the DNS resolver
type K8sSvcResolver struct {
Service string `mapstructure:"service"`
Ports []int32 `mapstructure:"ports"`
Timeout time.Duration `mapstructure:"timeout"`
}
type AWSCloudMapResolver struct {
NamespaceName string `mapstructure:"namespace"`
ServiceName string `mapstructure:"service_name"`
HealthStatus types.HealthStatusFilter `mapstructure:"health_status"`
Interval time.Duration `mapstructure:"interval"`
Timeout time.Duration `mapstructure:"timeout"`
Port *uint16 `mapstructure:"port"`
}