-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support: top-trace with some file exporters #5
Draft
v1v
wants to merge
9
commits into
reakaleek:main
Choose a base branch
from
v1v:feature/top-traces
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9d257c2
support: top-trace with some file exporters
v1v 9f9e156
chore: fixed
v1v cc58c5d
refactor: centralise the attributes
v1v ba00f3d
Create traces for the Test Suites only
v1v 0f0d13d
Add jaeger (#1)
reakaleek bb7d67d
use junit service name
v1v e4cf4ca
reduce verbosity
v1v 6c61f7e
trying to enable test traces
v1v dd5bff0
traces (#2)
reakaleek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package opentelemetrygithubactionsjunitreceiver | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. centrallise all the attributes for the GitHub workflow events and the Test Suites/Test Cases |
||
|
||
import ( | ||
"strings" | ||
"time" | ||
|
||
"github.com/google/go-github/v62/github" | ||
"github.com/joshdk/go-junit" | ||
"go.opentelemetry.io/collector/pdata/pcommon" | ||
semconv "go.opentelemetry.io/otel/semconv/v1.25.0" | ||
) | ||
|
||
func createResourceAttributesTestSuite(resource pcommon.Resource, suite junit.Suite, config *Config) { | ||
attrs := resource.Attributes() | ||
attrs.PutStr(string(semconv.CodeNamespaceKey), suite.Package) | ||
attrs.PutStr("tests.suite.suitename", suite.Name) | ||
attrs.PutStr("tests.suite.suitename", suite.Name) | ||
attrs.PutStr("tests.suite.systemerr", suite.SystemErr) | ||
attrs.PutStr("tests.suite.systemout", suite.SystemOut) | ||
attrs.PutInt("tests.suite.duration", suite.Totals.Duration.Milliseconds()) | ||
} | ||
|
||
func createResourceAttributesTest(resource pcommon.Resource, test junit.Test, config *Config) { | ||
attrs := resource.Attributes() | ||
attrs.PutInt("tests.case.duration", test.Duration.Milliseconds()) | ||
attrs.PutStr(string(semconv.CodeFunctionKey), test.Name) | ||
attrs.PutStr("tests.case.classname", test.Classname) | ||
attrs.PutStr("tests.case.message", test.Message) | ||
attrs.PutStr("tests.case.status", string(test.Status)) | ||
attrs.PutStr("tests.case.systemerr", test.SystemErr) | ||
attrs.PutStr("tests.case.systemout", test.SystemOut) | ||
if test.Error != nil { | ||
attrs.PutStr("tests.case.error", test.Error.Error()) | ||
} | ||
} | ||
|
||
func createResourceAttributes(resource pcommon.Resource, e *github.WorkflowRunEvent, config *Config) { | ||
attrs := resource.Attributes() | ||
|
||
serviceName := generateServiceName(config, e.GetRepo().GetFullName()) | ||
attrs.PutStr("service.name", serviceName) | ||
|
||
attrs.PutStr("ci.github.workflow.run.actor.login", e.GetWorkflowRun().GetActor().GetLogin()) | ||
|
||
attrs.PutStr("ci.github.workflow.run.conclusion", e.GetWorkflowRun().GetConclusion()) | ||
attrs.PutStr("ci.github.workflow.run.created_at", e.GetWorkflowRun().GetCreatedAt().Format(time.RFC3339)) | ||
attrs.PutStr("ci.github.workflow.run.display_title", e.GetWorkflowRun().GetDisplayTitle()) | ||
attrs.PutStr("ci.github.workflow.run.event", e.GetWorkflowRun().GetEvent()) | ||
attrs.PutStr("ci.github.workflow.run.head_branch", e.GetWorkflowRun().GetHeadBranch()) | ||
attrs.PutStr("ci.github.workflow.run.head_sha", e.GetWorkflowRun().GetHeadSHA()) | ||
attrs.PutStr("ci.github.workflow.run.html_url", e.GetWorkflowRun().GetHTMLURL()) | ||
attrs.PutInt("ci.github.workflow.run.id", e.GetWorkflowRun().GetID()) | ||
attrs.PutStr("ci.github.workflow.run.name", e.GetWorkflowRun().GetName()) | ||
attrs.PutStr("ci.github.workflow.run.path", e.GetWorkflow().GetPath()) | ||
|
||
if e.GetWorkflowRun().GetPreviousAttemptURL() != "" { | ||
htmlURL := transformGitHubAPIURL(e.GetWorkflowRun().GetPreviousAttemptURL()) | ||
attrs.PutStr("ci.github.workflow.run.previous_attempt_url", htmlURL) | ||
} | ||
|
||
if len(e.GetWorkflowRun().ReferencedWorkflows) > 0 { | ||
var referencedWorkflows []string | ||
for _, workflow := range e.GetWorkflowRun().ReferencedWorkflows { | ||
referencedWorkflows = append(referencedWorkflows, workflow.GetPath()) | ||
} | ||
attrs.PutStr("ci.github.workflow.run.referenced_workflows", strings.Join(referencedWorkflows, ";")) | ||
} | ||
|
||
attrs.PutInt("ci.github.workflow.run.run_attempt", int64(e.GetWorkflowRun().GetRunAttempt())) | ||
attrs.PutStr("ci.github.workflow.run.run_started_at", e.GetWorkflowRun().RunStartedAt.Format(time.RFC3339)) | ||
attrs.PutStr("ci.github.workflow.run.status", e.GetWorkflowRun().GetStatus()) | ||
attrs.PutStr("ci.github.workflow.run.sender.login", e.GetSender().GetLogin()) | ||
attrs.PutStr("ci.github.workflow.run.triggering_actor.login", e.GetWorkflowRun().GetTriggeringActor().GetLogin()) | ||
attrs.PutStr("ci.github.workflow.run.updated_at", e.GetWorkflowRun().GetUpdatedAt().Format(time.RFC3339)) | ||
duration := e.GetWorkflowRun().GetUpdatedAt().Sub(e.GetWorkflowRun().GetRunStartedAt().Time) | ||
attrs.PutInt("ci.github.workflow.run.duration_millis", duration.Milliseconds()) | ||
|
||
attrs.PutStr("ci.system", "github") | ||
|
||
attrs.PutStr("scm.system", "git") | ||
|
||
attrs.PutStr("scm.git.head_branch", e.GetWorkflowRun().GetHeadBranch()) | ||
attrs.PutStr("scm.git.head_commit.author.email", e.GetWorkflowRun().GetHeadCommit().GetAuthor().GetEmail()) | ||
attrs.PutStr("scm.git.head_commit.author.name", e.GetWorkflowRun().GetHeadCommit().GetAuthor().GetName()) | ||
attrs.PutStr("scm.git.head_commit.committer.email", e.GetWorkflowRun().GetHeadCommit().GetCommitter().GetEmail()) | ||
attrs.PutStr("scm.git.head_commit.committer.name", e.GetWorkflowRun().GetHeadCommit().GetCommitter().GetName()) | ||
attrs.PutStr("scm.git.head_commit.message", e.GetWorkflowRun().GetHeadCommit().GetMessage()) | ||
attrs.PutStr("scm.git.head_commit.timestamp", e.GetWorkflowRun().GetHeadCommit().GetTimestamp().Format(time.RFC3339)) | ||
attrs.PutStr("scm.git.head_sha", e.GetWorkflowRun().GetHeadSHA()) | ||
|
||
if len(e.GetWorkflowRun().PullRequests) > 0 { | ||
var prUrls []string | ||
for _, pr := range e.GetWorkflowRun().PullRequests { | ||
prUrls = append(prUrls, convertPRURL(pr.GetURL())) | ||
} | ||
attrs.PutStr("scm.git.pull_requests.url", strings.Join(prUrls, ";")) | ||
} | ||
|
||
attrs.PutStr("scm.git.repo", e.GetRepo().GetFullName()) | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no more debugging