Skip to content

Commit 80954a1

Browse files
committed
[#9603] Add uri stat modules
1 parent 4c41304 commit 80954a1

File tree

44 files changed

+394
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+394
-81
lines changed

metric-module/collector-starter/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<groupId>com.navercorp.pinpoint</groupId>
3131
<artifactId>pinpoint-metric</artifactId>
3232
</dependency>
33+
<dependency>
34+
<groupId>com.navercorp.pinpoint</groupId>
35+
<artifactId>pinpoint-uristat-collector</artifactId>
36+
</dependency>
3337
</dependencies>
3438

3539
<build>

metric-module/collector-starter/src/main/java/com/navercorp/pinpoint/collector/starter/multi/application/BasicCollectorApp.java

+2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
88
import org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration;
99
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
10+
import org.springframework.context.annotation.ComponentScan;
1011
import org.springframework.context.annotation.Import;
1112
import org.springframework.context.annotation.ImportResource;
1213

1314
@SpringBootConfiguration
1415
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, TransactionAutoConfiguration.class, SqlInitializationAutoConfiguration.class})
1516
@ImportResource({"classpath:applicationContext-collector.xml", "classpath:servlet-context-collector.xml"})
1617
@Import({CollectorAppPropertySources.class, FlinkContextConfiguration.class})
18+
@ComponentScan({"com.navercorp.pinpoint.uristat.collector.service", })
1719
public class BasicCollectorApp {
1820
}

metric-module/collector-starter/src/main/java/com/navercorp/pinpoint/collector/starter/multi/application/MultiApplication.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.navercorp.pinpoint.metric.collector.CollectorTypeParser;
1111
import com.navercorp.pinpoint.metric.collector.MetricCollectorApp;
1212
import com.navercorp.pinpoint.metric.collector.TypeSet;
13+
import com.navercorp.pinpoint.uristat.collector.UriStatCollectorConfig;
1314
import org.springframework.boot.Banner;
1415
import org.springframework.boot.SpringBootConfiguration;
1516
import org.springframework.boot.WebApplicationType;
@@ -43,20 +44,20 @@ public static void main(String[] args) {
4344

4445
if (types.hasType(CollectorType.BASIC)) {
4546
logger.info(String.format("Start %s collector", CollectorType.BASIC));
46-
SpringApplicationBuilder collectorAppBuilder = createAppBuilder(builder, BasicCollectorApp.class, 15400);
47+
SpringApplicationBuilder collectorAppBuilder = createAppBuilder(builder, 15400, BasicCollectorApp.class, UriStatCollectorConfig.class);
4748
collectorAppBuilder.build().run(args);
4849
}
4950

5051
if (types.hasType(CollectorType.METRIC)) {
5152
logger.info(String.format("Start %s collector", CollectorType.METRIC));
52-
SpringApplicationBuilder metricAppBuilder = createAppBuilder(builder, MetricCollectorApp.class, 15200);
53+
SpringApplicationBuilder metricAppBuilder = createAppBuilder(builder, 15200, MetricCollectorApp.class);
5354
metricAppBuilder.listeners(new AdditionalProfileListener("metric"));
5455
metricAppBuilder.build().run(args);
5556
}
5657
}
5758

5859

59-
private static SpringApplicationBuilder createAppBuilder(SpringApplicationBuilder builder, Class<?> appClass, int port) {
60+
private static SpringApplicationBuilder createAppBuilder(SpringApplicationBuilder builder, int port, Class<?>... appClass) {
6061
SpringApplicationBuilder appBuilder = builder.child(appClass)
6162
.web(WebApplicationType.SERVLET)
6263
.bannerMode(Banner.Mode.OFF)

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/util/QueryParameter.java

+12
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ public long estimateLimit() {
6262
return (range.getRange() / timePrecision.getInterval() + 1) * TAG_SET_COUNT;
6363
}
6464

65+
public Range getRange() {
66+
return this.range;
67+
}
68+
69+
public TimePrecision getTimePrecision() {
70+
return this.timePrecision;
71+
}
72+
73+
public long getLimit() {
74+
return this.limit;
75+
}
76+
6577
abstract public QueryParameter build();
6678
}
6779
}

