Skip to content

Commit f5f3481

Browse files
authored
Merge pull request #58 from reactivegroup/feature/metrics
feat: Telemetry API + refactor: optimize code
2 parents 8a25788 + f298d9c commit f5f3481

File tree

86 files changed

+2201
-362
lines changed

Some content is hidden

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

86 files changed

+2201
-362
lines changed

examples/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
<parent>
2424
<artifactId>capa-parent</artifactId>
2525
<groupId>group.rxcloud</groupId>
26-
<version>1.0.7.RELEASE</version>
26+
<version>1.0.8.RELEASE</version>
2727
</parent>
2828

2929
<artifactId>capa-examples</artifactId>
3030
<packaging>jar</packaging>
3131
<name>capa-sdk-examples</name>
3232

3333
<properties>
34-
<log4j.version>2.8.2</log4j.version>
34+
<log4j.version>2.14.1</log4j.version>
3535
<logback.version>1.1.7</logback.version>
3636
<slf4j-api.version>1.7.32</slf4j-api.version>
3737
</properties>
@@ -67,7 +67,7 @@
6767
<version>${log4j.version}</version>
6868
</dependency>
6969
<!-- logback -->
70-
<!-- <dependency>
70+
<!--<dependency>
7171
<groupId>ch.qos.logback</groupId>
7272
<artifactId>logback-classic</artifactId>
7373
<version>${logback.version}</version>

examples/src/main/java/group/rxcloud/capa/examples/log/DemoLog.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
public class DemoLog {
3131

3232
public static void main(String[] args) {
33-
log.info("test");
33+
try {
34+
log.info("test");
35+
}catch (Exception e){
36+
System.out.println();
37+
}
38+
3439
}
3540
}

examples/src/main/resources/xml/logback.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,9 @@
1717
-->
1818
<configuration>
1919
<!--Log-->
20-
<appender name="Log" class="group.rxcloud.capa.component.log.agent.CapaLogbackAppenderAgent">
20+
<appender name="Log" class="group.rxcloud.capa.component.log.CapaLogbackAppenderAgent">
2121
</appender>
2222

23-
<logger name="com.ctrip.ibu.market.e2c" level="INFO" additivity="false">
24-
<!-- <appender-ref ref="STDOUT"/>-->
25-
<appender-ref ref="Log"/>
26-
</logger>
27-
28-
<logger name="com.ctrip.ibu.telescope.mock.support" level="INFO" additivity="false">
29-
<!-- <appender-ref ref="STDOUT"/>-->
30-
<appender-ref ref="Log"/>
31-
</logger>
32-
3323
<root level="INFO">
3424
<appender-ref ref="Log"/>
3525
</root>

pom.xml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<groupId>group.rxcloud</groupId>
2424
<artifactId>capa-parent</artifactId>
2525
<packaging>pom</packaging>
26-
<version>1.0.7.RELEASE</version>
26+
<version>1.0.8.RELEASE</version>
2727
<name>capa-sdk-parent</name>
2828
<description>SDK for Capa.</description>
2929
<url>https://github.com/reactivegroup</url>
@@ -44,6 +44,10 @@
4444
<name>reckless11</name>
4545
<email>[email protected]</email>
4646
</developer>
47+
<developer>
48+
<name>dgzpg</name>
49+
<email>[email protected]</email>
50+
</developer>
4751
</developers>
4852

