diff --git a/pom.xml b/pom.xml
index 99a3bd8..ecffd7f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
com.getbase.jenkins.plugins
build-history-metrics
- 1.0-SNAPSHOT
+ 1.1.1
Build history metrics plugin
Jenkins plugin to publish build metrics to external storage
hpi
diff --git a/src/main/java/com/getbase/jenkins/plugins/metrics/history/influxdb/generators/JenkinsBasePointGenerator.java b/src/main/java/com/getbase/jenkins/plugins/metrics/history/influxdb/generators/JenkinsBasePointGenerator.java
index 700f9db..48d79ef 100644
--- a/src/main/java/com/getbase/jenkins/plugins/metrics/history/influxdb/generators/JenkinsBasePointGenerator.java
+++ b/src/main/java/com/getbase/jenkins/plugins/metrics/history/influxdb/generators/JenkinsBasePointGenerator.java
@@ -1,24 +1,26 @@
package com.getbase.jenkins.plugins.metrics.history.influxdb.generators;
import com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerJobAction;
-import com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerJobProperty;
import hudson.model.Result;
import hudson.model.Run;
import jenkins.metrics.impl.TimeInQueueAction;
import org.influxdb.dto.Point;
public class JenkinsBasePointGenerator implements PointGenerator {
- public static final String MEASUREMENT_NAME = "jenkins_build_data";
- public static final String JOB_NAME = "job_name";
- public static final String BUILD_NUMBER = "build_number";
- public static final String BUILD_RESULT = "build_result";
- public static final String BUILD_TIMESTAMP = "build_timestamp";
- public static final String BUILD_DURATION = "build_duration";
- public static final String QUEUING_DURATION = "queuing_duration";
- public static final String TOTAL_DURATION = "total_duration";
- public static final String BUILD_STATUS_MESSAGE = "build_status_message";
- public static final String JOB_OWNER = "job_owner";
- public static final String JOB_SCORE = "job_score";
+ private static final String MEASUREMENT_NAME = "jenkins_build_data";
+ private static final String JOB_NAME = "job_name";
+ private static final String BUILD_NUMBER = "build_number";
+ private static final String BUILD_RESULT = "build_result";
+ private static final String BUILD_RESULT_INT = "build_result_int";
+ private static final String BUILD_TIMESTAMP = "build_timestamp";
+ private static final String BUILD_DURATION = "build_duration";
+ private static final String QUEUING_DURATION = "queuing_duration";
+ private static final String TOTAL_DURATION = "total_duration";
+ private static final String BUILD_STATUS_MESSAGE = "build_status_message";
+ private static final String JOB_OWNER = "job_owner";
+ private static final String JOB_SCORE = "job_score";
+ private static final String BUILD_URL = "build_url";
+ private static final String JOB_URL = "job_url";
private final Run, ?> build;
@@ -38,25 +40,30 @@ public Point[] generate() {
int score = build.getParent().getBuildHealth().getScore();
final Result result = build.getResult();
final String resultStr = result != null ? result.toString() : "UNKNOWN";
+ final Integer resultInt = resultStr.equals("SUCCESS") ? 1 : 0;
+ final String jobAbsoluteURL = build.getParent().getAbsoluteUrl();
+ final String buildAbsoluteURL = jobAbsoluteURL + build.getNumber();
Point.Builder point = Point
.measurement(MEASUREMENT_NAME)
.addField(JOB_NAME, build.getParent().getFullName())
.tag(JOB_NAME, build.getParent().getFullName())
- .addField(BUILD_NUMBER, build.getNumber())
- .addField(BUILD_RESULT, resultStr)
- .tag(BUILD_RESULT, resultStr)
+ .addField(JOB_URL, jobAbsoluteURL)
+ .tag(JOB_URL, jobAbsoluteURL)
.addField(JOB_OWNER, owner)
.tag(JOB_OWNER, owner)
+ .addField(BUILD_NUMBER, build.getNumber())
+ .addField(BUILD_RESULT, resultStr)
+ .addField(BUILD_RESULT_INT, resultInt)
.addField(JOB_SCORE, score)
- .tag(JOB_SCORE, Integer.toString(score))
+ .addField(BUILD_URL, buildAbsoluteURL)
.addField(BUILD_TIMESTAMP, build.getTimeInMillis())
.addField(BUILD_DURATION, duration)
.addField(QUEUING_DURATION, action.getQueuingDurationMillis())
.addField(TOTAL_DURATION, duration + action.getQueuingDurationMillis())
.addField(BUILD_STATUS_MESSAGE, build.getBuildStatusSummary().message);
- return new Point[] {point.build()};
+ return new Point[]{point.build()};
}