1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-05-19 21:23:04 +02:00
Niek den Breeje a3202b00ee
Rename gomu to micro (#2325)
* Rename Gomu to Micro

* docs: Remove license reference in CLI's README
2021-10-27 16:31:29 +01:00

21 lines
466 B
Go

package trace
import (
"context"
"runtime"
"github.com/opentracing/opentracing-go"
)
// NewSpan accepts a context and returns an OpenTracing span. Can be used to
// nest spans.
func NewSpan(ctx context.Context) opentracing.Span {
pc := make([]uintptr, 10) // at least 1 entry needed
runtime.Callers(2, pc)
span := opentracing.StartSpan(
runtime.FuncForPC(pc[0]).Name(),
opentracing.ChildOf(opentracing.SpanFromContext(ctx).Context()),
)
return span
}