Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bbfb589
feat(Add a new feature): Add the abstract log api in compoent
dgz-pg Nov 17, 2021
476213f
merge master
dgz-pg Nov 17, 2021
8a4a8c2
delete useless tag
dgz-pg Nov 17, 2021
af1fe7e
update some conversations
dgz-pg Nov 17, 2021
02f4305
update conversation
dgz-pg Nov 17, 2021
df9b1a5
update log path
dgz-pg Nov 17, 2021
c368881
Merge pull request #39 from dgzpg/feat-addLogApi
kevinten10 Nov 17, 2021
bc8da28
chore: format code
kevinten10 Nov 17, 2021
c168419
release: release 1.0.7-alpha-1 version
kevinten10 Nov 17, 2021
732d0e1
feat(Add a new feature): update the abstract log api in compoent
dgz-pg Nov 18, 2021
da37ae3
style(update a new feature): update the abstract log api in compoent
dgz-pg Nov 18, 2021
968d71a
update demo
dgz-pg Nov 18, 2021
232c405
make dependency optional
dgz-pg Nov 18, 2021
fdc51fc
Merge pull request #43 from dgzpg/feat-addLogApi
kevinten10 Nov 18, 2021
d521517
Add trace and metrics components implementation.
Nov 16, 2021
89e57ac
Merge pull request #44 from JasmineJ1230/feature-trace
kevinten10 Nov 19, 2021
c099e34
release: release 1.0.7-alpha-2 version
kevinten10 Nov 19, 2021
491ec30
style(update a new feature): update the abstract log api in compoent
dgz-pg Nov 22, 2021
92c4aab
Merge branch 'feature/metrics' into feat-addLogApi
dgz-pg Nov 22, 2021
4bb42df
style(update a new feature): update the abstract log api in compoent
dgz-pg Nov 22, 2021
bf6e497
Merge pull request #45 from dgzpg/feat-addLogApi
kevinten10 Nov 22, 2021
c0788cb
release: release 1.0.7-alpha-3 version
kevinten10 Nov 23, 2021
8cf5877
test: Add ut for logs
dgz-pg Nov 26, 2021
df09157
test: Update ut for logs
dgz-pg Nov 26, 2021
371f7a6
Merge pull request #47 from dgzpg/feat-addLogsTest
kevinten10 Nov 26, 2021
3a7499b
Separate the context related features from trace.
Nov 26, 2021
19b2973
Merge pull request #51 from JasmineJ1230/feature/metrics_optimize
kevinten10 Nov 27, 2021
2e5198b
Merge branch 'master' into feature/metrics
kevinten10 Nov 28, 2021
f61fecd
refactor: format unit test code style
kevinten10 Nov 28, 2021
499a295
release: release 1.0.7.RELEASE version
kevinten10 Nov 28, 2021
dfbb98d
chore: fix checkstyle error
kevinten10 Nov 28, 2021
23bf863
release: release 1.0.7-beta-1 version
kevinten10 Nov 28, 2021
c68bbed
Merge branch 'master' into feature/metrics
kevinten10 Nov 29, 2021
e92c8a2
chore: upgrade pom version
kevinten10 Nov 29, 2021
c1b2ce5
chore: upgrade pom
kevinten10 Nov 29, 2021
3dbf70a
feat: add hooks interface and builder
kevinten10 Nov 29, 2021
a2c787b
chore: fix checkstyle error
kevinten10 Nov 29, 2021
b6f883b
refactor: use global hooks
kevinten10 Nov 30, 2021
2680d99
docs: add mixer doc
kevinten10 Nov 30, 2021
122e1aa
docs: add mixer doc
kevinten10 Nov 30, 2021
f0c059c
chore: fix checkstyle error
kevinten10 Nov 30, 2021
f1b8b40
feat: mixer nullable
kevinten10 Nov 30, 2021
5956e4f
release: release 1.0.7-beta-3 version
kevinten10 Nov 30, 2021
30406b6
feat: add mixer current config
kevinten10 Nov 30, 2021
fc6a2a1
feat: add multi component support
kevinten10 Nov 30, 2021
623b3f6
release: release 1.0.7.RELEASE version
kevinten10 Nov 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ For a Maven project, add the following to your pom.xml file:
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>capa-sdk</artifactId>
<version>1.0.6.RELEASE</version>
<version>1.0.7.RELEASE</version>
</dependency>
...
</dependencies>
Expand All @@ -140,7 +140,7 @@ Sample implementation library:
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>capa-sdk-spi-demo</artifactId>
<version>1.0.6.RELEASE</version>
<version>1.0.7.RELEASE</version>
</dependency>
...
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ For a Maven project, add the following to your pom.xml file:
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>capa-sdk</artifactId>
<version>1.0.6.RELEASE</version>
<version>1.0.7.RELEASE</version>
</dependency>
...
</dependencies>
Expand All @@ -138,7 +138,7 @@ Sample implementation library:
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>capa-sdk-spi-demo</artifactId>
<version>1.0.6.RELEASE</version>
<version>1.0.7.RELEASE</version>
</dependency>
...
</dependencies>
Expand Down
30 changes: 17 additions & 13 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@
<parent>
<artifactId>capa-parent</artifactId>
<groupId>group.rxcloud</groupId>
<version>1.0.6.RELEASE</version>
<version>1.0.7.RELEASE</version>
</parent>

