Skip to content

Commit

Permalink
Revert "Tag pipeline spans with plugin version (#398)"
Browse files Browse the repository at this point in the history
This reverts commit 8fef567.
  • Loading branch information
nikita-tkachenko-datadog committed May 3, 2024
1 parent 902d620 commit de5b2b3
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ of this software and associated documentation files (the "Software"), to deal

import hudson.EnvVars;
import hudson.ExtensionList;
import hudson.PluginManager;
import hudson.PluginWrapper;
import hudson.model.Actionable;
import hudson.model.Computer;
import hudson.model.Item;
Expand Down Expand Up @@ -1114,20 +1112,5 @@ public static long getTimeMillis(FlowNode flowNode) {
}
return -1L;
}

@Nullable
public static String getDatadogPluginVersion() {
Jenkins jenkins = Jenkins.getInstanceOrNull();
if (jenkins == null) {
return null;
}
PluginManager pluginManager = jenkins.getPluginManager();
PluginWrapper datadogPlugin = pluginManager.getPlugin("datadog");
if (datadogPlugin == null) {
return null;
}
return datadogPlugin.getVersion();
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public class CITags {
public static final String JENKINS_TAG = "jenkins.tag";
public static final String JENKINS_EXECUTOR_NUMBER = "jenkins.executor.number";
public static final String JENKINS_RESULT = "jenkins.result";
public static final String JENKINS_PLUGIN_VERSION = "jenkins.plugin.version";

public static final String STATUS_SUCCESS = "success";
public static final String STATUS_ERROR = "error";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public TraceSpan toSpan(final BuildData buildData, final Run<?,?> run) {
buildSpan.putMeta(CITags._DD_CI_LEVEL, buildLevel);
buildSpan.putMeta(CITags.IS_MANUAL, isTriggeredManually(run));
buildSpan.putMeta(CITags._DD_ORIGIN, ORIGIN_CIAPP_PIPELINE);
buildSpan.putMeta(CITags.JENKINS_PLUGIN_VERSION, DatadogUtilities.getDatadogPluginVersion());
buildSpan.putMeta(CITags.USER_NAME, buildData.getUserId());
if(StringUtils.isNotEmpty(buildData.getUserEmail(""))){
buildSpan.putMeta(CITags.USER_EMAIL, buildData.getUserEmail(""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public JSONObject toJson(final BuildData buildData, final Run<?,?> run) {

// Jenkins specific
tagsPayload.add(CITags._DD_CI_INTERNAL + ":" + "false");
tagsPayload.add(CITags.JENKINS_PLUGIN_VERSION + ":" + DatadogUtilities.getDatadogPluginVersion());
tagsPayload.add(CITags.JENKINS_TAG + ":" + buildData.getBuildTag(""));
tagsPayload.add(CITags.JENKINS_EXECUTOR_NUMBER + ":" + buildData.getExecutorNumber(""));
if (StringUtils.isNotEmpty(jenkinsResult)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public void testTraces() throws Exception {
assertEquals("success", meta.get(CITags.JENKINS_RESULT));
assertEquals("jenkins-buildIntegrationSuccess-1", meta.get(CITags.JENKINS_TAG));
assertNull(meta.get(CITags._DD_CI_STAGES)); // this is a freestyle project which has no stages
assertNotNull(meta.get(CITags.JENKINS_PLUGIN_VERSION));

assertCleanupActions(run);
}
Expand Down Expand Up @@ -514,8 +513,6 @@ public void testCITagsOnWebhooks() throws Exception {
final JSONArray tags = webhook.getJSONArray("tags");
assertTrue(tags.contains("global_job_tag:value"));
assertTrue(tags.contains("global_tag:value"));

assertTrue(tags.stream().anyMatch(tag -> tag.toString().startsWith(CITags.JENKINS_PLUGIN_VERSION)));
}

@Test
Expand Down

0 comments on commit de5b2b3

Please sign in to comment.