Skip to content

Commit

Permalink
minor refactor of jaeger function
Browse files Browse the repository at this point in the history
Signed-off-by: Aditi Ahuja <ahuja.aditi@gmail.com>
  • Loading branch information
metonymic-smokey committed Jun 12, 2022
1 parent 6691f1e commit b73bddd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/tracing/jaeger/jaeger.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,24 @@ func NewTracerProvider(ctx context.Context, logger log.Logger, conf []byte) (*tr
}

processor := tracesdk.NewBatchSpanProcessor(exporter)
tp := newTraceProvider(ctx, logger, processor, config.ServiceName)

return tp, nil
}

func newTraceProvider(ctx context.Context, logger log.Logger, processor tracesdk.SpanProcessor,
serviceName string) *tracesdk.TracerProvider {

// need to add sampler config details here
tp := tracesdk.NewTracerProvider(
tracesdk.WithSpanProcessor(processor),
tracesdk.WithBatcher(exporter),
tracesdk.WithResource(resource.NewWithAttributes(
semconv.SchemaURL,
semconv.ServiceNameKey.String(config.ServiceName),
semconv.ServiceNameKey.String(serviceName),
)),
)
return tp, nil

return tp
}

// NewTracer create tracer from YAML.
Expand Down

0 comments on commit b73bddd

Please sign in to comment.