<artifactId>capa-examples</artifactId>
<packaging>jar</packaging>
<name>capa-sdk-examples</name>

<properties>
<log4j.version>2.14.1</log4j.version>
<log4j.version>2.8.2</log4j.version>
<logback.version>1.1.7</logback.version>
<slf4j-api.version>1.7.32</slf4j-api.version>
</properties>

<dependencies>
Expand All @@ -58,21 +60,23 @@
</exclusion>
</exclusions>
</dependency>
<!-- log4j2 and slf4j -->
<!-- slf4j -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- logback -->
<!-- <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>-->
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 group.rxcloud.capa.examples.log;

import lombok.extern.slf4j.Slf4j;

/**
* An application cannot use log4j and logback configuration to print logs at the same time.
* So if you want to test the log4j2 configuration to print logs, then you need to copy the resources/xml/log4j2.xml file to the resources directory, and then add log4j-slf4j-impl dependency to the pom file.
* Else if you want to use logback configuration to print logs, then the resources/xml/logback.xml file needs to be copied to the resources path, and the logback-classic dependency needs to be added to the pom file.
* Notice:
* 1. Resources cannot contain log4j2.xml and logback.xml files at the same time,
* 2. log4j-slf4j-impl and logback-classic cannot exist at the same time.
*/
@Slf4j
public class DemoLog {

public static void main(String[] args) {
log.info("test");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 group.rxcloud.capa.examples.telemetry;

import group.rxcloud.capa.component.telemetry.metrics.MetricsReaderConfig;
import group.rxcloud.capa.telemetry.CapaTelemetryClient;
import group.rxcloud.capa.telemetry.CapaTelemetryClientBuilder;
import io.opentelemetry.api.metrics.LongCounter;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.Tracer;

import java.util.concurrent.TimeUnit;

public class DemoTelemetryClient {

public static void main(String[] args) throws InterruptedException {
MetricsReaderConfig readerConfig = new MetricsReaderConfig();
readerConfig.setExporterType(MetricTestExporter.class.getName());
readerConfig.setName("metric-reader");
readerConfig.setExportInterval(1, TimeUnit.SECONDS);
CapaTelemetryClient capaTelemetryClient = new CapaTelemetryClientBuilder()
.addProcessor(new TraceProcessor())
.addMetricReaderConfig(readerConfig)
.build();

// tracer
Tracer tracer = capaTelemetryClient.buildTracer("tracer-test")
.block();

LongCounter counter = capaTelemetryClient.buildMeter("meter-test")
.block()
.counterBuilder("counter-test")
.build();

Span span = tracer.spanBuilder("span-test")
.setAttribute("key1", 1)
.setAttribute("key2", 2)
.startSpan();
// working
for (int i = 0; i < 50; i++) {
Thread.sleep(200);
counter.add(i);
}

span.end();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 group.rxcloud.capa.examples.telemetry;

import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.metrics.data.MetricData;
import io.opentelemetry.sdk.metrics.export.MetricExporter;

import java.util.Collection;

public class MetricTestExporter implements MetricExporter {

@Override
public CompletableResultCode export(Collection<MetricData> metrics) {
metrics.forEach(System.out::println);
return CompletableResultCode.ofSuccess();
}

@Override
public CompletableResultCode flush() {
return CompletableResultCode.ofSuccess();
}

@Override
public CompletableResultCode shutdown() {
return CompletableResultCode.ofSuccess();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 group.rxcloud.capa.examples.telemetry;

import io.opentelemetry.context.Context;
import io.opentelemetry.sdk.trace.ReadWriteSpan;
import io.opentelemetry.sdk.trace.ReadableSpan;
import io.opentelemetry.sdk.trace.SpanProcessor;

public class TraceProcessor implements SpanProcessor {

@Override
public void onStart(Context context, ReadWriteSpan span) {

}

@Override
public boolean isStartRequired() {
return false;
}

@Override
public void onEnd(ReadableSpan span) {
System.out.println(span.toSpanData());
}

@Override
public boolean isEndRequired() {
return true;
}
}
4 changes: 3 additions & 1 deletion examples/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<CapaLog4jAppender name="log"/>
</Appenders>
<Loggers>
<Root level="debug">
<Root level="INFO">
<AppenderRef ref="Console"/>
<AppenderRef ref="log"/>
</Root>
</Loggers>
</Configuration>
31 changes: 31 additions & 0 deletions examples/src/main/resources/xml/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<Configuration status="DEBUG">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<CapaLog4jAppender name="log"/>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console"/>
<AppenderRef ref="log"/>
</Root>
</Loggers>
</Configuration>
36 changes: 36 additions & 0 deletions examples/src/main/resources/xml/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<configuration>
<!--Log-->
<appender name="Log" class="group.rxcloud.capa.component.log.agent.CapaLogbackAppenderAgent">
</appender>

<logger name="com.ctrip.ibu.market.e2c" level="INFO" additivity="false">
<!-- <appender-ref ref="STDOUT"/>-->
<appender-ref ref="Log"/>
</logger>

<logger name="com.ctrip.ibu.telescope.mock.support" level="INFO" additivity="false">
<!-- <appender-ref ref="STDOUT"/>-->
<appender-ref ref="Log"/>
</logger>

<root level="INFO">
<appender-ref ref="Log"/>
</root>
</configuration>
Loading