diff --git a/uristat/uristat-web/pom.xml b/uristat/uristat-web/pom.xml
index ffa0e61cf85a..f14251019da8 100644
--- a/uristat/uristat-web/pom.xml
+++ b/uristat/uristat-web/pom.xml
@@ -27,6 +27,10 @@
com.navercorp.pinpoint
pinpoint-uristat-common
+
+ org.mapstruct
+ mapstruct
+
@@ -34,4 +38,23 @@
${env.JAVA_17_HOME}
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${mapstruct.version}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/UriStatWebConfig.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/UriStatWebConfig.java
index 612fb6e474ba..1b142a88e3c9 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/UriStatWebConfig.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/UriStatWebConfig.java
@@ -4,6 +4,10 @@
import com.navercorp.pinpoint.pinot.config.PinotConfiguration;
import com.navercorp.pinpoint.uristat.web.config.UriStatChartTypeConfiguration;
import com.navercorp.pinpoint.uristat.web.config.UriStatPinotDaoConfiguration;
+import com.navercorp.pinpoint.uristat.web.mapper.EntityToModelMapper;
+import com.navercorp.pinpoint.uristat.web.mapper.MapperConfig;
+import org.mapstruct.factory.Mappers;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@@ -19,6 +23,7 @@
UriStatWebPropertySources.class,
UriStatChartTypeConfiguration.class,
UriStatPinotDaoConfiguration.class,
+ MapperConfig.class,
PinotConfiguration.class
})
@Profile("uri")
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriRegistryHandler.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriRegistryHandler.java
index fc2439fde084..7007dd40ddb8 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriRegistryHandler.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriRegistryHandler.java
@@ -1,6 +1,12 @@
package com.navercorp.pinpoint.uristat.web.config;
import com.navercorp.pinpoint.mybatis.MyBatisRegistryHandler;
+import com.navercorp.pinpoint.uristat.web.entity.ApdexChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.ChartCommonEntity;
+import com.navercorp.pinpoint.uristat.web.entity.FailureChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.LatencyChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.TotalChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.UriStatSummaryEntity;
import com.navercorp.pinpoint.uristat.web.model.UriStatChartValue;
import com.navercorp.pinpoint.uristat.web.model.UriStatSummary;
import com.navercorp.pinpoint.uristat.web.util.UriStatChartQueryParameter;
@@ -13,6 +19,12 @@ public class UriRegistryHandler implements MyBatisRegistryHandler {
public void registerTypeAlias(TypeAliasRegistry typeAliasRegistry) {
typeAliasRegistry.registerAlias(UriStatChartValue.class);
typeAliasRegistry.registerAlias(UriStatSummary.class);
+ typeAliasRegistry.registerAlias(ApdexChartEntity.class);
+ typeAliasRegistry.registerAlias(ChartCommonEntity.class);
+ typeAliasRegistry.registerAlias(FailureChartEntity.class);
+ typeAliasRegistry.registerAlias(LatencyChartEntity.class);
+ typeAliasRegistry.registerAlias(TotalChartEntity.class);
+ typeAliasRegistry.registerAlias(UriStatSummaryEntity.class);
typeAliasRegistry.registerAlias(UriStatSummaryQueryParameter.class);
typeAliasRegistry.registerAlias(UriStatChartQueryParameter.class);
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriStatChartTypeConfiguration.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriStatChartTypeConfiguration.java
index a13f629fb2ea..fe048cfbac7d 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriStatChartTypeConfiguration.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/config/UriStatChartTypeConfiguration.java
@@ -35,12 +35,10 @@ public class UriStatChartTypeConfiguration {
);
@Bean
- public UriStatChartType uriStatApdexChart(@Qualifier("pinotApdexChartDao") UriStatChartDao chartDao) {
- List field = List.of("apdex");
- return new DefaultUriStatChartType("apdex", field, chartDao);
+ public UriStatChartType uriStatTotalChart(@Qualifier("pinotTotalCountChartDao") UriStatChartDao chartDao) {
+ return new DefaultUriStatChartType("total", HISTOGRAM_FIELD, chartDao);
}
-
@Bean
public UriStatChartType uriStatFailureChart(@Qualifier("pinotFailureCountChartDao") UriStatChartDao chartDao) {
return new DefaultUriStatChartType("failure", HISTOGRAM_FIELD, chartDao);
@@ -52,10 +50,10 @@ public UriStatChartType uriStatLatencyChart(@Qualifier("pinotLatencyChartDao") U
return new DefaultUriStatChartType("latency", field, chartDao);
}
-
@Bean
- public UriStatChartType uriStatTotalChart(@Qualifier("pinotTotalCountChartDao") UriStatChartDao chartDao) {
- return new DefaultUriStatChartType("total", HISTOGRAM_FIELD, chartDao);
+ public UriStatChartType uriStatApdexChart(@Qualifier("pinotApdexChartDao") UriStatChartDao chartDao) {
+ List field = List.of("apdex");
+ return new DefaultUriStatChartType("apdex", field, chartDao);
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/controller/UriStatController.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/controller/UriStatController.java
index a3d9e8ba9c40..265ae411c90f 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/controller/UriStatController.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/controller/UriStatController.java
@@ -70,7 +70,7 @@ private Range checkTimeRange(long from, long to) {
return range;
}
- @GetMapping("summary")
+ @GetMapping("/summary")
public List getUriStatPagedSummary(
@RequestParam("applicationName") String applicationName,
@RequestParam(value = "agentId", required = false) String agentId,
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotApdexChartDao.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotApdexChartDao.java
index fa0d39704f24..f54df7ef4d59 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotApdexChartDao.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotApdexChartDao.java
@@ -1,5 +1,7 @@
package com.navercorp.pinpoint.uristat.web.dao;
+import com.navercorp.pinpoint.uristat.web.entity.ApdexChartEntity;
+import com.navercorp.pinpoint.uristat.web.mapper.EntityToModelMapper;
import com.navercorp.pinpoint.uristat.web.model.UriStatChartValue;
import com.navercorp.pinpoint.uristat.web.util.UriStatChartQueryParameter;
import org.mybatis.spring.SqlSessionTemplate;
@@ -15,13 +17,21 @@ public class PinotApdexChartDao implements UriStatChartDao {
private static final String SELECT_APDEX_CHART = "selectUriApdex";
private final SqlSessionTemplate sqlPinotSessionTemplate;
+ private final EntityToModelMapper mapper;
- public PinotApdexChartDao(@Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate) {
+ public PinotApdexChartDao(
+ @Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate,
+ EntityToModelMapper mapper
+ ) {
this.sqlPinotSessionTemplate = Objects.requireNonNull(sqlPinotSessionTemplate, "sqlPinotSessionTemplate");
+ this.mapper = Objects.requireNonNull(mapper, "mapper");
}
@Override
public List getChartData(UriStatChartQueryParameter queryParameter) {
- return sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_APDEX_CHART, queryParameter);
+ List entities = sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_APDEX_CHART, queryParameter);
+ return entities.stream()
+ .map(mapper::toModel
+ ).toList();
}
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotFailureCountChartDao.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotFailureCountChartDao.java
index 4f894e0eff0d..0404d58e1b3b 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotFailureCountChartDao.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotFailureCountChartDao.java
@@ -1,5 +1,7 @@
package com.navercorp.pinpoint.uristat.web.dao;
+import com.navercorp.pinpoint.uristat.web.entity.FailureChartEntity;
+import com.navercorp.pinpoint.uristat.web.mapper.EntityToModelMapper;
import com.navercorp.pinpoint.uristat.web.model.UriStatChartValue;
import com.navercorp.pinpoint.uristat.web.util.UriStatChartQueryParameter;
import org.mybatis.spring.SqlSessionTemplate;
@@ -15,13 +17,21 @@ public class PinotFailureCountChartDao implements UriStatChartDao {
private static final String SELECT_FAILURE_CHART = "selectFailedUriStat";
private final SqlSessionTemplate sqlPinotSessionTemplate;
+ private final EntityToModelMapper mapper;
- public PinotFailureCountChartDao(@Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate) {
+ public PinotFailureCountChartDao(
+ @Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate,
+ EntityToModelMapper mapper
+ ) {
this.sqlPinotSessionTemplate = Objects.requireNonNull(sqlPinotSessionTemplate, "sqlPinotSessionTemplate");
+ this.mapper = Objects.requireNonNull(mapper, "mapper");
}
@Override
public List getChartData(UriStatChartQueryParameter queryParameter) {
- return sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_FAILURE_CHART, queryParameter);
+ List entities = sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_FAILURE_CHART, queryParameter);
+ return entities.stream()
+ .map(mapper::toModel
+ ).toList();
}
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotLatencyChartDao.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotLatencyChartDao.java
index e984de13b082..5290954f1349 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotLatencyChartDao.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotLatencyChartDao.java
@@ -1,5 +1,7 @@
package com.navercorp.pinpoint.uristat.web.dao;
+import com.navercorp.pinpoint.uristat.web.entity.LatencyChartEntity;
+import com.navercorp.pinpoint.uristat.web.mapper.EntityToModelMapper;
import com.navercorp.pinpoint.uristat.web.model.UriStatChartValue;
import com.navercorp.pinpoint.uristat.web.util.UriStatChartQueryParameter;
import org.mybatis.spring.SqlSessionTemplate;
@@ -15,14 +17,22 @@ public class PinotLatencyChartDao implements UriStatChartDao {
private static final String SELECT_LATENCY_CHART = "selectUriLatency";
private final SqlSessionTemplate sqlPinotSessionTemplate;
+ private final EntityToModelMapper mapper;
- public PinotLatencyChartDao(@Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate) {
+ public PinotLatencyChartDao(
+ @Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate,
+ EntityToModelMapper mapper
+ ) {
this.sqlPinotSessionTemplate = Objects.requireNonNull(sqlPinotSessionTemplate, "sqlPinotSessionTemplate");
+ this.mapper = Objects.requireNonNull(mapper, "mapper");
}
@Override
public List getChartData(UriStatChartQueryParameter queryParameter) {
- return sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_LATENCY_CHART, queryParameter);
+ List entities = sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_LATENCY_CHART, queryParameter);
+ return entities.stream()
+ .map(mapper::toModel
+ ).toList();
}
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotTotalCountChartDao.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotTotalCountChartDao.java
index e3f28ecefb8c..b88ff204efcc 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotTotalCountChartDao.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotTotalCountChartDao.java
@@ -1,5 +1,7 @@
package com.navercorp.pinpoint.uristat.web.dao;
+import com.navercorp.pinpoint.uristat.web.entity.TotalChartEntity;
+import com.navercorp.pinpoint.uristat.web.mapper.EntityToModelMapper;
import com.navercorp.pinpoint.uristat.web.model.UriStatChartValue;
import com.navercorp.pinpoint.uristat.web.util.UriStatChartQueryParameter;
import org.mybatis.spring.SqlSessionTemplate;
@@ -15,13 +17,22 @@ public class PinotTotalCountChartDao implements UriStatChartDao {
private static final String SELECT_TOTAL_CHART = "selectTotalUriStat";
private final SqlSessionTemplate sqlPinotSessionTemplate;
+ private final EntityToModelMapper mapper;
- public PinotTotalCountChartDao(@Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate) {
+
+ public PinotTotalCountChartDao(
+ @Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate,
+ EntityToModelMapper mapper
+ ) {
this.sqlPinotSessionTemplate = Objects.requireNonNull(sqlPinotSessionTemplate, "sqlPinotSessionTemplate");
+ this.mapper = Objects.requireNonNull(mapper, "mapper");
}
@Override
public List getChartData(UriStatChartQueryParameter queryParameter) {
- return sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_TOTAL_CHART, queryParameter);
+ List entities = sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_TOTAL_CHART, queryParameter);
+ return entities.stream()
+ .map(mapper::toModel
+ ).toList();
}
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotUriStatSummaryDao.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotUriStatSummaryDao.java
index 80c4e9b2b924..3b84a76989d1 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotUriStatSummaryDao.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/dao/PinotUriStatSummaryDao.java
@@ -16,6 +16,8 @@
package com.navercorp.pinpoint.uristat.web.dao;
+import com.navercorp.pinpoint.uristat.web.entity.UriStatSummaryEntity;
+import com.navercorp.pinpoint.uristat.web.mapper.EntityToModelMapper;
import com.navercorp.pinpoint.uristat.web.model.UriStatSummary;
import com.navercorp.pinpoint.uristat.web.util.UriStatSummaryQueryParameter;
import org.apache.logging.log4j.LogManager;
@@ -34,14 +36,22 @@ public class PinotUriStatSummaryDao implements UriStatSummaryDao {
private static final String NAMESPACE = PinotUriStatSummaryDao.class.getName() + ".";
private static final String SELECT_URI_STAT_SUMMARY = "uriStatSummary";
private final SqlSessionTemplate sqlPinotSessionTemplate;
+ private final EntityToModelMapper mapper;
- public PinotUriStatSummaryDao(@Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate) {
+ public PinotUriStatSummaryDao(
+ @Qualifier("uriStatPinotSessionTemplate") SqlSessionTemplate sqlPinotSessionTemplate,
+ EntityToModelMapper mapper
+ ) {
this.sqlPinotSessionTemplate = Objects.requireNonNull(sqlPinotSessionTemplate, "sqlPinotSessionTemplate");
+ this.mapper = Objects.requireNonNull(mapper, "mapper");
}
@Override
public List getUriStatPagedSummary(UriStatSummaryQueryParameter queryParameter) {
- return sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_URI_STAT_SUMMARY, queryParameter);
+ List entities = sqlPinotSessionTemplate.selectList(NAMESPACE + SELECT_URI_STAT_SUMMARY, queryParameter);
+ return entities.stream()
+ .map(mapper::toModel
+ ).toList();
}
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/ApdexChartEntity.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/ApdexChartEntity.java
new file mode 100644
index 000000000000..ee4fe31fdf20
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/ApdexChartEntity.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.entity;
+
+/**
+ * @author intr3p1d
+ */
+public class ApdexChartEntity extends ChartCommonEntity {
+ private Double apdexRaw;
+ private Double count;
+
+ public ApdexChartEntity() {
+ }
+
+ public Double getApdexRaw() {
+ return apdexRaw;
+ }
+
+ public void setApdexRaw(Double apdexRaw) {
+ this.apdexRaw = apdexRaw;
+ }
+
+ public Double getCount() {
+ return count;
+ }
+
+ public void setCount(Double count) {
+ this.count = count;
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/ChartCommonEntity.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/ChartCommonEntity.java
new file mode 100644
index 000000000000..cba88217e3ed
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/ChartCommonEntity.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.entity;
+
+/**
+ * @author intr3p1d
+ */
+public class ChartCommonEntity {
+
+ private long timestamp;
+ private String version;
+
+ public ChartCommonEntity() {
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/FailureChartEntity.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/FailureChartEntity.java
new file mode 100644
index 000000000000..a2172a01e62b
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/FailureChartEntity.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.entity;
+
+/**
+ * @author intr3p1d
+ */
+public class FailureChartEntity extends ChartCommonEntity {
+ private Double fail0;
+ private Double fail1;
+ private Double fail2;
+ private Double fail3;
+ private Double fail4;
+ private Double fail5;
+ private Double fail6;
+ private Double fail7;
+
+ public FailureChartEntity() {
+ }
+
+ public Double getFail0() {
+ return fail0;
+ }
+
+ public void setFail0(Double fail0) {
+ this.fail0 = fail0;
+ }
+
+ public Double getFail1() {
+ return fail1;
+ }
+
+ public void setFail1(Double fail1) {
+ this.fail1 = fail1;
+ }
+
+ public Double getFail2() {
+ return fail2;
+ }
+
+ public void setFail2(Double fail2) {
+ this.fail2 = fail2;
+ }
+
+ public Double getFail3() {
+ return fail3;
+ }
+
+ public void setFail3(Double fail3) {
+ this.fail3 = fail3;
+ }
+
+ public Double getFail4() {
+ return fail4;
+ }
+
+ public void setFail4(Double fail4) {
+ this.fail4 = fail4;
+ }
+
+ public Double getFail5() {
+ return fail5;
+ }
+
+ public void setFail5(Double fail5) {
+ this.fail5 = fail5;
+ }
+
+ public Double getFail6() {
+ return fail6;
+ }
+
+ public void setFail6(Double fail6) {
+ this.fail6 = fail6;
+ }
+
+ public Double getFail7() {
+ return fail7;
+ }
+
+ public void setFail7(Double fail7) {
+ this.fail7 = fail7;
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/LatencyChartEntity.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/LatencyChartEntity.java
new file mode 100644
index 000000000000..ff7f271614fc
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/LatencyChartEntity.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.entity;
+
+/**
+ * @author intr3p1d
+ */
+public class LatencyChartEntity extends ChartCommonEntity {
+ private Double totalTimeMs;
+ private Double maxLatencyMs;
+ private Double count;
+
+ public LatencyChartEntity() {
+ }
+
+ public Double getTotalTimeMs() {
+ return totalTimeMs;
+ }
+
+ public void setTotalTimeMs(Double totalTimeMs) {
+ this.totalTimeMs = totalTimeMs;
+ }
+
+ public Double getMaxLatencyMs() {
+ return maxLatencyMs;
+ }
+
+ public void setMaxLatencyMs(Double maxLatencyMs) {
+ this.maxLatencyMs = maxLatencyMs;
+ }
+
+ public Double getCount() {
+ return count;
+ }
+
+ public void setCount(Double count) {
+ this.count = count;
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/TotalChartEntity.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/TotalChartEntity.java
new file mode 100644
index 000000000000..cd5a49eec676
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/TotalChartEntity.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.entity;
+
+/**
+ * @author intr3p1d
+ */
+public class TotalChartEntity extends ChartCommonEntity {
+
+ private Double tot0;
+ private Double tot1;
+ private Double tot2;
+ private Double tot3;
+ private Double tot4;
+ private Double tot5;
+ private Double tot6;
+ private Double tot7;
+
+ public TotalChartEntity() {
+ }
+
+ public Double getTot0() {
+ return tot0;
+ }
+
+ public void setTot0(Double tot0) {
+ this.tot0 = tot0;
+ }
+
+ public Double getTot1() {
+ return tot1;
+ }
+
+ public void setTot1(Double tot1) {
+ this.tot1 = tot1;
+ }
+
+ public Double getTot2() {
+ return tot2;
+ }
+
+ public void setTot2(Double tot2) {
+ this.tot2 = tot2;
+ }
+
+ public Double getTot3() {
+ return tot3;
+ }
+
+ public void setTot3(Double tot3) {
+ this.tot3 = tot3;
+ }
+
+ public Double getTot4() {
+ return tot4;
+ }
+
+ public void setTot4(Double tot4) {
+ this.tot4 = tot4;
+ }
+
+ public Double getTot5() {
+ return tot5;
+ }
+
+ public void setTot5(Double tot5) {
+ this.tot5 = tot5;
+ }
+
+ public Double getTot6() {
+ return tot6;
+ }
+
+ public void setTot6(Double tot6) {
+ this.tot6 = tot6;
+ }
+
+ public Double getTot7() {
+ return tot7;
+ }
+
+ public void setTot7(Double tot7) {
+ this.tot7 = tot7;
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/UriStatSummaryEntity.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/UriStatSummaryEntity.java
new file mode 100644
index 000000000000..af97a54e249a
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/entity/UriStatSummaryEntity.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.entity;
+
+/**
+ * @author intr3p1d
+ */
+public class UriStatSummaryEntity {
+ private String uri;
+ private Double apdexRaw;
+ private Double totalCount;
+ private Double failureCount;
+ private Double maxTimeMs;
+ private Double totalTimeMs;
+ private String version;
+
+ public UriStatSummaryEntity() {
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public Double getApdexRaw() {
+ return apdexRaw;
+ }
+
+ public void setApdexRaw(Double apdexRaw) {
+ this.apdexRaw = apdexRaw;
+ }
+
+ public Double getTotalCount() {
+ return totalCount;
+ }
+
+ public void setTotalCount(Double totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ public Double getFailureCount() {
+ return failureCount;
+ }
+
+ public void setFailureCount(Double failureCount) {
+ this.failureCount = failureCount;
+ }
+
+ public Double getMaxTimeMs() {
+ return maxTimeMs;
+ }
+
+ public void setMaxTimeMs(Double maxTimeMs) {
+ this.maxTimeMs = maxTimeMs;
+ }
+
+ public Double getTotalTimeMs() {
+ return totalTimeMs;
+ }
+
+ public void setTotalTimeMs(Double totalTimeMs) {
+ this.totalTimeMs = totalTimeMs;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/mapper/EntityToModelMapper.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/mapper/EntityToModelMapper.java
new file mode 100644
index 000000000000..f4a2f5ea85c3
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/mapper/EntityToModelMapper.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.mapper;
+
+import com.google.common.primitives.Doubles;
+import com.navercorp.pinpoint.common.server.mapper.MapStructUtils;
+import com.navercorp.pinpoint.common.util.MathUtils;
+import com.navercorp.pinpoint.uristat.web.entity.ApdexChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.FailureChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.LatencyChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.TotalChartEntity;
+import com.navercorp.pinpoint.uristat.web.entity.UriStatSummaryEntity;
+import com.navercorp.pinpoint.uristat.web.model.UriStatChartValue;
+import com.navercorp.pinpoint.uristat.web.model.UriStatSummary;
+import org.mapstruct.CollectionMappingStrategy;
+import org.mapstruct.InjectionStrategy;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.Named;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.List;
+
+/**
+ * @author intr3p1d
+ */
+@Mapper(
+ injectionStrategy = InjectionStrategy.CONSTRUCTOR,
+ collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED
+)
+public interface EntityToModelMapper {
+
+ @Mapping(target = "apdex", source = "entity", qualifiedByName = "toApdex")
+ @Mapping(target = "avgTimeMs", source = "entity", qualifiedByName = "toAvgTimeMs")
+ UriStatSummary toModel(UriStatSummaryEntity entity);
+
+ @Named("toApdex")
+ default Double toApdex(UriStatSummaryEntity entity) {
+ return MathUtils.average(entity.getApdexRaw(), entity.getTotalCount());
+ }
+
+ @Named("toAvgTimeMs")
+ default Double toAvgTimeMs(UriStatSummaryEntity entity) {
+ return MathUtils.average(entity.getTotalTimeMs(), entity.getTotalCount());
+ }
+
+ @Retention(RetentionPolicy.CLASS)
+ @Mapping(target = "timestamp", source = "timestamp")
+ @Mapping(target = "version", source = "version")
+ public @interface ToChartValue {
+ }
+
+ @ToChartValue
+ @Mapping(target = "chartType", constant = "bar")
+ @Mapping(target = "unit", constant = "count")
+ @Mapping(target = "values", source = "entity", qualifiedByName = "toTotalHistogram")
+ UriStatChartValue toModel(TotalChartEntity entity);
+
+ @ToChartValue
+ @Mapping(target = "chartType", constant = "bar")
+ @Mapping(target = "unit", constant = "count")
+ @Mapping(target = "values", source = "entity", qualifiedByName = "toFailureHistogram")
+ UriStatChartValue toModel(FailureChartEntity entity);
+
+ @ToChartValue
+ @Mapping(target = "chartType", constant = "line")
+ @Mapping(target = "unit", constant = "ms")
+ @Mapping(target = "values", source = "entity", qualifiedByName = "toLatency")
+ UriStatChartValue toModel(LatencyChartEntity entity);
+
+
+ @ToChartValue
+ @Mapping(target = "chartType", constant = "line")
+ @Mapping(target = "unit", constant = "")
+ @Mapping(target = "values", source = "entity", qualifiedByName = "toApdexList")
+ UriStatChartValue toModel(ApdexChartEntity entity);
+
+ @Named("toTotalHistogram")
+ default List toTotalHistogram(TotalChartEntity entity) {
+ return toHistogram(
+ entity.getTot0(), entity.getTot1(), entity.getTot2(), entity.getTot3(),
+ entity.getTot4(), entity.getTot5(), entity.getTot6(), entity.getTot7()
+ );
+ }
+
+ @Named("toFailureHistogram")
+ default List toFailureHistogram(FailureChartEntity entity) {
+ return toHistogram(
+ entity.getFail0(), entity.getFail1(), entity.getFail2(), entity.getFail3(),
+ entity.getFail4(), entity.getFail5(), entity.getFail6(), entity.getFail7()
+ );
+ }
+
+ default List toHistogram(
+ Double hist0, Double hist1, Double hist2, Double hist3,
+ Double hist4, Double hist5, Double hist6, Double hist7
+ ) {
+ return Doubles.asList(hist0, hist1, hist2, hist3, hist4, hist5, hist6, hist7);
+ }
+
+ @Named("toLatency")
+ default List toLatency(LatencyChartEntity entity) {
+ return Doubles.asList((entity.getCount() == 0) ? -1 : (entity.getTotalTimeMs() / entity.getCount()), entity.getMaxLatencyMs());
+ }
+
+ @Named("toApdexList")
+ default List toApdexList(ApdexChartEntity entity) {
+ return Doubles.asList((entity.getCount() == 0) ? -1 : (entity.getApdexRaw() / entity.getCount()));
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/mapper/MapperConfig.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/mapper/MapperConfig.java
new file mode 100644
index 000000000000..5ea6e478ec4d
--- /dev/null
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/mapper/MapperConfig.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2024 NAVER Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.navercorp.pinpoint.uristat.web.mapper;
+
+import org.mapstruct.factory.Mappers;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author intr3p1d
+ */
+@Configuration
+public class MapperConfig {
+
+ @Bean
+ EntityToModelMapper entityToModelMapper() {
+ return Mappers.getMapper(EntityToModelMapper.class);
+ }
+}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatChartValue.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatChartValue.java
index c6f248ccf738..9f3f55465a43 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatChartValue.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatChartValue.java
@@ -6,55 +6,52 @@
import java.util.List;
public class UriStatChartValue {
- private final long timestamp;
- private final List values;
- private final String version;
- private final TimeseriesChartType chartType;
- private final String unit;
-
- public UriStatChartValue(long timestamp, Double hist0, Double hist1, Double hist2, Double hist3,
- Double hist4, Double hist5, Double hist6, Double hist7, String version) {
- this.timestamp = timestamp;
- this.values = Doubles.asList(hist0, hist1, hist2, hist3, hist4, hist5, hist6, hist7);
- this.version = version;
- this.chartType = TimeseriesChartType.bar;
- this.unit = "count";
- }
+ private long timestamp;
+ private List values;
+ private String version;
+ private TimeseriesChartType chartType;
+ private String unit;
- public UriStatChartValue(long timestamp, Double apdexRaw, Double count, String version) {
- Double apdex = (count == 0)? -1: (apdexRaw / count);
- this.timestamp = timestamp;
- this.values = Doubles.asList(apdex);
- this.version = version;
- this.chartType = TimeseriesChartType.line;
- this.unit = "";
+ public UriStatChartValue() {
}
- public UriStatChartValue(long timestamp, Double totalTime, Double maxTime, Double count, String version) {
- Double avgTime = (count == 0)? -1: (totalTime / count);
- this.timestamp = timestamp;
- this.values = Doubles.asList(avgTime, maxTime);
- this.version = version;
- this.chartType = TimeseriesChartType.line;
- this.unit = "ms";
- }
public long getTimestamp() {
return timestamp;
}
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
public List getValues() {
return values;
}
+ public void setValues(List values) {
+ this.values = values;
+ }
+
public String getVersion() {
return version;
}
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
public TimeseriesChartType getChartType() {
return chartType;
}
+ public void setChartType(TimeseriesChartType chartType) {
+ this.chartType = chartType;
+ }
+
public String getUnit() {
return unit;
}
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
}
diff --git a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatSummary.java b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatSummary.java
index b6e6f006cfd0..7f883dbcb37d 100644
--- a/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatSummary.java
+++ b/uristat/uristat-web/src/main/java/com/navercorp/pinpoint/uristat/web/model/UriStatSummary.java
@@ -19,49 +19,70 @@
import com.navercorp.pinpoint.common.util.MathUtils;
public class UriStatSummary {
- private final String uri;
- private final double totalCount;
- private final double failureCount;
- private final double maxTimeMs;
- private final double avgTimeMs;
- private final double apdex;
- private final String version;
-
- public UriStatSummary(String uri, double apdexRaw, double totalCount, double failureCount, double maxTimeMs, double totalTimeMs, String version) {
- this.uri = uri;
- this.apdex = MathUtils.average(apdexRaw, totalCount);
- this.totalCount = totalCount;
- this.failureCount = failureCount;
- this.maxTimeMs = maxTimeMs;
- this.avgTimeMs = MathUtils.average(totalTimeMs, totalCount);
- this.version = version;
+ private String uri;
+ private Double totalCount;
+ private Double failureCount;
+ private Double maxTimeMs;
+ private Double avgTimeMs;
+ private Double apdex;
+ private String version;
+
+ public UriStatSummary() {
}
public String getUri() {
return uri;
}
- public double getApdex() {
- return apdex;
+ public void setUri(String uri) {
+ this.uri = uri;
}
- public double getTotalCount() {
+ public Double getTotalCount() {
return totalCount;
}
- public double getFailureCount() {
+ public void setTotalCount(Double totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ public Double getFailureCount() {
return failureCount;
}
- public double getMaxTimeMs() {
+ public void setFailureCount(Double failureCount) {
+ this.failureCount = failureCount;
+ }
+
+ public Double getMaxTimeMs() {
return maxTimeMs;
}
- public double getAvgTimeMs() {
+ public void setMaxTimeMs(Double maxTimeMs) {
+ this.maxTimeMs = maxTimeMs;
+ }
+
+ public Double getAvgTimeMs() {
return avgTimeMs;
}
+ public void setAvgTimeMs(Double avgTimeMs) {
+ this.avgTimeMs = avgTimeMs;
+ }
+
+ public Double getApdex() {
+ return apdex;
+ }
+
+ public void setApdex(Double apdex) {
+ this.apdex = apdex;
+ }
+
public String getVersion() {
return version;
}
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
}
diff --git a/uristat/uristat-web/src/main/resources/mapper/uristat/UriStatChartMapper.xml b/uristat/uristat-web/src/main/resources/mapper/uristat/UriStatChartMapper.xml
index 1d8c7db359bf..17556981d2be 100644
--- a/uristat/uristat-web/src/main/resources/mapper/uristat/UriStatChartMapper.xml
+++ b/uristat/uristat-web/src/main/resources/mapper/uristat/UriStatChartMapper.xml
@@ -1,53 +1,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
+
+
-