Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
cffc1b13
Unverified
Commit
cffc1b13
authored
Nov 27, 2020
by
Carl Bergquist
Committed by
GitHub
Nov 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds tracing for all bus calls that passes ctx (#29434)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
parent
107f6582
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
pkg/api/alerting.go
+1
-1
pkg/bus/bus.go
+7
-0
pkg/services/alerting/test_notification.go
+2
-2
No files found.
pkg/api/alerting.go
View file @
cffc1b13
...
...
@@ -433,7 +433,7 @@ func NotificationTest(c *models.ReqContext, dto dtos.NotificationTestCommand) Re
SecureSettings
:
dto
.
SecureSettings
,
}
if
err
:=
bus
.
Dispatch
(
cmd
);
err
!=
nil
{
if
err
:=
bus
.
Dispatch
Ctx
(
c
.
Req
.
Context
(),
cmd
);
err
!=
nil
{
if
errors
.
Is
(
err
,
models
.
ErrSmtpNotEnabled
)
{
return
Error
(
412
,
err
.
Error
(),
err
)
}
...
...
pkg/bus/bus.go
View file @
cffc1b13
...
...
@@ -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
...
...
pkg/services/alerting/test_notification.go
View file @
cffc1b13
...
...
@@ -30,10 +30,10 @@ var (
)
func
init
()
{
bus
.
AddHandler
(
"alerting"
,
handleNotificationTestCommand
)
bus
.
AddHandler
Ctx
(
"alerting"
,
handleNotificationTestCommand
)
}
func
handleNotificationTestCommand
(
cmd
*
NotificationTestCommand
)
error
{
func
handleNotificationTestCommand
(
c
tx
context
.
Context
,
c
md
*
NotificationTestCommand
)
error
{
notifier
:=
newNotificationService
(
nil
)
model
:=
&
models
.
AlertNotification
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment