mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1877 - Adjust metric names add "orm." prefix for orm queries, "dto." for dto queries
This commit is contained in:
@@ -17,7 +17,7 @@ class DQueryPlanMeta {
|
||||
this.label = label;
|
||||
this.profileLocation = profileLocation;
|
||||
this.sql = sql;
|
||||
String name = type.getSimpleName();
|
||||
String name = "dto." + type.getSimpleName();
|
||||
if (label != null) {
|
||||
name += "_" + label;
|
||||
}
|
||||
@@ -63,6 +63,6 @@ class DQueryPlanMeta {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "type:" + type + " label:" + label;
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.ebeaninternal.server.query;
|
||||
|
||||
import io.ebean.ProfileLocation;
|
||||
import io.ebean.bean.ObjectGraphNode;
|
||||
import io.ebean.config.ServerConfig;
|
||||
import io.ebean.config.dbplatform.SqlLimitResponse;
|
||||
import io.ebean.meta.MetricType;
|
||||
@@ -159,12 +158,12 @@ public class CQueryPlan {
|
||||
|
||||
private String deriveName(String label, SpiQuery.Type type) {
|
||||
if (label == null) {
|
||||
return beanType.getSimpleName() + "." + type.label();
|
||||
return "orm." + beanType.getSimpleName() + "." + type.label();
|
||||
}
|
||||
if (label.startsWith(beanType.getSimpleName())) {
|
||||
return label;
|
||||
return "orm." + label;
|
||||
}
|
||||
return beanType.getSimpleName() + "_" + label;
|
||||
return "orm." + beanType.getSimpleName() + "_" + label;
|
||||
}
|
||||
|
||||
private CQueryBindCapture initBindCapture(ServerConfig serverConfig, SpiQuery<?> query) {
|
||||
|
||||
@@ -201,7 +201,7 @@ public class DtoQueryTest extends BaseTestCase {
|
||||
MetaQueryMetric queryMetric = stats.get(0);
|
||||
assertThat(queryMetric.getLabel()).isEqualTo("basic");
|
||||
assertThat(queryMetric.getCount()).isEqualTo(3);
|
||||
assertThat(queryMetric.getName()).isEqualTo("DCust_basic");
|
||||
assertThat(queryMetric.getName()).isEqualTo("dto.DCust_basic");
|
||||
|
||||
|
||||
server().findDto(DCust.class, "select c4.id, c4.name from o_customer c4 where lower(c4.name) = :name")
|
||||
|
||||
@@ -127,7 +127,7 @@ public class NamedDtoQueryTest extends BaseTestCase {
|
||||
MetaQueryMetric queryMetric = stats.get(0);
|
||||
assertThat(queryMetric.getLabel()).isEqualTo("basic");
|
||||
assertThat(queryMetric.getCount()).isEqualTo(3);
|
||||
assertThat(queryMetric.getName()).isEqualTo("DCust_basic");
|
||||
assertThat(queryMetric.getName()).isEqualTo("dto.DCust_basic");
|
||||
|
||||
|
||||
server().createNamedDtoQuery(DCust.class, "findByName_c4")
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TestCustomerFinder extends BaseTestCase {
|
||||
String json0 = buffer0.toString();
|
||||
System.out.println(json0);
|
||||
assertThat(json0).contains("\"name\":\"txn.main\"");
|
||||
assertThat(json0).contains("\"name\":\"Customer.findList\"");
|
||||
assertThat(json0).contains("\"name\":\"orm.Customer.findList\"");
|
||||
//assertThat(json0).contains("\"sql\":\"select t0.id, t0.status, t0.name");
|
||||
|
||||
runQueries();
|
||||
@@ -52,7 +52,7 @@ public class TestCustomerFinder extends BaseTestCase {
|
||||
String json1 = buffer1.toString();
|
||||
System.out.println(json1);
|
||||
assertThat(json1).contains("\"name\":\"txn.main\"");
|
||||
assertThat(json1).contains("\"name\":\"Customer.findList\"");
|
||||
assertThat(json1).contains("\"name\":\"orm.Customer.findList\"");
|
||||
assertThat(json1).doesNotContain("\"sql\":\"select t0.id, t0.status, t0.name");
|
||||
|
||||
}
|
||||
@@ -214,9 +214,9 @@ public class TestCustomerFinder extends BaseTestCase {
|
||||
.json();
|
||||
|
||||
assertThat(metricsJson).contains("\"name\":\"txn.main\", \"type\":\"TXN\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"Customer.findList\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"orm.Customer.findList\"");
|
||||
assertThat(metricsJson).contains("\"loc\":\"CustomerFinder.byNameStatus(CustomerFinder.java:44)\"");
|
||||
assertThat(metricsJson).contains("\"hash\":\"f089744556e1677b57c7c6ef73f65da8\"");
|
||||
assertThat(metricsJson).contains("\"hash\":\"cc20eb930403cfd418db2d0475c6e26a\"");
|
||||
assertThat(metricsJson).contains("\"sql\":\"select t0.id, t0.status,");
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public class TestCustomerFinder extends BaseTestCase {
|
||||
.json();
|
||||
|
||||
assertThat(metricsJson).contains("\"name\":\"txn.main\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"Customer.findList\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"orm.Customer.findList\"");
|
||||
assertThat(metricsJson).doesNotContain("\"loc\":");
|
||||
assertThat(metricsJson).doesNotContain("\"hash\":");
|
||||
assertThat(metricsJson).doesNotContain("\"sql\":");
|
||||
@@ -258,7 +258,7 @@ public class TestCustomerFinder extends BaseTestCase {
|
||||
|
||||
String metricsJson = buffer.toString();
|
||||
assertThat(metricsJson).contains("\"name\":\"txn.main\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"Customer.findList\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"orm.Customer.findList\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -277,7 +277,7 @@ public class TestCustomerFinder extends BaseTestCase {
|
||||
String metricsJson = buffer.toString();
|
||||
assertThat(metricsJson).contains(" \"metrics\":[");
|
||||
assertThat(metricsJson).contains("\"name\":\"txn.main\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"Customer.findList\"");
|
||||
assertThat(metricsJson).contains("\"name\":\"orm.Customer.findList\"");
|
||||
}
|
||||
|
||||
private void runQueries() {
|
||||
|
||||
Reference in New Issue
Block a user