diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index 7a6d526e804e..b137a366d42d 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -39,6 +39,7 @@ * Fix Elasticsearch, MySQL, RabbitMQ dashboards typos and missing expressions. * BanyanDB: Zipkin Module set service as Entity for improving the query performance. * MQE: check the metrics value before do binary operation to improve robustness. +* Replace workaround with Armeria native supported context path. #### UI diff --git a/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java b/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java index d79a0899ee52..5c787f673f76 100644 --- a/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java +++ b/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java @@ -39,7 +39,6 @@ import java.util.Set; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.apache.skywalking.oap.server.library.server.Server; import org.apache.skywalking.oap.server.library.server.ssl.PrivateKeyUtil; @@ -58,11 +57,10 @@ public HTTPServer(HTTPServerConfig config) { @Override public void initialize() { - // TODO replace prefix with real context path when Armeria supports it - final String contextPath = StringUtils.stripEnd(config.getContextPath(), "/"); sb = com.linecorp.armeria.server.Server .builder() - .serviceUnder(contextPath + "/docs", DocService.builder().build()) + .baseContextPath(config.getContextPath()) + .serviceUnder("/docs", DocService.builder().build()) .service("/internal/l7check", HealthCheckService.of()) .workerGroup(config.getMaxThreads()) .http1MaxHeaderSize(config.getMaxRequestHeaderSize()) @@ -99,7 +97,7 @@ public void initialize() { sb.absoluteUriTransformer(this::transformAbsoluteURI); } - log.info("Server root context path: {}", contextPath); + log.info("Server root context path: {}", config.getContextPath()); } /** @@ -114,7 +112,6 @@ public void addHandler(Object handler, List httpMethods) { ); sb.annotatedService() - .pathPrefix(config.getContextPath()) .build(handler); this.allowedMethods.addAll(httpMethods); }