Silvan 168242e725
fix(tracing): from opencensus to opentelemetry (#937)
* 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
2020-11-20 07:57:39 +01:00

25 lines
553 B
Go

package otel
import (
"github.com/caos/zitadel/internal/tracing"
"go.opentelemetry.io/otel/exporters/otlp"
sdk_trace "go.opentelemetry.io/otel/sdk/trace"
)
type Config struct {
Fraction float64
MetricPrefix string
Endpoint string
}
func (c *Config) NewTracer() error {
sampler := sdk_trace.ParentBased(sdk_trace.TraceIDRatioBased(c.Fraction))
exporter, err := otlp.NewExporter(otlp.WithAddress(c.Endpoint), otlp.WithInsecure())
if err != nil {
return err
}
tracing.T = NewTracer(c.MetricPrefix, sampler, exporter)
return nil
}