mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
adds tracing for all bus calls that passes ctx (#29434)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
)
|
||||
|
||||
// HandlerFunc defines a handler function interface.
|
||||
@@ -84,6 +86,11 @@ func (b *InProcBus) SetTransactionManager(tm TransactionManager) {
|
||||
func (b *InProcBus) DispatchCtx(ctx context.Context, msg Msg) error {
|
||||
var msgName = reflect.TypeOf(msg).Elem().Name()
|
||||
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "bus - "+msgName)
|
||||
defer span.Finish()
|
||||
|
||||
span.SetTag("msg", msgName)
|
||||
|
||||
var handler = b.handlersWithCtx[msgName]
|
||||
if handler == nil {
|
||||
return ErrHandlerNotFound
|
||||
|
||||
Reference in New Issue
Block a user