Skip to content

Commit

Permalink
fix(api): add tracing span (#3082)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin authored and sguiheux committed Jul 26, 2018
1 parent a40396c commit 7917b44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion engine/api/workflow/execute_node_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ type vcsInfos struct {
server string
}

func getVCSInfos(db gorp.SqlExecutor, store cache.Store, proj *sdk.Project, wr *sdk.WorkflowRun, gitValues map[string]string, node *sdk.WorkflowNode, nodeRun *sdk.WorkflowNodeRun, isChildNode bool, previousGitRepo string) (vcsInfos, error) {
func getVCSInfos(ctx context.Context, db gorp.SqlExecutor, store cache.Store, proj *sdk.Project, wr *sdk.WorkflowRun, gitValues map[string]string, node *sdk.WorkflowNode, nodeRun *sdk.WorkflowNodeRun, isChildNode bool, previousGitRepo string) (vcsInfos, error) {
var vcsInfos vcsInfos
vcsInfos.repository = gitValues[tagGitRepository]
vcsInfos.branch = gitValues[tagGitBranch]
Expand All @@ -771,6 +771,13 @@ func getVCSInfos(db gorp.SqlExecutor, store cache.Store, proj *sdk.Project, wr *
return vcsInfos, nil
}

_, end := tracing.Span(ctx, "workflow.getVCSInfos",
tracing.Tag("application", node.Context.Application.Name),
tracing.Tag("vcs_server", node.Context.Application.VCSServer),
tracing.Tag("vcs_repo", node.Context.Application.RepositoryFullname),
)
defer end()

vcsServer := repositoriesmanager.GetProjectVCSServer(proj, node.Context.Application.VCSServer)
if vcsServer == nil {
return vcsInfos, nil
Expand Down
2 changes: 1 addition & 1 deletion engine/api/workflow/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func processWorkflowNodeRun(ctx context.Context, db gorp.SqlExecutor, store cach

var vcsInfos vcsInfos
var errVcs error
vcsInfos, errVcs = getVCSInfos(db, store, p, w, gitValues, n, run, !isRoot, previousGitValues[tagGitRepository])
vcsInfos, errVcs = getVCSInfos(ctx, db, store, p, w, gitValues, n, run, !isRoot, previousGitValues[tagGitRepository])
if errVcs != nil {
if isRoot {
return report, false, sdk.WrapError(errVcs, "processWorkflowNodeRun> Cannot get VCSInfos")
Expand Down

0 comments on commit 7917b44

Please sign in to comment.