mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 09:57:33 +00:00
chore: move the go code into a subfolder
This commit is contained in:
34
apps/api/internal/telemetry/tracing/config/config.go
Normal file
34
apps/api/internal/telemetry/tracing/config/config.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/zitadel/zitadel/internal/telemetry/tracing/google"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/tracing/log"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/tracing/otel"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Type string
|
||||
Config map[string]interface{} `mapstructure:",remain"`
|
||||
}
|
||||
|
||||
func (c *Config) NewTracer() error {
|
||||
t, ok := tracer[c.Type]
|
||||
if !ok {
|
||||
return zerrors.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
|
||||
}
|
Reference in New Issue
Block a user