mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +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 parent
eda6350d89
commit
85bfe3d03e
79 files changed
+928
-466
No files matched your search
@@ -1,6 +1,10 @@
|
||||
package io.ebeaninternal.server.persist;
|
||||
|
||||
import io.ebean.meta.MetricType;
|
||||
import io.ebean.meta.MetricVisitor;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import io.ebeaninternal.metric.MetricFactory;
|
||||
import io.ebeaninternal.metric.TimedMetricMap;
|
||||
import io.ebeaninternal.server.core.PersistRequestCallableSql;
|
||||
import io.ebeaninternal.server.core.PersistRequestOrmUpdate;
|
||||
import io.ebeaninternal.server.core.PersistRequestUpdateSql;
|
||||
@@ -24,15 +28,48 @@ final class DefaultPersistExecute implements PersistExecute {
|
||||
*/
|
||||
private final int defaultBatchSize;
|
||||
|
||||
private final TimedMetricMap ormUpdateMetric;
|
||||
|
||||
private final TimedMetricMap sqlUpdateMetric;
|
||||
|
||||
private final TimedMetricMap sqlCallMetric;
|
||||
|
||||
/**
|
||||
* Construct this DmlPersistExecute.
|
||||
*/
|
||||
DefaultPersistExecute(Binder binder, int defaultBatchSize) {
|
||||
|
||||
this.exeOrmUpdate = new ExeOrmUpdate(binder);
|
||||
this.exeUpdateSql = new ExeUpdateSql(binder);
|
||||
this.exeCallableSql = new ExeCallableSql(binder);
|
||||
this.defaultBatchSize = defaultBatchSize;
|
||||
this.ormUpdateMetric = MetricFactory.get().createTimedMetricMap(MetricType.SQL, "orm.update.");
|
||||
this.sqlUpdateMetric = MetricFactory.get().createTimedMetricMap(MetricType.SQL, "sql.update.");
|
||||
this.sqlCallMetric = MetricFactory.get().createTimedMetricMap(MetricType.SQL, "sql.call.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMetrics(MetricVisitor visitor) {
|
||||
ormUpdateMetric.visit(visitor);
|
||||
sqlUpdateMetric.visit(visitor);
|
||||
sqlCallMetric.visit(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectOrmUpdate(String label, long startNanos, int rowCount) {
|
||||
long exeMicros = (System.nanoTime() - startNanos) / 1000L;
|
||||
ormUpdateMetric.add(label, exeMicros, rowCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectSqlUpdate(String label, long startNanos, int rowCount) {
|
||||
long exeMicros = (System.nanoTime() - startNanos) / 1000L;
|
||||
sqlUpdateMetric.add(label, exeMicros, rowCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectSqlCall(String label, long startNanos, int rowCount) {
|
||||
long exeMicros = (System.nanoTime() - startNanos) / 1000L;
|
||||
sqlCallMetric.add(label, exeMicros, rowCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user