forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
41 lines (33 loc) · 1.25 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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package apachesparkreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/apachesparkreceiver"
import (
"errors"
"net/url"
"time"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/receiver/scraperhelper"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/apachesparkreceiver/internal/metadata"
)
const (
defaultCollectionInterval = time.Minute
defaultEndpoint = "http:https://localhost:4040"
)
var (
errInvalidEndpoint = errors.New("'endpoint' must be in the form of <scheme>:https://<hostname>:<port>")
)
// Config defines the configuration for the various elements of the receiver agent.
type Config struct {
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
metadata.MetricsBuilderConfig `mapstructure:",squash"`
confighttp.HTTPClientSettings `mapstructure:",squash"`
ApplicationNames []string `mapstructure:"application_names"`
}
// Validate validates missing and invalid configuration fields.
func (cfg *Config) Validate() error {
_, parseErr := url.Parse(cfg.Endpoint)
if parseErr != nil {
return errInvalidEndpoint
}
return nil
}