Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#11278] Cleanup #11285

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.navercorp.pinpoint.collector.receiver.grpc.ServerInterceptorFactory;
import com.navercorp.pinpoint.collector.receiver.grpc.ShutdownEventListener;
import com.navercorp.pinpoint.collector.receiver.grpc.SimpleServerCallExecutorSupplier;
import com.navercorp.pinpoint.collector.receiver.grpc.monitor.Monitor;
import com.navercorp.pinpoint.collector.receiver.grpc.service.AgentLifecycleListener;
import com.navercorp.pinpoint.collector.receiver.grpc.service.AgentService;
import com.navercorp.pinpoint.collector.receiver.grpc.service.KeepAliveService;
Expand Down Expand Up @@ -117,7 +118,8 @@
@Qualifier("grpcAgentServerExecutor")
Executor grpcSpanExecutor,
@Qualifier("grpcAgentServerCallExecutorSupplier")
SimpleServerCallExecutorSupplier simpleServerCallExecutorSupplier) {
SimpleServerCallExecutorSupplier simpleServerCallExecutorSupplier,
Monitor monitor) {
GrpcReceiver grpcReceiver = new GrpcReceiver();
grpcReceiver.setBindAddress(properties.getBindAddress());
grpcReceiver.setAddressFilter(addressFilter);
Expand All @@ -129,6 +131,8 @@
grpcReceiver.setServerOption(properties.getServerOption());

grpcReceiver.setServerCallExecutorSupplier(simpleServerCallExecutorSupplier);

grpcReceiver.setMonitor(monitor);

Check warning on line 135 in collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcAgentConfiguration.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcAgentConfiguration.java#L135

Added line #L135 was not covered by tests
return grpcReceiver;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@

package com.navercorp.pinpoint.collector.grpc.config;

import com.navercorp.pinpoint.collector.receiver.grpc.monitor.BasicMonitor;
import com.navercorp.pinpoint.collector.receiver.grpc.monitor.Monitor;
import com.navercorp.pinpoint.collector.receiver.grpc.service.DefaultServerRequestFactory;
import com.navercorp.pinpoint.collector.receiver.grpc.service.ServerRequestFactory;
import com.navercorp.pinpoint.common.server.bo.filter.SpanEventFilter;
import com.navercorp.pinpoint.common.server.bo.grpc.CollectorGrpcSpanFactory;
import com.navercorp.pinpoint.common.server.bo.grpc.GrpcSpanBinder;
import io.grpc.ServerTransportFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand Down Expand Up @@ -54,4 +57,12 @@
return new CollectorGrpcSpanFactory(grpcSpanBinder, spanEventFilter);
}

