Skip to content

Commit

Permalink
feat: add ci.github.workflow.run.head_branch.is_main span attr (#187)
Browse files Browse the repository at this point in the history
* Add ci.github.workflow.run.head_branch.is_main span attr

* Fix how we get the default_branch

* Update receiver/githubactionsreceiver/trace_event_handling.go

Co-authored-by: Horst Gutmann <[email protected]>

---------

Co-authored-by: Horst Gutmann <[email protected]>
  • Loading branch information
dsotirakis and zerok authored Jan 10, 2025
1 parent 11d5aca commit ce4de9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions receiver/githubactionsreceiver/trace_event_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func createRootSpan(resourceSpans ptrace.ResourceSpans, event *github.WorkflowRu
return pcommon.SpanID{}, fmt.Errorf("failed to generate root span ID: %w", err)
}

defaultBranch := event.GetRepo().GetDefaultBranch()

span.Attributes().PutBool("ci.github.workflow.run.head_branch.is_main", event.GetWorkflowRun().GetHeadBranch() == defaultBranch)

span.SetTraceID(traceID)
span.SetSpanID(rootSpanID)
span.SetName(event.GetWorkflowRun().GetName())
Expand Down

0 comments on commit ce4de9e

Please sign in to comment.