-
Notifications
You must be signed in to change notification settings - Fork 70
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
Support sending a service
tag
#269
Conversation
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.
Some small changes around the strings tests requested, but it looks good to me otherwise!
@@ -140,6 +141,14 @@ public Instance( | |||
this.refreshBeansPeriod = appConfig.getRefreshBeansPeriod(); | |||
} | |||
|
|||
this.service = (String) instanceMap.get("service"); | |||
if ((this.service == null || this.service == "") && initConfig != null) { |
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.
I think it'll be better to do:
if ((this.service == null || this.service.isEmpty()) && initConfig != null) {
You may already know but you should not use ==
with string in Java, if you don't want to go with .isEmpty
you should use .equals
if ((this.service == null || this.service == "") && initConfig != null) { | ||
this.service = (String) initConfig.get("service"); | ||
} | ||
if (this.service != null && this.service != "") { |
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.
this.service != null && !this.service.isEmpty()
@@ -667,6 +676,10 @@ private void refreshBeansList() throws IOException { | |||
} | |||
tags.add("instance:" + this.instanceName); | |||
|
|||
if (this.service != null && this.service != "") { |
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.
this.service != null && !this.service.isEmpty()
We want to feature the notion of service more prominently for integrations so that we can correlate metrics with logs and traces
See:
DataDog/datadog-agent#4877
DataDog/datadog-agent#4895