#1672 - ENH: Add ebean.dumpMetricsOnShutdown=true ... for dumping metrics

This commit is contained in:
rob bygrave
2019-04-12 00:45:00 +12:00
parent 4f4743807c
commit 30ae435f33
15 changed files with 415 additions and 64 deletions
@@ -65,6 +65,8 @@ public class CQueryPlan {
private final String label;
private final String name;
private final CQueryPlanKey planKey;
private final boolean rawSql;
@@ -112,6 +114,7 @@ public class CQueryPlan {
SpiQuery<?> query = request.getQuery();
this.profileLocation = query.getProfileLocation();
this.label = query.getPlanLabel();
this.name = deriveName(label, query.getType());
this.location = location();
this.autoTuned = query.isAutoTuned();
this.asOfTableCount = query.getAsOfTableCount();
@@ -138,6 +141,7 @@ public class CQueryPlan {
SpiQuery<?> query = request.getQuery();
this.profileLocation = query.getProfileLocation();
this.label = query.getPlanLabel();
this.name = deriveName(label, query.getType());
this.location = location();
this.planKey = buildPlanKey(sql, rawSql, rowNumberIncluded, logWhereSql);
this.autoTuned = false;
@@ -154,6 +158,16 @@ public class CQueryPlan {
this.bindCapture = initBindCapture(server.getServerConfig(), query);
}
private String deriveName(String label, SpiQuery.Type type) {
if (label == null) {
return beanType.getSimpleName() + "." + type.label();
}
if (label.startsWith(beanType.getSimpleName())) {
return label;
}
return beanType.getSimpleName() + "_" + label;
}
private CQueryBindCapture initBindCapture(ServerConfig serverConfig, SpiQuery<?> query) {
if (serverConfig.isCollectQueryPlans() && !query.getType().isUpdate()) {
return new CQueryBindCapture(this, PlatformQueryPlan.getLogger(serverConfig.getDatabasePlatform().getPlatform()));
@@ -192,6 +206,10 @@ public class CQueryPlan {
return label;
}
public String getName() {
return name;
}
public String getLocation() {
return location;
}