Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@slok
Created May 23, 2018 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slok/8fa69faac0d19cbfc0356758c74bbd59 to your computer and use it in GitHub Desktop.
Save slok/8fa69faac0d19cbfc0356758c74bbd59 to your computer and use it in GitHub Desktop.
kooper handler opentracing
hand := &handler.HandlerFunc{
AddFunc: func(ctx context.Context, obj runtime.Object) error {
// Get the parent span.
pSpan := opentracing.SpanFromContext(ctx)
// Create a new span.
span := tracer.StartSpan("AddFunc", opentracing.ChildOf(pSpan.Context()))
defer span.Finish()
// Do stuff...
return nil
},
DeleteFunc: func(ctx context.Context, s string) error {
// Get the parent span.
pSpan := opentracing.SpanFromContext(ctx)
// Create a new span.
span := tracer.StartSpan("DeleteFunc", opentracing.ChildOf(pSpan.Context()))
defer span.Finish()
// Do stuff...
return nil
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment