-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
// 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 comment
The reason will be displayed to describe this comment to others. Learn more.
What's the impact of setting none
here? This has a pretty big impact for metrics for instance (as it would create a new host with the "none" name), but this should be for traces only in that situation. Are we ok with setting a dummy value?
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.
As far as we know, APM doesn't create hosts based on the _dd.hostname
tag. In this case, the value none
is a special value for APM that is excluded from per-host billing. Additionally, if we don't set it and we let the agent put the master hostname, it'd be worse from a user perspective because we will be showing wrong information.
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.
Perfect, I didn't know about billing implications
|
||
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) |
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
Requirements for Contributing to this repository
What does this PR do?
This PR changes the logic of how we calculate the
_dd.hostname
for the traces:master
, we don't set_dd.hostname
. It will be overridden by the Datadog Agent.master
, we set_dd.hostname
tonone
explicitly, cause we cannot calculate the worker hostname.This change is needed because we cannot always calculate the hostname of a Jenkins worker. For the main node, we will use the Datadog Agent logic to calculate the correct value.
Description of the Change
Alternate Designs
Possible Drawbacks
Verification Process
Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.