mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 12:27:59 +00:00
35 lines
805 B
Go
35 lines
805 B
Go
package config
|
|
|
|
import (
|
|
"github.com/zitadel/zitadel/internal/errors"
|
|
"github.com/zitadel/zitadel/internal/telemetry/tracing/google"
|
|
"github.com/zitadel/zitadel/internal/telemetry/tracing/log"
|
|
"github.com/zitadel/zitadel/internal/telemetry/tracing/otel"
|
|
)
|
|
|
|
type Config struct {
|
|
Type string
|
|
Config map[string]interface{} `mapstructure:",remain"`
|
|
}
|
|
|
|
func (c *Config) NewTracer() error {
|
|
t, ok := tracer[c.Type]
|
|
if !ok {
|
|
return errors.ThrowInternalf(nil, "TRACE-dsbjh", "config type %s not supported", c.Type)
|
|
}
|
|
|
|
return t(c.Config)
|
|
}
|
|
|
|
var tracer = map[string]func(map[string]interface{}) error{
|
|
"otel": otel.NewTracerFromConfig,
|
|
"google": google.NewTracer,
|
|
"log": log.NewTracer,
|
|
"none": NoTracer,
|
|
"": NoTracer,
|
|
}
|
|
|
|
func NoTracer(_ map[string]interface{}) error {
|
|
return nil
|
|
}
|