4953
<scm>
@@ -77,14 +81,17 @@
7781
<java.version>8</java.version>
7882
<file.encoding>UTF-8</file.encoding>
7983
<maven.version>3.8.1</maven.version>
80-
<cloud-runtimes.version>1.0.9.RELEASE</cloud-runtimes.version>
84+
<cloud-runtimes.version>1.0.10.RELEASE</cloud-runtimes.version>
8185
<reactor-core.version>3.3.22.RELEASE</reactor-core.version>
8286
<slf4j.version>1.7.21</slf4j.version>
87+
<grpc.version>1.39.0</grpc.version>
88+
<jackson.version>2.12.4</jackson.version>
8389
<open.telemetry.version>1.9.0</open.telemetry.version>
8490
<open.telemetry.version.alpha>1.9.0-alpha</open.telemetry.version.alpha>
85-
8691
<junit.version>5.3.1</junit.version>
8792
<mockito-core.version>3.6.0</mockito-core.version>
93+
<powermock.version>2.0.2</powermock.version>
94+
8895
<checkstyle.version>3.1.2</checkstyle.version>
8996
<apache.rat.version>0.13</apache.rat.version>
9097
<cobertura.maven.version>2.7</cobertura.maven.version>
@@ -137,7 +144,6 @@
137144
<groupId>io.projectreactor</groupId>
138145
<artifactId>reactor-core</artifactId>
139146
<version>${reactor-core.version}</version>
140-
<optional>true</optional>
141147
</dependency>
142148

143149
<!-- slf4j -->
@@ -147,6 +153,20 @@
147153
<version>${slf4j.version}</version>
148154
</dependency>
149155

156+
<!-- serialize -->
157+
<dependency>
158+
<groupId>com.fasterxml.jackson.core</groupId>
159+
<artifactId>jackson-databind</artifactId>
160+
<version>${jackson.version}</version>
161+
</dependency>
162+
163+
<!-- grpc -->
164+
<dependency>
165+
<groupId>io.grpc</groupId>
166+
<artifactId>grpc-protobuf</artifactId>
167+
<version>${grpc.version}</version>
168+
</dependency>
169+
150170
<!-- open-telemetry-api -->
151171
<dependency>
152172
<groupId>io.opentelemetry</groupId>
@@ -172,6 +192,12 @@
172192
<version>${mockito-core.version}</version>
173193
<scope>test</scope>
174194
</dependency>
195+
<dependency>
196+
<groupId>org.powermock</groupId>
197+
<artifactId>powermock-reflect</artifactId>
198+
<version>${powermock.version}</version>
199+
<scope>test</scope>
200+
</dependency>
175201
</dependencies>
176202
</dependencyManagement>
177203

@@ -348,7 +374,7 @@
348374
<format>html</format>
349375
<format>xml</format>
350376
</formats>
351-
<check />
377+
<check/>
352378
</configuration>
353379
</plugin>
354380
<plugin>
@@ -414,5 +440,4 @@
414440
</plugin>
415441
</plugins>
416442
</build>
417-
418443
</project>

sdk-component/pom.xml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>group.rxcloud</groupId>
2525
<artifactId>capa-parent</artifactId>
26-
<version>1.0.7.RELEASE</version>
26+
<version>1.0.8.RELEASE</version>
2727
</parent>
2828

2929
<artifactId>capa-sdk-component</artifactId>
@@ -33,9 +33,9 @@
3333
<properties>
3434
<okhttp.version>4.9.1</okhttp.version>
3535
<kotlin-stdlib.version>1.4.10</kotlin-stdlib.version>
36-
<log4j.version>2.8.2</log4j.version>
36+
<log4j.version>2.14.1</log4j.version>
3737
<logback.version>1.1.7</logback.version>
38-
</properties>
38+
</properties>
3939

4040
<dependencies>
4141
<!-- sdk module -->
@@ -44,15 +44,16 @@
4444
<artifactId>capa-sdk-infrastructure</artifactId>
4545
</dependency>
4646

47+
<!-- open-telemetry-api -->
4748
<dependency>
4849
<groupId>io.opentelemetry</groupId>
4950
<artifactId>opentelemetry-sdk</artifactId>
50-
<version>1.9.0</version>
51+
<version>${open.telemetry.version}</version>
5152
</dependency>
5253
<dependency>
5354
<groupId>io.opentelemetry</groupId>
5455
<artifactId>opentelemetry-sdk-metrics</artifactId>
55-
<version>1.9.0-alpha</version>
56+
<version>${open.telemetry.version.alpha}</version>
5657
</dependency>
5758

