From 9391ff11ee1865a7727f94d0113b734d1f454dca Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Mon, 30 Jan 2017 21:51:38 +0530 Subject: [PATCH] Supporting perf events with opentracing Perf events can provide additional insights into what's happening within a span. Although, latency of a span can help us in identifying the bottle necks within a trace, perf events can compliment that in identifying as to where was the bottle neck and which platform resource was busy for that span. This patch is in addition to the perf events support to zipkin-go-opentracing. Signed-off-by: Hemant Kumar --- tracer.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tracer.go b/tracer.go index c84c4fd..bd0bd4c 100644 --- a/tracer.go +++ b/tracer.go @@ -145,6 +145,10 @@ type StartSpanOptions struct { // If specified, the caller hands off ownership of Tags at // StartSpan() invocation time. Tags map[string]interface{} + + // Perfevent is the platform metric's name or an event name supported + // by perf. + Perfevent string } // StartSpanOption instances (zero or more) may be passed to Tracer.StartSpan. @@ -262,6 +266,14 @@ func (t StartTime) Apply(o *StartSpanOptions) { o.StartTime = time.Time(t) } +// PerfString is the perf event's name. +type PerfString string + +// Apply satisfies the StartSpanOption interface +func (e PerfString) Apply(o *StartSpanOptions) { + o.Perfevent = string(e) +} + // Tags are a generic map from an arbitrary string key to an opaque value type. // The underlying tracing system is responsible for interpreting and // serializing the values.