Skip to content

Commit

Permalink
bugfix rabbitmq contains duplicated metric (#1322)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 authored Nov 8, 2023
1 parent 4863b2c commit 57dc160
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,18 @@ private void verifyDefineAppContent(Job app, boolean isModify) {
Assert.isNull(appDefines.get(app.getApp().toLowerCase()),
"monitoring template name " + app.getApp() + " already exists.");
}
Set<String> fieldsSet = new HashSet<>(16);
for (Metrics metrics : app.getMetrics()) {
Assert.notEmpty(metrics.getFields(), "monitoring template metrics fields can not null");
fieldsSet.clear();
for (Metrics.Field field : metrics.getFields()) {
if (fieldsSet.contains(field.getField())) {
throw new IllegalArgumentException(app.getApp() + " " + metrics.getName() + " "
+ field.getField() + " can not duplicated.");
}
fieldsSet.add(field.getField());
}
}
}

@Override
Expand Down
2 changes: 0 additions & 2 deletions manager/src/main/resources/define/app-rabbitmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ metrics:
type: 0
- field: queue_deleted
type: 0
- field: connection_closed
type: 0
units:
- mem_limit=B->MB
- mem_used=B->MB
Expand Down

0 comments on commit 57dc160

Please sign in to comment.