gocommon/tracing/exporter/jaeger/exporter.go

24 lines
439 B
Go
Raw Permalink Normal View History

package jaeger
import (
"github.com/juju/errors"
"go.opentelemetry.io/otel/exporters/jaeger"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)
// NewExporter will create a Jaeger exporter for tracing.
func NewExporter(c *ConfigStruct) (sdktrace.SpanExporter, error) {
err := c.IsValid()
if err != nil {
return nil, errors.Trace(err)
}
return jaeger.New(
jaeger.WithCollectorEndpoint(
jaeger.WithEndpoint(c.URL),
),
)
}