12345678910111213141516171819202122232425262728293031323334353637 |
- // Copyright The OpenTelemetry Authors
- // SPDX-License-Identifier: Apache-2.0
- package skywalkingexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/skywalkingexporter"
- import (
- "errors"
- "go.opentelemetry.io/collector/component"
- "go.opentelemetry.io/collector/config/configgrpc"
- "go.opentelemetry.io/collector/exporter/exporterhelper"
- )
- // Config defines configuration for SkyWalking exporter.
- type Config struct {
- configgrpc.GRPCClientSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
- exporterhelper.QueueSettings `mapstructure:"sending_queue"`
- exporterhelper.RetrySettings `mapstructure:"retry_on_failure"`
- exporterhelper.TimeoutSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
- // The number of grpc streams that send the gRPC requests.
- NumStreams int `mapstructure:"num_streams"`
- }
- var _ component.Config = (*Config)(nil)
- // Validate checks if the exporter configuration is valid
- func (cfg *Config) Validate() error {
- if cfg.Endpoint == "" {
- return errors.New("Skywalking exporter cfg requires an Endpoint")
- }
- if cfg.NumStreams <= 0 {
- return errors.New("Skywalking exporter cfg requires at least one stream")
- }
- return nil
- }
|