5859
<!-- okhttp -->
@@ -88,15 +89,22 @@
8889
<dependency>
8990
<groupId>org.apache.logging.log4j</groupId>
9091
<artifactId>log4j-core</artifactId>
91-
<optional>true</optional>
9292
<version>${log4j.version}</version>
93+
<optional>true</optional>
9394
</dependency>
9495
<!-- logback -->
9596
<dependency>
9697
<groupId>ch.qos.logback</groupId>
9798
<artifactId>logback-core</artifactId>
99+
<version>${logback.version}</version>
98100
<optional>true</optional>
101+
</dependency>
102+
<dependency>
103+
<groupId>ch.qos.logback</groupId>
104+
<artifactId>logback-classic</artifactId>
99105
<version>${logback.version}</version>
106+
<!-- log4j-slf4j-impl and logback-classic cannot exist at the same time. -->
107+
<optional>true</optional>
100108
</dependency>
101109

102110
<dependency>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.capa.component;
18+
19+
import group.rxcloud.capa.infrastructure.CapaProperties;
20+
21+
import java.util.Properties;
22+
23+
/**
24+
* Capa log component common properties.
25+
*/
26+
public interface CapaLogProperties {
27+
28+
abstract class Settings {
29+
30+
private static String centerConfigAppId = "";
31+
32+
private static final String LOG_COMPONENT_CENTER_CONFIG_APPID = "LOG_COMPONENT_CENTER_CONFIG_APPID";
33+
34+
static {
35+
Properties properties = CapaProperties.COMPONENT_PROPERTIES_SUPPLIER.apply("log-common");
36+
37+
centerConfigAppId = properties.getProperty(LOG_COMPONENT_CENTER_CONFIG_APPID, centerConfigAppId);
38+
}
39+
40+
public static String getCenterConfigAppId() {
41+
return centerConfigAppId;
42+
}
43+
44+
private Settings() {
45+
}
46+
}
47+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.capa.component;
18+
19+
import group.rxcloud.capa.infrastructure.CapaProperties;
20+
21+
import java.util.Properties;
22+
23+
/**
24+
* Capa telemetry component common properties.
25+
*/
26+
public interface CapaTelemetryProperties {
27+
28+
abstract class Settings {
29+
30+
private static String centerConfigAppId = "";
31+
32+
private static final String TELEMETRY_COMPONENT_CENTER_CONFIG_APPID = "TELEMETRY_COMPONENT_CENTER_CONFIG_APPID";
33+
34+
static {
35+
Properties properties = CapaProperties.COMPONENT_PROPERTIES_SUPPLIER.apply("telemetry-common");
36+
37+
centerConfigAppId = properties.getProperty(TELEMETRY_COMPONENT_CENTER_CONFIG_APPID, centerConfigAppId);
38+
}
39+
40+
public static String getCenterConfigAppId() {
41+
return centerConfigAppId;
42+
}
43+
44+
private Settings() {
45+
}
46+
}
47+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package group.rxcloud.capa.component.configstore;
18+
19+
/**
20+
* Common headers for config store.
21+
*/
22+
public class ConfigHeaders {
23+
24+
public static final String CAPA_CONFIG_EXTENSION = "capa-config-extension";
25+
26+
/**
27+
* Config extension mode.
28+
*/
29+
public enum Extension {
30+
31+
/**
32+
* Multi appId will be merge random.
33+
*/
34+
MERGE("0"),
35+
/**
36+
* The first appId is child config file,
37+
* and will override the other appId.
38+
*/
39+
EXTEND("1"),
40+
;
41+
42+
private final String mode;
43+
44+
Extension(String mode) {
45+
this.mode = mode;
46+
}
47+
48+
public String getMode() {
49+
return mode;
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)