metric-module/metric/src/main/resources/pinot-collector/applicationContext-collector-pinot-kafka.xml

-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,4 @@
2828
<constructor-arg index="0" ref="kafkaProducerFactory"/>
2929
</bean>
3030

31-
<bean id="kafkaUriStatTemplate" class="org.springframework.kafka.core.KafkaTemplate">
32-
<constructor-arg index="0" ref="kafkaProducerFactory"/>
33-
</bean>
34-
3531
</beans>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
kafka.double.topic=system-metric-double
22
kafka.metadata.tag.topic=system-metric-tag
3-
kafka.metadata.data.type.topic=system-metric-data-type
4-
kafka.uri.topic=url-stat
3+
kafka.metadata.data.type.topic=system-metric-data-type

metric-module/metric/src/main/resources/pinot-web/mybatis-pinot-config.xml

-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@
5252
<typeAlias type="com.navercorp.pinpoint.metric.common.model.MetricDataName" alias="MetricDataName"/>
5353
<typeAlias type="com.navercorp.pinpoint.metric.common.model.MetricDataType" alias="MetricDataType"/>
5454
<typeAlias type="com.navercorp.pinpoint.metric.common.model.mybatis.MetricDataTypeHandler" alias="MetricDataTypeHandler"/>
55-
56-
<typeAlias type="com.navercorp.pinpoint.metric.common.model.UriStat" alias="UriStat" />
57-
<typeAlias type="com.navercorp.pinpoint.metric.web.model.UriStatSummary" alias="UriStatSummary" />
58-
<typeAlias type="com.navercorp.pinpoint.metric.web.util.UriStatQueryParameter" alias="UriStatQueryParameter" />
59-
6055
</typeAliases>
6156

6257
<typeHandlers>
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
config.show.systemMetric=true
2-
config.show.urlStat=true
1+
config.show.systemMetric=true
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
config.show.systemMetric=true
2-
config.show.urlStat=true
1+
config.show.systemMetric=true

metric-module/web-starter/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
</exclusion>
4141
</exclusions>
4242
</dependency>
43+
<dependency>
44+
<groupId>com.navercorp.pinpoint</groupId>
45+
<artifactId>pinpoint-uristat-web</artifactId>
46+
</dependency>
4347
</dependencies>
4448

4549
<build>

