Move tracing to plugin
This just makes the implementation a little cleaner. It also makes the trace exporter pluggable. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -67,8 +67,6 @@ type Config struct {
|
||||
Timeouts map[string]string `toml:"timeouts"`
|
||||
// Imports are additional file path list to config files that can overwrite main config file fields
|
||||
Imports []string `toml:"imports"`
|
||||
// OpenTelemetry configuration
|
||||
OpenTelemetry OpenTelemetryConfig `toml:"otel"`
|
||||
|
||||
StreamProcessors map[string]StreamProcessor `toml:"stream_processors"`
|
||||
}
|
||||
@@ -167,14 +165,6 @@ type ProxyPlugin struct {
|
||||
Address string `toml:"address"`
|
||||
}
|
||||
|
||||
// OpenTelemetryConfig provides open telemetry configuration
|
||||
type OpenTelemetryConfig struct {
|
||||
ServiceName string `toml:"service_name"`
|
||||
ExporterName string `toml:"exporter_name"`
|
||||
ExporterEndpoint string `toml:"exporter_endpoint"`
|
||||
TraceSamplingRatio float64 `toml:"trace_sampling_ratio"`
|
||||
}
|
||||
|
||||
// BoltConfig defines the configuration values for the bolt plugin, which is
|
||||
// loaded here, rather than back registered in the metadata package.
|
||||
type BoltConfig struct {
|
||||
@@ -213,24 +203,6 @@ func (bc *BoltConfig) Validate() error {
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
// ExporterTypeOTLP represents the open telemetry exporter OTLP
|
||||
ExporterTypeOTLP = "otlp"
|
||||
)
|
||||
|
||||
// Validate OpenTelemetry config
|
||||
func (cfg *OpenTelemetryConfig) Validate() error {
|
||||
switch cfg.ExporterName {
|
||||
case ExporterTypeOTLP:
|
||||
if cfg.ServiceName == "" {
|
||||
return errors.Wrapf(errdefs.ErrInvalidArgument, "missing service name in config %+v", cfg)
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
return errors.Wrapf(errdefs.ErrInvalidArgument, "unsupported exporter: %+v", cfg)
|
||||
}
|
||||
}
|
||||
|
||||
// Decode unmarshals a plugin specific configuration by plugin id
|
||||
func (c *Config) Decode(p *plugin.Registration) (interface{}, error) {
|
||||
id := p.URI()
|
||||
|
||||
Reference in New Issue
Block a user