-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
config.go
39 lines (30 loc) · 1.18 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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package podmanreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/podmanreceiver"
import (
"errors"
"time"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/receiver/scraperhelper"
)
var _ component.Config = (*Config)(nil)
type Config struct {
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
// The URL of the podman server. Default is "unix:///run/podman/podman.sock"
Endpoint string `mapstructure:"endpoint"`
// The maximum amount of time to wait for Podman API responses. Default is 5s
Timeout time.Duration `mapstructure:"timeout"`
APIVersion string `mapstructure:"api_version"`
SSHKey string `mapstructure:"ssh_key"`
SSHPassphrase configopaque.String `mapstructure:"ssh_passphrase"`
}
func (config Config) Validate() error {
if config.Endpoint == "" {
return errors.New("config.Endpoint must be specified")
}
if config.CollectionInterval == 0 {
return errors.New("config.CollectionInterval must be specified")
}
return nil
}