mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 03:54:21 +00:00
168242e725
* refactor: switch from opencensus to opentelemetry * tempo works as designed nooooot * fix: log traceids * with grafana agent * fix: http tracing * fix: cleanup files * chore: remove todo * fix: bad test * fix: ignore methods in grpc interceptors * fix: remove test log * clean up * typo * fix(config): configure tracing endpoint * fix(span): add error id to span
29 lines
621 B
Go
29 lines
621 B
Go
package log
|
|
|
|
import (
|
|
"github.com/caos/zitadel/internal/tracing"
|
|
"github.com/caos/zitadel/internal/tracing/otel"
|
|
"go.opentelemetry.io/otel/exporters/stdout"
|
|
sdk_trace "go.opentelemetry.io/otel/sdk/trace"
|
|
)
|
|
|
|
type Config struct {
|
|
Fraction float64
|
|
MetricPrefix string
|
|
}
|
|
|
|
type Tracer struct {
|
|
otel.Tracer
|
|
}
|
|
|
|
func (c *Config) NewTracer() error {
|
|
sampler := sdk_trace.ParentBased(sdk_trace.TraceIDRatioBased(c.Fraction))
|
|
exporter, err := stdout.NewExporter(stdout.WithPrettyPrint())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
tracing.T = &Tracer{Tracer: *(otel.NewTracer(c.MetricPrefix, sampler, exporter))}
|
|
return nil
|
|
}
|