-
Notifications
You must be signed in to change notification settings - Fork 54
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
Avoid calculating _dd.hostname for Jenkins workers #184
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
*/ | ||
public class DatadogTraceBuildLogic { | ||
|
||
private static final String HOSTNAME_NONE = "none"; | ||
private static final Logger logger = Logger.getLogger(DatadogTraceBuildLogic.class.getName()); | ||
|
||
private final Tracer tracer; | ||
|
@@ -123,9 +124,11 @@ public void finishBuildTrace(final BuildData buildData, final Run<?,?> run) { | |
|
||
final String nodeName = buildData.getNodeName("").isEmpty() ? pipelineData.getNodeName("") : buildData.getNodeName(""); | ||
buildSpan.setTag(CITags.NODE_NAME, nodeName); | ||
|
||
final String nodeHostname = buildData.getHostname("").isEmpty() ? pipelineData.getHostname("") : buildData.getHostname(""); | ||
buildSpan.setTag(CITags._DD_HOSTNAME, nodeHostname); | ||
// If the NodeName == master, we don't set _dd.hostname. It will be overridden by the Datadog Agent. (Traces are only available using Datadog Agent) | ||
// If the NodeName != master, we set _dd.hostname to 'none' explicitly, cause we cannot calculate the worker hostname. | ||
if(!"master".equalsIgnoreCase(nodeName)) { | ||
buildSpan.setTag(CITags._DD_HOSTNAME, HOSTNAME_NONE); | ||
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. What's the impact of setting 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. As far as we know, APM doesn't create hosts based on the 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. Perfect, I didn't know about billing implications |
||
} | ||
|
||
// Git Info | ||
final String gitUrl = buildData.getGitUrl("").isEmpty() ? pipelineData.getGitUrl("") : buildData.getGitUrl(""); | ||
|
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.
That's not true when the plugin is configured in HTTP mode. In that case, no hostname will be reported.
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.
Yeah, Jenkins traces collection is only available if the plugin is configured in a Datadog Agent mode: (link), so we can assume that's correct, right?
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.
Oh right, completely forgot about that. Was there any plan to allow sending traces via HTTP? If yes we should add some additional logic here to fail if the plugin runs in http mode. That will help in the future