-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
config.go
36 lines (27 loc) · 1.07 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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package service // import "go.opentelemetry.io/collector/service"
import (
"fmt"
"go.opentelemetry.io/collector/service/extensions"
"go.opentelemetry.io/collector/service/pipelines"
"go.opentelemetry.io/collector/service/telemetry"
)
// Config defines the configurable components of the Service.
type Config struct {
// Telemetry is the configuration for collector's own telemetry.
Telemetry telemetry.Config `mapstructure:"telemetry"`
// Extensions are the ordered list of extensions configured for the service.
Extensions extensions.Config `mapstructure:"extensions"`
// Pipelines are the set of data pipelines configured for the service.
Pipelines pipelines.Config `mapstructure:"pipelines"`
}
func (cfg *Config) Validate() error {
if err := cfg.Pipelines.Validate(); err != nil {
return fmt.Errorf("service::pipelines config validation failed: %w", err)
}
if err := cfg.Telemetry.Validate(); err != nil {
fmt.Printf("service::telemetry config validation failed: %v\n", err)
}
return nil
}