Skip to content

Commit

Permalink
[api & ui] add api module and ui module (etrace-io#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobke authored May 31, 2021
1 parent 2355062 commit eba18d3
Show file tree
Hide file tree
Showing 787 changed files with 156,355 additions and 4,199 deletions.
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ gpg --keyserver hkp://keys.gnupg.net --send-keys YOUR_KEY_ID
gpg --keyserver hkp://pool.sks-keyservers.net --send-keys YOUR_KEY_ID
```

---
# Follow the git commit message rule with *Conventional Commits*

## What is *Conventional Commits*

Go to read its [explanation](https://www.conventionalcommits.org/en/v1.0.0/), which contributes to the changes among codes.

## Any tools to help?

Sure. IDE families of JetBrains provides a excellent plugin [Git Commit Template](https://plugins.jetbrains.com/plugin/9861-git-commit-template).

---

# Continues Integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private void initAgentConfig() {
etraceConfig.getBackendAddress())) {
LOGGER.warn(
"ETrace agent auto configuration fail, you need config `etrace.appId` and `etrace.backendAddress` in "
+ "`application.yaml`.");
+ "`application.yml`.");
} else {
AgentConfiguration.setAppId(etraceConfig.getAppId());
AgentConfiguration.setCollectorIp(etraceConfig.getBackendAddress());
Expand Down
32 changes: 31 additions & 1 deletion etrace-api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>etrace</artifactId>
<groupId>io.etrace</groupId>
Expand Down Expand Up @@ -67,6 +68,19 @@
<artifactId>mysql-connector-java</artifactId>
</dependency>

<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<!-- <version>${querydsl.version}</version>-->
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<!-- <version>${querydsl.version}</version>-->
</dependency>

<dependency>
<groupId>io.etrace</groupId>
<artifactId>datasource-prometheus</artifactId>
Expand All @@ -93,6 +107,22 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
11 changes: 0 additions & 11 deletions etrace-api/src/main/java/io/etrace/api/config/AsyncConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class AsyncConfig implements AsyncConfigurer {
public static final String THREAD_POOL_TASK_EXECUTOR = "threadPoolTaskExecutor";
//todo: this 3 executor not used?
public static final String PROXY_THREAD_POOL_TASK_EXECUTOR = "proxyThreadPoolTaskExecutor";
public static final String REDIS_RATE_LIMIT_TASK_EXECUTOR = "redisRateLimitTaskExcutor";
public static final String AsyncRateLimitThreadPoolExecutor = "AsyncRateLimitThreadPoolExecutor";
private static final Logger logger = LoggerFactory.getLogger(AsyncConfig.class);

Expand Down Expand Up @@ -73,16 +72,6 @@ public Executor proxyThreadPoolTaskExecutor() {
return executor;
}

@Bean(name = REDIS_RATE_LIMIT_TASK_EXECUTOR)
public Executor redisRateLimitTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(40);
executor.setMaxPoolSize(40);
executor.setQueueCapacity(500);
executor.setThreadNamePrefix("redis-ratelimit-thread-pool-");
executor.initialize();
return executor;
}

@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
Expand Down
32 changes: 0 additions & 32 deletions etrace-api/src/main/java/io/etrace/api/config/DatabaseConfig.java

This file was deleted.

8 changes: 7 additions & 1 deletion etrace-api/src/main/java/io/etrace/api/config/JPAConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@Configuration
@EnableJpaRepositories(basePackages = "io.etrace.api.repository")
@EnableJpaRepositories(basePackages = "io.etrace.api.repository"
// ,
// entityManagerFactoryRef = "entityManagerFactory",
// transactionManagerRef = "transactionManager"
// todo: 移除了默认的 enableDefaultTransactions (后续看看是否这个配置)
, enableDefaultTransactions = false
)
public class JPAConfig {
}
23 changes: 23 additions & 0 deletions etrace-api/src/main/java/io/etrace/api/config/QueryDslConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.etrace.api.config;

import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.persistence.EntityManager;

@Configuration
public class QueryDslConfig {

@Bean
// public JPAQueryFactory jpaQueryFactory(@Qualifier("entityManager") EntityManager entityManager) {
public JPAQueryFactory jpaQueryFactory(EntityManager entityManager) {
return new JPAQueryFactory(entityManager);
}

// @Bean
// public JPAQueryFactory watchdogJpaQueryFactory(@Qualifier("watchdogEntityManager") EntityManager
// entityManager) {
// return new JPAQueryFactory(entityManager);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SimpleWebSecurityConfig extends WebSecurityConfigurerAdapter {

public static final String MOCK_PASSWORD = "123456";

public static final String[] AUTH_WHITELIST = {
"/actuator",
// -- swagger ui
Expand Down
16 changes: 1 addition & 15 deletions etrace-api/src/main/java/io/etrace/api/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,14 @@
@EnableSwagger2
public class SwaggerConfig {

public static final String OPEN_API_TAG = "Open Api";
public static final String PROXY_REQUEST_TAG = "Proxy Request Api";
public static final String YELLOW_PAGE_TAG = "Yellow page UI Api";

public static final String FOR_ETRACE = "ETrace UI Api";

public static final String METRIC = "Metric";
public static final String META = "Application Metadata";
public static final String MYSQL_DATA = "Data From Mysql";

public static final String MISC = "Miscellaneous";

public static final String DEPRECATED_TAG = "Deprecated, need to be deleted";

//@Value("${swagger.host}")
//private String host;

@Bean
public Docket defaultApi() {
return new Docket(DocumentationType.SWAGGER_2)
Expand All @@ -42,16 +33,11 @@ public Docket defaultApi() {
.paths(PathSelectors.any())
.build()
//.host(host)
.tags(new Tag(OPEN_API_TAG, "需要使用Header中的Token鉴权的Open API(需按照说明配置Header信息才能正常访问)", Integer.MIN_VALUE))
.tags(new Tag(PROXY_REQUEST_TAG, "代理、合并请求的Api"))
.tags(new Tag(FOR_ETRACE, "ETrace前端页面上所需的API", Integer.MIN_VALUE + 3))
.tags(new Tag(METRIC, "ETrace前端页面使用的Metric查询API"))
.tags(new Tag(META, "提供应用元数据相关的查询API"))
.tags(new Tag(MYSQL_DATA, "查询PGl数据库的API"))

.tags(new Tag(DEPRECATED_TAG, "Deprecated, need to be deleted"))

.tags(new Tag(MISC, "杂项", Integer.MAX_VALUE - 1))
.tags(new Tag(MYSQL_DATA, "查询数据库的API"))
.apiInfo(metaData())
.pathMapping("/")
;
Expand Down
Loading

0 comments on commit eba18d3

Please sign in to comment.