mirror of
https://github.com/containers/podman.git
synced 2025-05-23 18:17:53 +08:00

the results of a code cleanup performed by the goland IDE. Signed-off-by: baude <bbaude@redhat.com>
29 lines
671 B
Go
29 lines
671 B
Go
package tracing
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/opentracing/opentracing-go"
|
|
"github.com/uber/jaeger-client-go"
|
|
"github.com/uber/jaeger-client-go/config"
|
|
)
|
|
|
|
// Init returns an instance of Jaeger Tracer that samples 100% of traces and logs all spans to stdout.
|
|
func Init(service string) (opentracing.Tracer, io.Closer) {
|
|
cfg := &config.Configuration{
|
|
Sampler: &config.SamplerConfig{
|
|
Type: "const",
|
|
Param: 1,
|
|
},
|
|
Reporter: &config.ReporterConfig{
|
|
LogSpans: true,
|
|
},
|
|
}
|
|
tracer, closer, err := cfg.New(service, config.Logger(jaeger.StdLogger))
|
|
if err != nil {
|
|
panic(fmt.Sprintf("ERROR: cannot init Jaeger: %v\n", err))
|
|
}
|
|
return tracer, closer
|
|
}
|