Skip to content

Commit

Permalink
Replace workaround with Armeria native supported context path (#12484)
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhenxu94 committed Jul 28, 2024
1 parent 5441f58 commit ceaa88f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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())
Expand Down Expand Up @@ -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());
}

/**
Expand All @@ -114,7 +112,6 @@ public void addHandler(Object handler, List<HttpMethod> httpMethods) {
);

sb.annotatedService()
.pathPrefix(config.getContextPath())
.build(handler);
this.allowedMethods.addAll(httpMethods);
}
Expand Down

0 comments on commit ceaa88f

Please sign in to comment.