-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathconfig.go
More file actions
36 lines (27 loc) · 1.04 KB
/
config.go
File metadata and controls
36 lines (27 loc) · 1.04 KB
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 carbonreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver"
import (
"errors"
"time"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/confmap/xconfmap"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/carbonreceiver/protocol"
)
var _ xconfmap.Validator = (*Config)(nil)
// Config defines configuration for the Carbon receiver.
type Config struct {
confignet.AddrConfig `mapstructure:",squash"`
// TCPIdleTimeout is the timeout for idle TCP connections, it is ignored
// if transport being used is UDP.
TCPIdleTimeout time.Duration `mapstructure:"tcp_idle_timeout"`
// Parser specifies a parser and the respective configuration to be used
// by the receiver.
Parser *protocol.Config `mapstructure:"parser"`
}
func (cfg *Config) Validate() error {
if cfg.TCPIdleTimeout < 0 {
return errors.New("'tcp_idle_timeout' must be non-negative")
}
return nil
}