metric-module/web-starter/src/main/java/com/navercorp/pinpoint/web/starter/multi/MetricAndWebApp.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.navercorp.pinpoint.common.server.util.ServerBootLogger;
2020
import com.navercorp.pinpoint.metric.web.MetricWebApp;
21+
import com.navercorp.pinpoint.uristat.web.UriStatWebConfig;
2122
import com.navercorp.pinpoint.web.PinpointBasicLoginConfig;
2223
import com.navercorp.pinpoint.web.WebApp;
2324
import com.navercorp.pinpoint.web.WebAppPropertySources;
@@ -46,7 +47,7 @@ public class MetricAndWebApp {
4647

4748
public static void main(String[] args) {
4849
try {
49-
WebStarter starter = new WebStarter(MetricAndWebApp.class, PinpointBasicLoginConfig.class, AuthorizationConfig.class, MetricWebApp.class);
50+
WebStarter starter = new WebStarter(MetricAndWebApp.class, PinpointBasicLoginConfig.class, AuthorizationConfig.class, MetricWebApp.class, UriStatWebConfig.class);
5051
starter.start(args);
5152
} catch (Exception exception) {
5253
logger.error("[WebApp] could not launch app.", exception);

pom.xml

+18
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118

119119
<module>hbase2-module</module>
120120
<module>metric-module</module>
121+
<module>uristat-common</module>
122+
<module>uristat-web</module>
123+
<module>uristat-collector</module>
121124

122125
<!-- <module>agent-testweb</module> -->
123126
<!-- <module>plugins-it</module> -->
@@ -422,6 +425,21 @@
422425
<artifactId>pinpoint-web</artifactId>
423426
<version>${project.version}</version>
424427
</dependency>
428+
<dependency>
429+
<groupId>com.navercorp.pinpoint</groupId>
430+
<artifactId>pinpoint-uristat-common</artifactId>
431+
<version>${project.version}</version>
432+
</dependency>
433+
<dependency>
434+
<groupId>com.navercorp.pinpoint</groupId>
435+
<artifactId>pinpoint-uristat-web</artifactId>
436+
<version>${project.version}</version>
437+
</dependency>
438+
<dependency>
439+
<groupId>com.navercorp.pinpoint</groupId>
440+
<artifactId>pinpoint-uristat-collector</artifactId>
441+
<version>${project.version}</version>
442+
</dependency>
425443
<dependency>
426444
<groupId>com.navercorp.pinpoint</groupId>
427445
<artifactId>pinpoint-metric</artifactId>

uristat-collector/pom.xml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>pinpoint</artifactId>
7+
<groupId>com.navercorp.pinpoint</groupId>
8+
<version>2.5.1-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>pinpoint-uristat-collector</artifactId>
13+
14+
<properties>
15+
<jdk.version>11</jdk.version>
16+
<jdk.home>${env.JAVA_11_HOME}</jdk.home>
17+
</properties>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>com.navercorp.pinpoint</groupId>
22+
<artifactId>pinpoint-uristat-common</artifactId>
23+
</dependency>
24+
<dependency>
25+
<groupId>com.navercorp.pinpoint</groupId>
26+
<artifactId>pinpoint-metric</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>com.navercorp.pinpoint</groupId>
30+
<artifactId>pinpoint-commons-server</artifactId>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.springframework.kafka</groupId>
34+
<artifactId>spring-kafka</artifactId>
35+
<version>2.9.4</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>com.navercorp.pinpoint</groupId>
39+
<artifactId>pinpoint-collector</artifactId>
40+
</dependency>
41+
</dependencies>
42+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.navercorp.pinpoint.uristat.collector;
2+
3+
4+
import org.springframework.context.annotation.ComponentScan;
5+
import org.springframework.context.annotation.ImportResource;
6+
import org.springframework.context.annotation.Profile;
7+
import org.springframework.context.annotation.PropertySource;
8+
9+
@Profile("metric")
10+
@ComponentScan({"com.navercorp.pinpoint.uristat.collector.service", "com.navercorp.pinpoint.uristat.collector.dao"})
11+
@PropertySource({"classpath:kafka-topic.properties", "classpath:kafka-producer-factory.properties"})
12+
@ImportResource({"classpath*:**/applicationContext-collector-metric-namespace.xml", "classpath:applicationContext-collector-pinot-kafka.xml"})
13+
public class UriStatCollectorConfig {
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.navercorp.pinpoint.uristat.collector;
2+
3+
public class UriStatCollectorPropertySources {
4+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
package com.navercorp.pinpoint.metric.collector.dao.pinot;
1+
package com.navercorp.pinpoint.uristat.collector.dao;
22

3-
import com.navercorp.pinpoint.metric.collector.dao.UriStatDao;
4-
import com.navercorp.pinpoint.metric.common.model.StringPrecondition;
5-
import com.navercorp.pinpoint.metric.common.model.UriStat;
3+
import com.navercorp.pinpoint.uristat.common.util.StringPrecondition;
4+
import com.navercorp.pinpoint.uristat.common.model.UriStat;
65
import org.springframework.beans.factory.annotation.Value;
76
import org.springframework.kafka.core.KafkaTemplate;
87
import org.springframework.stereotype.Repository;

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/collector/dao/UriStatDao.java renamed to uristat-collector/src/main/java/com/navercorp/pinpoint/uristat/collector/dao/UriStatDao.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.navercorp.pinpoint.metric.collector.dao;
16+
package com.navercorp.pinpoint.uristat.collector.dao;
1717

18-
import com.navercorp.pinpoint.metric.common.model.UriStat;
18+
import com.navercorp.pinpoint.uristat.common.model.UriStat;
1919

2020
import java.util.List;
2121

Original file line numberDiff line numberDiff line change
@@ -14,33 +14,28 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.navercorp.pinpoint.collector.service;
17+
package com.navercorp.pinpoint.uristat.collector.service;
1818

19+
import com.navercorp.pinpoint.collector.service.AgentUriStatService;
1920
import com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo;
2021
import com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo;
2122
import com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram;
2223
import com.navercorp.pinpoint.common.server.tenant.TenantProvider;
23-
import com.navercorp.pinpoint.metric.collector.MetricAppPropertySources;
24-
import com.navercorp.pinpoint.metric.collector.dao.UriStatDao;
25-
import com.navercorp.pinpoint.metric.common.model.UriStat;
26-
import org.springframework.context.annotation.ComponentScan;
27-
import org.springframework.context.annotation.Import;
28-
import org.springframework.context.annotation.ImportResource;
24+
import com.navercorp.pinpoint.uristat.collector.dao.UriStatDao;
25+
import com.navercorp.pinpoint.uristat.common.model.UriStat;
26+
import org.springframework.context.annotation.Profile;
2927
import org.springframework.stereotype.Service;
3028

3129
import java.util.ArrayList;
3230
import java.util.Objects;
3331

3432
@Service
35-
@ComponentScan("com.navercorp.pinpoint.metric.collector.dao.pinot")
36-
@ImportResource({"classpath:pinot-collector/applicationContext-collector-pinot.xml", "classpath:pinot-collector/servlet-context-collector-pinot.xml"})
37-
@Import({MetricAppPropertySources.class})
33+
@Profile("metric")
3834
public class PinotAgentUriStatService implements AgentUriStatService {
3935

4036
private final int BUCKET_SIZE = 8;
4137
private final int[] EMPTY_BUCKETS = new int[BUCKET_SIZE];
4238
private final UriStatDao uriStatDao;
43-
4439
private final TenantProvider tenantProvider;
4540

4641
public PinotAgentUriStatService(UriStatDao uriStatDao, TenantProvider tenantProvider) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
4+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">
5+
6+
<util:map id="kafkaProducerFactoryProperties" key-type="java.lang.String" value-type="java.lang.String">
7+
<entry key="bootstrap.servers" value="${pinpoint.metric.kafka.bootstrap.servers}"/>
8+
<entry key="key.serializer" value="${pinpoint.metric.kafka.key.serializer}"/>
9+
<entry key="value.serializer" value="${pinpoint.metric.kafka.value.serializer}"/>
10+
<entry key="partitioner.class" value="org.apache.kafka.clients.producer.internals.DefaultPartitioner"/>
11+
<entry key="acks" value="${pinpoint.metric.kafka.acks}"/>
12+
<entry key="compression.type" value="zstd"/>
13+
</util:map>
14+
15+
<bean id="kafkaProducerFactory" class="org.springframework.kafka.core.DefaultKafkaProducerFactory">
16+
<constructor-arg index="0" ref="kafkaProducerFactoryProperties" />
17+
</bean>
18+
19+
<bean id="kafkaUriStatTemplate" class="org.springframework.kafka.core.KafkaTemplate">
20+
<constructor-arg index="0" ref="kafkaProducerFactory"/>
21+
</bean>
22+
23+
</beans>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pinpoint.metric.kafka.bootstrap.servers=
2+
pinpoint.metric.kafka.key.serializer=org.apache.kafka.common.serialization.StringSerializer
3+
pinpoint.metric.kafka.value.serializer=org.springframework.kafka.support.serializer.JsonSerializer
4+
pinpoint.metric.kafka.acks=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kafka.uri.topic=url-stat

uristat-common/pom.xml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>pinpoint</artifactId>
7+
<groupId>com.navercorp.pinpoint</groupId>
8+
<version>2.5.1-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>pinpoint-uristat-common</artifactId>
13+
14+
<properties>
15+
<jdk.version>11</jdk.version>
16+
<jdk.home>${env.JAVA_11_HOME}</jdk.home>
17+
</properties>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>com.fasterxml.jackson.core</groupId>
22+
<artifactId>jackson-annotations</artifactId>
23+
<scope>compile</scope>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.springframework</groupId>
27+
<artifactId>spring-core</artifactId>
28+
<exclusions>
29+
<exclusion>
30+
<groupId>commons-logging</groupId>
31+
<artifactId>commons-logging</artifactId>
32+
</exclusion>
33+
</exclusions>
34+
</dependency>
35+
</dependencies>
36+
37+
</project>

0 commit comments

Comments
 (0)