parent
26bdcfafbb
commit
cf8af86f7d
@ -83,15 +83,6 @@ x-xss-protection: 1; mode=block
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
# Performance
|
|
||||||
|
|
||||||
```
|
|
||||||
Benchmark Mode Cnt Score Error Units
|
|
||||||
NormalizedFeignLoggerBenchmarkTest.testFeignWithoutLogger thrpt 25 16281.625 ± 279.774 ops/s
|
|
||||||
NormalizedFeignLoggerBenchmarkTest.testNormalizedFeignLogger thrpt 25 6081.675 ± 229.912 ops/s
|
|
||||||
NormalizedFeignLoggerBenchmarkTest.testSlf4jFeignLogger thrpt 25 16593.059 ± 151.327 ops/s
|
|
||||||
```
|
|
||||||
|
|
||||||
# How to use
|
# How to use
|
||||||
|
|
||||||
In order to use Normalized Logger into the application they must the following.
|
In order to use Normalized Logger into the application they must the following.
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
<?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">
|
|
||||||
<parent>
|
|
||||||
<groupId>me.bvn13.openfeign.logger</groupId>
|
|
||||||
<artifactId>feign-normalized-logger</artifactId>
|
|
||||||
<version>0.1.5-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>me.bvn13.openfeign.logger.test</groupId>
|
|
||||||
<artifactId>logger-testing</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.bvn13.openfeign.logger</groupId>
|
|
||||||
<artifactId>feign-normalized-logger</artifactId>
|
|
||||||
<version>0.1.4</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<version>${slf4j.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-jdk14</artifactId>
|
|
||||||
<version>${slf4j.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
|
||||||
<version>${junit.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-server</artifactId>
|
|
||||||
<version>${jetty-server.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-servlet</artifactId>
|
|
||||||
<version>${jetty-server.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.openjdk.jmh</groupId>
|
|
||||||
<artifactId>jmh-core</artifactId>
|
|
||||||
<version>${jmh.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.openjdk.jmh</groupId>
|
|
||||||
<artifactId>jmh-generator-annprocess</artifactId>
|
|
||||||
<version>${jmh.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-core</artifactId>
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-gson</artifactId>
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-slf4j</artifactId>
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,107 +0,0 @@
|
|||||||
package me.bvn13.openfeign.logger.normalized;
|
|
||||||
|
|
||||||
import feign.Feign;
|
|
||||||
import feign.Logger;
|
|
||||||
import feign.gson.GsonDecoder;
|
|
||||||
import feign.slf4j.Slf4jLogger;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.openjdk.jmh.annotations.Benchmark;
|
|
||||||
import org.openjdk.jmh.annotations.Scope;
|
|
||||||
import org.openjdk.jmh.annotations.Setup;
|
|
||||||
import org.openjdk.jmh.annotations.State;
|
|
||||||
import org.openjdk.jmh.annotations.TearDown;
|
|
||||||
import org.openjdk.jmh.annotations.Warmup;
|
|
||||||
|
|
||||||
import static me.bvn13.openfeign.logger.normalized.TestJettyServer.PORT;
|
|
||||||
|
|
||||||
public class NormalizedFeignLoggerBenchmarkTest {
|
|
||||||
@State(Scope.Benchmark)
|
|
||||||
public static class BenchmarkStateWithoutLogging {
|
|
||||||
TestJettyServer jettyServer;
|
|
||||||
TestFeignClient feignClient;
|
|
||||||
|
|
||||||
@Setup
|
|
||||||
public void init() {
|
|
||||||
jettyServer = new TestJettyServer();
|
|
||||||
jettyServer.start();
|
|
||||||
feignClient = Feign.builder()
|
|
||||||
.decoder(new GsonDecoder())
|
|
||||||
.target(TestFeignClient.class, "http://localhost:" + PORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TearDown
|
|
||||||
public void tearDown() {
|
|
||||||
jettyServer.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@State(Scope.Benchmark)
|
|
||||||
public static class BenchmarkStateWithSlf4jLogging {
|
|
||||||
TestJettyServer jettyServer;
|
|
||||||
TestFeignClient feignClient;
|
|
||||||
|
|
||||||
@Setup
|
|
||||||
public void init() {
|
|
||||||
jettyServer = new TestJettyServer();
|
|
||||||
jettyServer.start();
|
|
||||||
feignClient = Feign.builder()
|
|
||||||
.logger(new Slf4jLogger())
|
|
||||||
.logLevel(Logger.Level.FULL)
|
|
||||||
.decoder(new GsonDecoder())
|
|
||||||
.target(TestFeignClient.class, "http://localhost:" + PORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TearDown
|
|
||||||
public void tearDown() {
|
|
||||||
jettyServer.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@State(Scope.Benchmark)
|
|
||||||
public static class BenchmarkStateWithNormalizedLogging {
|
|
||||||
TestJettyServer jettyServer;
|
|
||||||
TestFeignClient feignClient;
|
|
||||||
|
|
||||||
@Setup
|
|
||||||
public void init() {
|
|
||||||
jettyServer = new TestJettyServer();
|
|
||||||
jettyServer.start();
|
|
||||||
feignClient = Feign.builder()
|
|
||||||
.logger(new NormalizedFeignLogger())
|
|
||||||
.logLevel(Logger.Level.FULL)
|
|
||||||
.decoder(new GsonDecoder())
|
|
||||||
.target(TestFeignClient.class, "http://localhost:" + PORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TearDown
|
|
||||||
public void tearDown() {
|
|
||||||
jettyServer.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Benchmark
|
|
||||||
@Warmup(iterations = 3)
|
|
||||||
public void testFeignLogger(BenchmarkStateWithoutLogging benchmarkState) {
|
|
||||||
final ResponseDto status = benchmarkState.feignClient.getStatus();
|
|
||||||
Assertions.assertEquals("ok", status.getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Benchmark
|
|
||||||
@Warmup(iterations = 3)
|
|
||||||
public void testSlf4jFeignLogger(BenchmarkStateWithSlf4jLogging benchmarkState) {
|
|
||||||
final ResponseDto status = benchmarkState.feignClient.getStatus();
|
|
||||||
Assertions.assertEquals("ok", status.getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Benchmark
|
|
||||||
@Warmup(iterations = 3)
|
|
||||||
public void testNormalizedFeignLogger(BenchmarkStateWithNormalizedLogging benchmarkState) {
|
|
||||||
final ResponseDto status = benchmarkState.feignClient.getStatus();
|
|
||||||
Assertions.assertEquals("ok", status.getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
org.openjdk.jmh.Main.main(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package me.bvn13.openfeign.logger.normalized;
|
|
||||||
|
|
||||||
public class ResponseDto {
|
|
||||||
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResponseDto setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package me.bvn13.openfeign.logger.normalized;
|
|
||||||
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.http.HttpServlet;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class TestBlockingServlet extends HttpServlet {
|
|
||||||
|
|
||||||
protected void doGet(HttpServletRequest request,
|
|
||||||
HttpServletResponse response) throws ServletException, IOException {
|
|
||||||
response.setContentType("application/json");
|
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
|
||||||
response.getWriter().println("{ \"status\": \"ok\"}");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package me.bvn13.openfeign.logger.normalized;
|
|
||||||
|
|
||||||
|
|
||||||
import feign.RequestLine;
|
|
||||||
|
|
||||||
public interface TestFeignClient {
|
|
||||||
|
|
||||||
@RequestLine("GET /status")
|
|
||||||
ResponseDto getStatus();
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
package me.bvn13.openfeign.logger.normalized;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.server.Connector;
|
|
||||||
import org.eclipse.jetty.server.Server;
|
|
||||||
import org.eclipse.jetty.server.ServerConnector;
|
|
||||||
import org.eclipse.jetty.servlet.ServletHandler;
|
|
||||||
|
|
||||||
public class TestJettyServer {
|
|
||||||
|
|
||||||
public static final int PORT = 8090;
|
|
||||||
private Server server;
|
|
||||||
|
|
||||||
public TestJettyServer() {
|
|
||||||
server = new Server();
|
|
||||||
ServerConnector connector = new ServerConnector(server);
|
|
||||||
connector.setPort(PORT);
|
|
||||||
server.setConnectors(new Connector[] {connector});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start() {
|
|
||||||
ServletHandler servletHandler = new ServletHandler();
|
|
||||||
server.setHandler(servletHandler);
|
|
||||||
servletHandler.addServletWithMapping(TestBlockingServlet.class, "/status");
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
server.start();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stop() {
|
|
||||||
try {
|
|
||||||
server.stop();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
TestJettyServer jettyServer;
|
|
||||||
jettyServer = new TestJettyServer();
|
|
||||||
try {
|
|
||||||
jettyServer.start();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<?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">
|
|
||||||
<parent>
|
|
||||||
<groupId>me.bvn13.openfeign.logger</groupId>
|
|
||||||
<artifactId>feign-normalized-logger</artifactId>
|
|
||||||
<version>0.1.5-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>logger</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-core</artifactId>
|
|
||||||
<version>${feign.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<version>${slf4j.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
36
pom.xml
36
pom.xml
@ -9,12 +9,7 @@
|
|||||||
<artifactId>feign-normalized-logger</artifactId>
|
<artifactId>feign-normalized-logger</artifactId>
|
||||||
<version>0.1.5-SNAPSHOT</version>
|
<version>0.1.5-SNAPSHOT</version>
|
||||||
|
|
||||||
<modules>
|
<packaging>jar</packaging>
|
||||||
<module>logger</module>
|
|
||||||
<module>logger-testing</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<name>OpenFeign Normalized Logger</name>
|
<name>OpenFeign Normalized Logger</name>
|
||||||
<description>Normalized Logger for OpenFeign</description>
|
<description>Normalized Logger for OpenFeign</description>
|
||||||
@ -47,14 +42,9 @@
|
|||||||
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
|
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
|
||||||
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
||||||
<gitflow-maven-plugin.version>1.18.0</gitflow-maven-plugin.version>
|
<gitflow-maven-plugin.version>1.18.0</gitflow-maven-plugin.version>
|
||||||
|
|
||||||
<!-- Testing -->
|
|
||||||
<junit.version>5.9.0</junit.version>
|
|
||||||
<jetty-server.version>11.0.11</jetty-server.version>
|
|
||||||
<jmh.version>1.35</jmh.version>
|
|
||||||
<httpclient.version>4.5.13</httpclient.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>internal.repo</id>
|
<id>internal.repo</id>
|
||||||
@ -63,6 +53,28 @@
|
|||||||
</repository>
|
</repository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign</groupId>
|
||||||
|
<artifactId>feign-core</artifactId>
|
||||||
|
<version>${feign.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.12</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>feign-normalized-logger</finalName>
|
<finalName>feign-normalized-logger</finalName>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
* <pre>
|
* <pre>
|
||||||
* {@code
|
* {@code
|
||||||
*
|
*
|
||||||
* Normalized feign request (HERE-ARE-CLASS-AND-METHOD): [
|
* normalized feign request (HERE-IS-CLASS-AND-METHOD): [
|
||||||
*
|
*
|
||||||
* ] has response [
|
* ] has response [
|
||||||
*
|
*
|
Loading…
Reference in New Issue
Block a user