summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorSebastian Jug <sejug@redhat.com>2018-10-16 16:30:53 -0400
committerSebastian Jug <seb@stianj.ug>2019-02-18 09:57:08 -0500
commit7141f972700ed454438d8539dd0bec79c0b61cf4 (patch)
treebfa2e524b71757a514a02ef68661b46dca9a3dfe /pkg
parente738ef16225395f5f5e4b93ba1a43ae9449ae11b (diff)
downloadpodman-7141f972700ed454438d8539dd0bec79c0b61cf4.tar.gz
podman-7141f972700ed454438d8539dd0bec79c0b61cf4.tar.bz2
podman-7141f972700ed454438d8539dd0bec79c0b61cf4.zip
OpenTracing support added to start, stop, run, create, pull, and ps
Drop context.Context field from cli.Context Signed-off-by: Sebastian Jug <sejug@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tracing/tracing.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/tracing/tracing.go b/pkg/tracing/tracing.go
new file mode 100644
index 000000000..cae76dee8
--- /dev/null
+++ b/pkg/tracing/tracing.go
@@ -0,0 +1,28 @@
+package tracing
+
+import (
+ "fmt"
+ "io"
+
+ opentracing "github.com/opentracing/opentracing-go"
+ jaeger "github.com/uber/jaeger-client-go"
+ config "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
+}