func NewSpan(tracer opentracing.Tracer, operationName string, opts ...opentracing.StartSpanOption) gin.HandlerFunc {
	return func(ctx *gin.Context) {
		span := tracer.StartSpan(operationName, opts...)
		ctx.Set(spanContextKey, span)
		defer span.Finish()
		ctx.Next()
	}
}
NewSpan returns gin.HandlerFunc (middleware) that starts a new span and injects it to request context.

It calls ctx.Next() to measure execution time of all following handlers.
package opengintracing
import (
	"errors"
	"net/http"
	"github.com/gin-gonic/gin"
	"github.com/opentracing/opentracing-go"
)
const spanContextKey = "span"
var (
	ErrSpanNotFound = errors.New("span was not found in context")
)