Skip to content

Commit

Permalink
Add default factoryType tag for consistency in CommonsObjectPool2Metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
HYEONSEOK1 committed Jul 31, 2024
1 parent facf3ea commit b9f7ca9
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,16 @@ public void bindTo(@NonNull MeterRegistry registry) {

private Iterable<Tag> nameTag(ObjectName name, String type)
throws AttributeNotFoundException, MBeanException, ReflectionException, InstanceNotFoundException {

Tags tags = Tags.of("name", name.getKeyProperty("name"), "type", type);
String factoryType = "none"; // Default value for factoryType if not available

if (Objects.equals(type, "GenericObjectPool")) {
// for GenericObjectPool, we want to include the name and factoryType as tags
String factoryType = mBeanServer.getAttribute(name, "FactoryType").toString();
tags = Tags.concat(tags, "factoryType", factoryType);
factoryType = mBeanServer.getAttribute(name, "FactoryType").toString();
}

tags = Tags.concat(tags, "factoryType", factoryType);
return tags;
}

Expand Down

0 comments on commit b9f7ca9

Please sign in to comment.