mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1345 - Refactor io.ebean.meta.MetaInfoManager API (query execution metrics). Breaking change for people collecting query execution metrics.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package io.ebeaninternal.server.profile;
|
||||
|
||||
import io.ebean.meta.MetaQueryMetric;
|
||||
import io.ebeaninternal.metric.QueryPlanCollector;
|
||||
import io.ebean.meta.MetricType;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebeaninternal.metric.QueryPlanMetric;
|
||||
import io.ebeaninternal.metric.TimedMetric;
|
||||
import io.ebeaninternal.metric.TimedMetricStats;
|
||||
@@ -9,18 +10,18 @@ import io.ebeaninternal.metric.TimedMetricStats;
|
||||
class DQueryPlanMetric implements QueryPlanMetric {
|
||||
|
||||
private final DQueryPlanMeta meta;
|
||||
private final TimedMetric metric;
|
||||
private final DTimedMetric metric;
|
||||
|
||||
DQueryPlanMetric(DQueryPlanMeta meta, TimedMetric metric) {
|
||||
DQueryPlanMetric(DQueryPlanMeta meta, DTimedMetric metric) {
|
||||
this.meta = meta;
|
||||
this.metric = metric;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collect(QueryPlanCollector collector) {
|
||||
TimedMetricStats stats = metric.collect(collector.isReset());
|
||||
public void visit(MetricVisitor visitor) {
|
||||
TimedMetricStats stats = metric.collect(visitor.isReset());
|
||||
if (stats != null) {
|
||||
collector.add(new Stats(meta, stats));
|
||||
visitor.visitQuery(new Stats(meta, stats));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +45,11 @@ class DQueryPlanMetric implements QueryPlanMetric {
|
||||
return meta + " " + stats + " sql:" + getSql();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetricType getMetricType() {
|
||||
return stats.getMetricType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return meta.getType();
|
||||
|
||||
Reference in New Issue
Block a user