]> source.dussan.org Git - sonarqube.git/commitdiff
[NO-JIRA] Improved datadog frontend log
authorKevin Silva <kevin.silva@sonarsource.com>
Thu, 26 Oct 2023 10:42:36 +0000 (12:42 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 26 Oct 2023 20:02:58 +0000 (20:02 +0000)
server/sonar-web/config/jest/DataDogReporter.js

index 08ac6c8dc832a431d8f85e4f9c0a33a7f0a72e87..2e95b49e93f0cb0db7f4da0609bc1a8cb02a7c56 100644 (file)
@@ -42,10 +42,16 @@ module.exports = class ElasticSearchReporter {
 
   collectTestData(testClassResults) {
     const commit = process.env.GIT_SHA1;
+    const branchName = process.env.GITHUB_BRANCH;
     const build = process.env.BUILD_NUMBER;
 
     const data = testClassResults.reduce((flattenedTestResults, testClassResult) => {
-      const formattedTestResults = this.formatTestResults(testClassResult, commit, build);
+      const formattedTestResults = this.formatTestResults(
+        testClassResult,
+        commit,
+        build,
+        branchName,
+      );
 
       return flattenedTestResults.concat(formattedTestResults);
     }, []);
@@ -53,7 +59,7 @@ module.exports = class ElasticSearchReporter {
     this.writeToFile(data);
   }
 
-  formatTestResults(testClassResult, commit, build) {
+  formatTestResults(testClassResult, commit, build, branchName) {
     const timestamp = new Date(testClassResult.perfStats.start).toISOString();
     const testClass = this.stripFilePath(testClassResult.testFilePath);
 
@@ -61,6 +67,7 @@ module.exports = class ElasticSearchReporter {
       .filter((test) => test.status === 'failed')
       .map((testResult) => ({
         commit,
+        branchName,
         build,
         category: ES_ITEM_CATEGORY,
         timestamp,