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

[#noissue] Refactor ChannelzConfiguration #11244

Merged
merged 1 commit into from
Jul 11, 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 @@ -18,6 +18,7 @@
package com.navercorp.pinpoint.collector.grpc;

import com.codahale.metrics.MetricRegistry;
import com.navercorp.pinpoint.collector.grpc.channelz.ChannelzConfiguration;
import com.navercorp.pinpoint.collector.grpc.config.GrpcAgentConfiguration;
import com.navercorp.pinpoint.collector.grpc.config.GrpcAgentReceiverConfiguration;
import com.navercorp.pinpoint.collector.grpc.config.GrpcComponentConfiguration;
Expand Down Expand Up @@ -49,7 +50,9 @@
GrpcStatConfiguration.class,
GrpcStatReceiverConfiguration.class,

GrpcKeepAliveScheduler.class
GrpcKeepAliveScheduler.class,

ChannelzConfiguration.class
})
@ComponentScan({
"com.navercorp.pinpoint.collector.receiver.grpc"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.navercorp.pinpoint.collector.grpc.channelz;

import com.navercorp.pinpoint.grpc.channelz.ChannelzRegistry;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan({
"com.navercorp.pinpoint.collector.grpc.channelz.service",
"com.navercorp.pinpoint.collector.grpc.channelz.controller"
})
public class ChannelzConfiguration {

@Bean
public ChannelzRegistry channelzRegistry() {
return new DefaultChannelzRegistry();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.navercorp.pinpoint.collector.receiver.grpc.channelz;
package com.navercorp.pinpoint.collector.grpc.channelz;

import com.navercorp.pinpoint.grpc.channelz.ChannelzRegistry;
import org.apache.logging.log4j.LogManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.navercorp.pinpoint.collector.controller;
package com.navercorp.pinpoint.collector.grpc.channelz.controller;

import com.navercorp.pinpoint.collector.service.ChannelzService;
import com.navercorp.pinpoint.collector.service.ChannelzService.ServerStatsWithId;
import com.navercorp.pinpoint.collector.service.ChannelzService.SocketStatsWithId;
import com.navercorp.pinpoint.collector.service.ChannelzSocketLookup;
import com.navercorp.pinpoint.collector.service.ChannelzSocketLookup.SocketEntry;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzService;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzService.ServerStatsWithId;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzService.SocketStatsWithId;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzSocketLookup;
import com.navercorp.pinpoint.collector.grpc.channelz.util.HTMLBuilder;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -39,7 +39,7 @@ public List<SocketStatsWithId> findSocketStats(
@RequestParam(required = false) Integer localPort
) {
List<Long> ids = this.socketLookup.find(remoteAddress, localPort).stream()
.map(SocketEntry::getSocketId)
.map(ChannelzSocketLookup.SocketEntry::getSocketId)
.toList();
return this.channelzService.getSocketStatsList(ids);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.navercorp.pinpoint.collector.service;
package com.navercorp.pinpoint.collector.grpc.channelz.service;

import io.grpc.InternalChannelz.ServerStats;
import io.grpc.InternalChannelz.SocketStats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.service;
package com.navercorp.pinpoint.collector.grpc.channelz.service;

import javax.annotation.Nullable;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.navercorp.pinpoint.collector.service;
package com.navercorp.pinpoint.collector.grpc.channelz.service;

import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.service;
package com.navercorp.pinpoint.collector.grpc.channelz.service;

import com.google.common.base.Suppliers;
import com.google.common.util.concurrent.ListenableFuture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.navercorp.pinpoint.collector.controller;
package com.navercorp.pinpoint.collector.grpc.channelz.util;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@

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

import com.navercorp.pinpoint.collector.receiver.grpc.channelz.DefaultChannelzRegistry;
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 com.navercorp.pinpoint.grpc.channelz.ChannelzRegistry;
import io.grpc.ServerTransportFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -49,11 +47,6 @@ public List<ServerTransportFilter> serverTransportFilterList() {
return List.of();
}

@Bean
public ChannelzRegistry channelzRegistry() {
return new DefaultChannelzRegistry();
}


@Bean
public CollectorGrpcSpanFactory collectorGrpcSpanFactory(SpanEventFilter spanEventFilter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.receiver.grpc.channelz;
package com.navercorp.pinpoint.collector.grpc.channelz;

import com.navercorp.pinpoint.grpc.channelz.ChannelzRegistry;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.service;
package com.navercorp.pinpoint.collector.grpc.channelz.service;

import com.google.common.util.concurrent.ListenableFuture;
import io.grpc.InternalChannelz.ServerStats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.service;
package com.navercorp.pinpoint.collector.grpc.channelz.service;

import com.navercorp.pinpoint.collector.service.ChannelzService.ServerStatsWithId;
import com.navercorp.pinpoint.collector.service.ChannelzService.SocketStatsWithId;
import com.navercorp.pinpoint.collector.service.ChannelzTestUtils.SimpleInternalInstrumented;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzService.ServerStatsWithId;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzService.SocketStatsWithId;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzTestUtils.SimpleInternalInstrumented;
import com.navercorp.pinpoint.grpc.channelz.ChannelzRegistry;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ServerStats;
Expand All @@ -32,8 +32,8 @@

import java.util.List;

import static com.navercorp.pinpoint.collector.service.ChannelzTestUtils.mockServerStats;
import static com.navercorp.pinpoint.collector.service.ChannelzTestUtils.mockSocketStats;
import static com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzTestUtils.mockServerStats;
import static com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzTestUtils.mockSocketStats;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.service;
package com.navercorp.pinpoint.collector.grpc.channelz.service;

import com.navercorp.pinpoint.collector.service.ChannelzSocketLookup.SocketEntry;
import com.navercorp.pinpoint.collector.service.ChannelzTestUtils.SimpleInternalInstrumented;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzSocketLookup.SocketEntry;
import com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzTestUtils.SimpleInternalInstrumented;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.ServerStats;
import io.grpc.InternalChannelz.SocketStats;
Expand All @@ -29,8 +29,8 @@
import java.util.Collection;
import java.util.List;

import static com.navercorp.pinpoint.collector.service.ChannelzTestUtils.mockServerStats;
import static com.navercorp.pinpoint.collector.service.ChannelzTestUtils.mockSocketStats;
import static com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzTestUtils.mockServerStats;
import static com.navercorp.pinpoint.collector.grpc.channelz.service.ChannelzTestUtils.mockSocketStats;
import static org.assertj.core.api.Assertions.assertThat;

/**
Expand Down