Debian Codegraph @

extension/zpagesextension/config.go

raw symbols SCIP
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package zpagesextension // import "go.opentelemetry.io/collector/extension/zpagesextension"
5
6 import (
7 "errors"
8
9 "go.opentelemetry.io/collector/component"
10 "go.opentelemetry.io/collector/config/confighttp"
11 )
12
13 // Config has the configuration for the extension enabling the zPages extension.
14 type Config struct {
15 confighttp.ServerConfig `mapstructure:",squash"`
16
17 Expvar ExpvarConfig `mapstructure:"expvar"`
18 // prevent unkeyed literal initialization
19 _ struct{}
20 }
21
22 // ExpvarConfig has the configuration for the expvar service.
23 type ExpvarConfig struct {
24 // Enabled indicates whether to enable expvar service.
25 // (default = false)
26 Enabled bool `mapstructure:"enabled"`
27 // prevent unkeyed literal initialization
28 _ struct{}
29 }
30
31 var _ component.Config = (*Config)(nil)
32
33 // Validate checks if the extension configuration is valid
34 func (cfg *Config) Validate() error {
35 if cfg.Endpoint == "" {
36 return errors.New("\"endpoint\" is required when using the \"zpages\" extension")
37 }
38 return nil
39 }