mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-28 00:05:49 +00:00
#1872 - Reporting ORM metrics defaults to suppressing sql and location after initial collection
This commit is contained in:
@@ -11,6 +11,7 @@ class DQueryPlanMetric implements QueryPlanMetric {
|
||||
|
||||
private final DQueryPlanMeta meta;
|
||||
private final DTimedMetric metric;
|
||||
private boolean collected;
|
||||
|
||||
DQueryPlanMetric(DQueryPlanMeta meta, DTimedMetric metric) {
|
||||
this.meta = meta;
|
||||
@@ -21,7 +22,8 @@ class DQueryPlanMetric implements QueryPlanMetric {
|
||||
public void visit(MetricVisitor visitor) {
|
||||
TimedMetricStats stats = metric.collect(visitor.isReset());
|
||||
if (stats != null) {
|
||||
visitor.visitQuery(new Stats(meta, stats));
|
||||
visitor.visitQuery(new Stats(meta, stats, collected));
|
||||
collected = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +36,12 @@ class DQueryPlanMetric implements QueryPlanMetric {
|
||||
|
||||
private final DQueryPlanMeta meta;
|
||||
private final TimedMetricStats stats;
|
||||
private final boolean collected;
|
||||
|
||||
private Stats(DQueryPlanMeta meta, TimedMetricStats stats) {
|
||||
private Stats(DQueryPlanMeta meta, TimedMetricStats stats, boolean collected) {
|
||||
this.meta = meta;
|
||||
this.stats = stats;
|
||||
this.collected = collected;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,6 +59,11 @@ class DQueryPlanMetric implements QueryPlanMetric {
|
||||
return meta.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initialCollection() {
|
||||
return !collected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHash() {
|
||||
return meta.getHash();
|
||||
|
||||
Reference in New Issue
Block a user