feat: enable tracing (#3528)

This commit is contained in:
Livio Amstutz
2022-04-28 14:44:13 +02:00
committed by GitHub
parent 08ae39ae19
commit 44a2b81bef
6 changed files with 76 additions and 70 deletions

View File

@@ -1,10 +1,14 @@
package log
import (
"github.com/zitadel/zitadel/internal/telemetry/tracing"
"github.com/zitadel/zitadel/internal/telemetry/tracing/otel"
"strconv"
stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
sdk_trace "go.opentelemetry.io/otel/sdk/trace"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/telemetry/tracing"
"github.com/zitadel/zitadel/internal/telemetry/tracing/otel"
)
type Config struct {
@@ -12,6 +16,20 @@ type Config struct {
MetricPrefix string
}
func NewTracer(rawConfig map[string]interface{}) (err error) {
c := new(Config)
c.MetricPrefix, _ = rawConfig["metricprefix"].(string)
fraction, ok := rawConfig["fraction"].(string)
if ok {
c.Fraction, err = strconv.ParseFloat(fraction, 32)
if err != nil {
return errors.ThrowInternal(err, "LOG-Dsag3", "could not map fraction")
}
}
return c.NewTracer()
}
type Tracer struct {
otel.Tracer
}