Skip to content

Commit

Permalink
add call to action
Browse files Browse the repository at this point in the history
  • Loading branch information
rayz committed Oct 12, 2023
1 parent c4b6ebd commit 4cb8a13
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main/java/org/datadog/jmxfetch/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,7 @@ public void init(final boolean forceNewConnection) {
this.brokenInstanceMap.clear();

final List<Instance> newInstances = new ArrayList<>();
// used to track instance names already seen
Set<String> instanceNames = new HashSet<String>();
Set<String> instanceNamesSeen = new HashSet<String>();

log.info("Dealing with YAML config instances...");
final Iterator<Entry<String, YamlParser>> it = this.configs.entrySet().iterator();
Expand Down Expand Up @@ -873,10 +872,10 @@ public void init(final boolean forceNewConnection) {
}
final String instanceName = (String) configInstance.get("name");
if (instanceName != null) {
if (instanceNames.contains(instanceName)) {
log.warn("Instance with name: {} already exists", instanceName);
if (instanceNamesSeen.contains(instanceName)) {
log.warn("Found multiple instances with name: '{}'. Instance names should be unique, update the 'name' field on your instances to be unique.", instanceName);
}
instanceNames.add(instanceName);
instanceNamesSeen.add(instanceName);
}
// Create a new Instance object
log.info("Instantiating instance for: {}", name);
Expand Down Expand Up @@ -905,10 +904,10 @@ public void init(final boolean forceNewConnection) {
log.info("Instantiating instance for: " + checkName);
final String instanceName = (String) configInstance.get("name");
if (instanceName != null) {
if (instanceNames.contains(instanceName)) {
log.warn("Instance with name: {} already exists", instanceName);
if (instanceNamesSeen.contains(instanceName)) {
log.warn("Found multiple instances with name: '{}'. Instance names should be unique, update the 'name' field on your instances to be unique.", instanceName);
}
instanceNames.add(instanceName);
instanceNamesSeen.add(instanceName);
}
final Instance instance =
instantiate(configInstance, initConfig, checkName, this.appConfig);
Expand Down

0 comments on commit 4cb8a13

Please sign in to comment.