| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package zpagesextension |
| 5 |
|
| 6 |
import ( |
| 7 |
"errors" |
| 8 |
|
| 9 |
"go.opentelemetry.io/collector/component" |
| 10 |
"go.opentelemetry.io/collector/config/confighttp" |
| 11 |
) |
| 12 |
|
| 13 |
|
| 14 |
type Config struct { |
| 15 |
confighttp.ServerConfig `mapstructure:",squash"` |
| 16 |
|
| 17 |
Expvar ExpvarConfig `mapstructure:"expvar"` |
| 18 |
|
| 19 |
_ struct{} |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
type ExpvarConfig struct { |
| 24 |
|
| 25 |
|
| 26 |
Enabled bool `mapstructure:"enabled"` |
| 27 |
|
| 28 |
_ struct{} |
| 29 |
} |
| 30 |
|
| 31 |
var _ component.Config = (*Config)(nil) |
| 32 |
|
| 33 |
|
| 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 |
} |