@Bean
public Monitor grpcReceiverMonitor(@Value("${collector.receiver.grpc.monitor.enable:true}") boolean enable) {
if (enable) {
return new BasicMonitor("GrpcReceiverMonitor");

Check warning on line 63 in collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcComponentConfiguration.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcComponentConfiguration.java#L63

Added line #L63 was not covered by tests
} else {
return Monitor.NONE;

Check warning on line 65 in collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcComponentConfiguration.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcComponentConfiguration.java#L65

Added line #L65 was not covered by tests
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.navercorp.pinpoint.collector.receiver.grpc.GrpcReceiver;
import com.navercorp.pinpoint.collector.receiver.grpc.ServerInterceptorFactory;
import com.navercorp.pinpoint.collector.receiver.grpc.flow.RateLimitClientStreamServerInterceptor;
import com.navercorp.pinpoint.collector.receiver.grpc.monitor.Monitor;
import com.navercorp.pinpoint.collector.receiver.grpc.service.ServerRequestFactory;
import com.navercorp.pinpoint.collector.receiver.grpc.service.SpanService;
import com.navercorp.pinpoint.collector.receiver.grpc.service.StreamExecutorServerInterceptorFactory;
Expand Down Expand Up @@ -140,7 +141,8 @@
List<ServerTransportFilter> serverTransportFilterList,
ChannelzRegistry channelzRegistry,
@Qualifier("grpcSpanServerExecutor")
Executor grpcSpanExecutor) {
Executor grpcSpanExecutor,
Monitor monitor) {
GrpcReceiver grpcReceiver = new GrpcReceiver();
grpcReceiver.setBindAddress(properties.getBindAddress());
grpcReceiver.setAddressFilter(addressFilter);
Expand All @@ -151,6 +153,7 @@
grpcReceiver.setExecutor(grpcSpanExecutor);
grpcReceiver.setEnable(properties.isEnable());
grpcReceiver.setServerOption(properties.getServerOption());
grpcReceiver.setMonitor(monitor);

Check warning on line 156 in collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcSpanReceiverConfiguration.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcSpanReceiverConfiguration.java#L156

Added line #L156 was not covered by tests
return grpcReceiver;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.navercorp.pinpoint.collector.receiver.grpc.GrpcReceiver;
import com.navercorp.pinpoint.collector.receiver.grpc.ServerInterceptorFactory;
import com.navercorp.pinpoint.collector.receiver.grpc.flow.RateLimitClientStreamServerInterceptor;
import com.navercorp.pinpoint.collector.receiver.grpc.monitor.Monitor;
import com.navercorp.pinpoint.collector.receiver.grpc.service.ServerRequestFactory;
import com.navercorp.pinpoint.collector.receiver.grpc.service.StatService;
import com.navercorp.pinpoint.collector.receiver.grpc.service.StreamExecutorServerInterceptorFactory;
Expand Down Expand Up @@ -145,7 +146,8 @@
List<ServerTransportFilter> serverTransportFilterList,
ChannelzRegistry channelzRegistry,
@Qualifier("grpcStatServerExecutor")
Executor grpcSpanExecutor) {
Executor grpcSpanExecutor,
Monitor monitor) {
GrpcReceiver grpcReceiver = new GrpcReceiver();
grpcReceiver.setBindAddress(properties.getBindAddress());
grpcReceiver.setAddressFilter(addressFilter);
Expand All @@ -156,6 +158,7 @@
grpcReceiver.setExecutor(grpcSpanExecutor);
grpcReceiver.setEnable(properties.isEnable());
grpcReceiver.setServerOption(properties.getServerOption());
grpcReceiver.setMonitor(monitor);

Check warning on line 161 in collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcStatReceiverConfiguration.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/grpc/config/GrpcStatReceiverConfiguration.java#L161

Added line #L161 was not covered by tests
return grpcReceiver;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
package com.navercorp.pinpoint.collector.receiver.grpc;

import com.navercorp.pinpoint.collector.receiver.BindAddress;
import com.navercorp.pinpoint.collector.receiver.grpc.monitor.BasicMonitor;
import com.navercorp.pinpoint.collector.receiver.grpc.monitor.EmptyMonitor;
import com.navercorp.pinpoint.collector.receiver.grpc.monitor.Monitor;
import com.navercorp.pinpoint.common.server.util.AddressFilter;
import com.navercorp.pinpoint.common.util.Assert;
Expand Down Expand Up @@ -83,8 +81,7 @@
private Server server;
private ChannelzRegistry channelzRegistry;

private boolean enableMonitor = true;
private Monitor monitor;
private Monitor monitor = Monitor.NONE;

Check warning on line 84 in collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/GrpcReceiver.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/GrpcReceiver.java#L84

Added line #L84 was not covered by tests


@Override
Expand All @@ -99,11 +96,6 @@
Objects.requireNonNull(this.addressFilter, "addressFilter");
Assert.isTrue(CollectionUtils.hasLength(this.serviceList), "serviceList must not be empty");
Objects.requireNonNull(this.serverOption, "serverOption");
if (enableMonitor) {
this.monitor = new BasicMonitor(beanName + "-Monitor");
} else {
this.monitor = new EmptyMonitor();
}

if (sslContext != null) {
this.serverFactory = new ServerFactory(beanName, this.bindAddress.getIp(), this.bindAddress.getPort(), this.executor, this.serverCallExecutorSupplier, serverOption, sslContext);
Expand Down Expand Up @@ -267,7 +259,7 @@
this.channelzRegistry = Objects.requireNonNull(channelzRegistry, "channelzRegistry");
}

public void setEnableMonitor(boolean enableMonitor) {
this.enableMonitor = enableMonitor;
public void setMonitor(Monitor monitor) {
this.monitor = Objects.requireNonNull(monitor, "monitor");

Check warning on line 263 in collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/GrpcReceiver.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/GrpcReceiver.java#L263

Added line #L263 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.Closeable;

public interface Monitor extends Closeable {
Monitor NONE = new EmptyMonitor();

Check warning on line 6 in collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/monitor/Monitor.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/monitor/Monitor.java#L6

Added line #L6 was not covered by tests

void register(Runnable job);

Expand Down