You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "SheltonZSL (via GitHub)" <gi...@apache.org> on 2024/03/17 03:58:29 UTC
[PR] Display the port services listen to from OAP and UI [skywalking]
SheltonZSL opened a new pull request, #12029:
URL: https://github.com/apache/skywalking/pull/12029
Based on discussion from https://github.com/apache/skywalking-website/pull/688.
- [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #<issue number>.
- [ ] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Display the port services listen to from OAP and UI [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on PR #12029:
URL: https://github.com/apache/skywalking/pull/12029#issuecomment-2002299652
Before review details, please make sure you would not change all the formats of the files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Display the port services listen to from OAP and UI [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on code in PR #12029:
URL: https://github.com/apache/skywalking/pull/12029#discussion_r1527408882
##########
oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/grpc/GRPCServer.java:
##########
@@ -16,129 +16,131 @@
*
*/
-package org.apache.skywalking.oap.server.library.server.grpc;
-
-import com.google.common.base.Strings;
-import io.grpc.BindableService;
-import io.grpc.ServerInterceptor;
-import io.grpc.ServerServiceDefinition;
-import io.grpc.netty.NettyServerBuilder;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Optional;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.RejectedExecutionHandler;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.library.server.Server;
-import org.apache.skywalking.oap.server.library.server.ServerException;
-import org.apache.skywalking.oap.server.library.server.grpc.ssl.DynamicSslContext;
-import org.apache.skywalking.oap.server.library.server.pool.CustomThreadFactory;
-
-@Slf4j
-public class GRPCServer implements Server {
-
- private final String host;
- private final int port;
- private int maxConcurrentCallsPerConnection;
- private int maxMessageSize;
- private io.grpc.Server server;
- private NettyServerBuilder nettyServerBuilder;
- private String certChainFile;
- private String privateKeyFile;
- private String trustedCAsFile;
- private DynamicSslContext sslContext;
- private int threadPoolSize;
-
- public GRPCServer(String host, int port) {
- this.host = host;
- this.port = port;
- }
-
- public void setMaxConcurrentCallsPerConnection(int maxConcurrentCallsPerConnection) {
- this.maxConcurrentCallsPerConnection = maxConcurrentCallsPerConnection;
- }
-
- public void setMaxMessageSize(int maxMessageSize) {
- this.maxMessageSize = maxMessageSize;
- }
-
- public void setThreadPoolSize(int threadPoolSize) {
- this.threadPoolSize = threadPoolSize;
- }
-
- /**
- * Require for `server.crt` and `server.pem` for open ssl at server side.
- *
- * @param certChainFile `server.crt` file
- * @param privateKeyFile `server.pem` file
- */
- public GRPCServer(String host, int port, String certChainFile, String privateKeyFile, String trustedCAsFile) {
- this(host, port);
- this.certChainFile = certChainFile;
- this.privateKeyFile = privateKeyFile;
- this.trustedCAsFile = trustedCAsFile;
- }
-
- @Override
- public void initialize() {
- InetSocketAddress address = new InetSocketAddress(host, port);
- nettyServerBuilder = NettyServerBuilder.forAddress(address);
-
- if (maxConcurrentCallsPerConnection > 0) {
- nettyServerBuilder.maxConcurrentCallsPerConnection(maxConcurrentCallsPerConnection);
- }
- if (maxMessageSize > 0) {
- nettyServerBuilder.maxInboundMessageSize(maxMessageSize);
- }
- if (threadPoolSize > 0) {
- ExecutorService executor = new ThreadPoolExecutor(
- threadPoolSize, threadPoolSize, 60, TimeUnit.SECONDS, new SynchronousQueue<>(),
- new CustomThreadFactory("grpcServerPool"), new CustomRejectedExecutionHandler()
- );
- nettyServerBuilder.executor(executor);
- }
-
- if (!Strings.isNullOrEmpty(privateKeyFile) && !Strings.isNullOrEmpty(certChainFile)) {
- sslContext = DynamicSslContext.forServer(privateKeyFile, certChainFile, trustedCAsFile);
- nettyServerBuilder.sslContext(sslContext);
- }
- log.info("Server started, host {} listening on {}", host, port);
- }
-
- static class CustomRejectedExecutionHandler implements RejectedExecutionHandler {
- @Override
- public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
- log.warn("Task {} rejected from {}", r.toString(), executor.toString());
- }
- }
-
- @Override
- public void start() throws ServerException {
- try {
- Optional.ofNullable(sslContext).ifPresent(DynamicSslContext::start);
- server = nettyServerBuilder.build();
- server.start();
- } catch (IOException e) {
- throw new GRPCServerException(e.getMessage(), e);
- }
- }
-
- public void addHandler(BindableService handler) {
- log.info("Bind handler {} into gRPC server {}:{}", handler.getClass().getSimpleName(), host, port);
- nettyServerBuilder.addService(handler);
- }
-
- public void addHandler(ServerServiceDefinition definition) {
- log.info("Bind handler {} into gRPC server {}:{}", definition.getClass().getSimpleName(), host, port);
- nettyServerBuilder.addService(definition);
- }
-
- public void addHandler(ServerInterceptor serverInterceptor) {
- log.info("Bind interceptor {} into gRPC server {}:{}", serverInterceptor.getClass().getSimpleName(), host, port);
- nettyServerBuilder.intercept(serverInterceptor);
- }
-
-}
+ package org.apache.skywalking.oap.server.library.server.grpc;
+
+ import com.google.common.base.Strings;
+ import io.grpc.BindableService;
+ import io.grpc.ServerInterceptor;
+ import io.grpc.ServerServiceDefinition;
+ import io.grpc.netty.NettyServerBuilder;
+ import java.io.IOException;
+ import java.net.InetSocketAddress;
+ import java.util.Optional;
+ import java.util.concurrent.ExecutorService;
+ import java.util.concurrent.RejectedExecutionHandler;
+ import java.util.concurrent.SynchronousQueue;
+ import java.util.concurrent.ThreadPoolExecutor;
+ import java.util.concurrent.TimeUnit;
+ import lombok.extern.slf4j.Slf4j;
+ import org.slf4j.Marker;
+ import org.slf4j.MarkerFactory;
+ import org.apache.skywalking.oap.server.library.server.Server;
+ import org.apache.skywalking.oap.server.library.server.ServerException;
+ import org.apache.skywalking.oap.server.library.server.grpc.ssl.DynamicSslContext;
+ import org.apache.skywalking.oap.server.library.server.pool.CustomThreadFactory;
+
+ @Slf4j
+ public class GRPCServer implements Server {
+
+ private final String host;
+ private final int port;
Review Comment:
Please revert all irrelative format changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Display the port services listen to from OAP and UI [skywalking]
Posted by "SheltonZSL (via GitHub)" <gi...@apache.org>.
SheltonZSL closed pull request #12029: Display the port services listen to from OAP and UI
URL: https://github.com/apache/skywalking/pull/12029
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Display the port services listen to from OAP and UI [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on code in PR #12029:
URL: https://github.com/apache/skywalking/pull/12029#discussion_r1527408846
##########
apm-webapp/src/main/java/org/apache/skywalking/oap/server/webapp/ApplicationStartUp.java:
##########
@@ -16,68 +16,77 @@
*
*/
-package org.apache.skywalking.oap.server.webapp;
+ package org.apache.skywalking.oap.server.webapp;
-import static org.yaml.snakeyaml.env.EnvScalarConstructor.ENV_FORMAT;
-import static org.yaml.snakeyaml.env.EnvScalarConstructor.ENV_TAG;
-import java.util.Collections;
-import org.yaml.snakeyaml.LoaderOptions;
-import org.yaml.snakeyaml.TypeDescription;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.env.EnvScalarConstructor;
-import com.linecorp.armeria.common.SessionProtocol;
-import com.linecorp.armeria.server.HttpService;
-import com.linecorp.armeria.server.Server;
-import com.linecorp.armeria.server.file.FileService;
-import com.linecorp.armeria.server.file.HttpFile;
-import com.linecorp.armeria.server.healthcheck.HealthCheckService;
-
-public class ApplicationStartUp {
- public static void main(String[] args) throws Exception {
- final Yaml yaml = new Yaml(
- new EnvScalarConstructor(
- new TypeDescription(Configuration.class),
- Collections.emptyList(),
- new LoaderOptions()));
- yaml.addImplicitResolver(ENV_TAG, ENV_FORMAT, "$");
-
- final Configuration configuration = yaml.loadAs(
- ApplicationStartUp.class.getResourceAsStream("/application.yml"),
- Configuration.class);
-
- final int port = configuration.port();
- final String[] oapServices = configuration.oapServices();
-
- final HttpService indexPage =
- HttpFile
- .of(ApplicationStartUp.class.getClassLoader(), "/public/index.html")
- .asService();
- final HttpService zipkinIndexPage =
- HttpFile
- .of(ApplicationStartUp.class.getClassLoader(), "/zipkin-lens/index.html")
- .asService();
-
- final ZipkinProxyService zipkin = new ZipkinProxyService(configuration.zipkinServices());
-
- Server
- .builder()
- .port(port, SessionProtocol.HTTP)
- .service("/graphql", new OapProxyService(oapServices))
- .service("/internal/l7check", HealthCheckService.of())
- .service("/zipkin/config.json", zipkin)
- .serviceUnder("/zipkin/api", zipkin)
- .serviceUnder("/zipkin",
- FileService.of(
- ApplicationStartUp.class.getClassLoader(),
- "/zipkin-lens")
- .orElse(zipkinIndexPage))
- .serviceUnder("/",
- FileService.of(
- ApplicationStartUp.class.getClassLoader(),
- "/public")
- .orElse(indexPage))
- .build()
- .start()
- .join();
- }
-}
+ import static org.yaml.snakeyaml.env.EnvScalarConstructor.ENV_FORMAT;
+ import static org.yaml.snakeyaml.env.EnvScalarConstructor.ENV_TAG;
+ import java.util.Collections;
+ import lombok.extern.slf4j.Slf4j;
+ import org.slf4j.Marker;
+ import org.slf4j.MarkerFactory;
+ import org.yaml.snakeyaml.LoaderOptions;
+ import org.yaml.snakeyaml.TypeDescription;
+ import org.yaml.snakeyaml.Yaml;
+ import org.yaml.snakeyaml.env.EnvScalarConstructor;
+ import com.linecorp.armeria.common.SessionProtocol;
+ import com.linecorp.armeria.server.HttpService;
+ import com.linecorp.armeria.server.Server;
+ import com.linecorp.armeria.server.file.FileService;
+ import com.linecorp.armeria.server.file.HttpFile;
+ import com.linecorp.armeria.server.healthcheck.HealthCheckService;
+
+ @Slf4j
+ public class ApplicationStartUp {
+ public static void main(String[] args) throws Exception {
+ final Marker startedMarker = MarkerFactory.getMarker("SkyWalking booster UI is running");
+ final Yaml yaml = new Yaml(
+ new EnvScalarConstructor(
Review Comment:
Could you revert all irrelative changes in this file? It seems you reformat the file?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org