Skip to content

Commit

Permalink
[#11267] Fix test failures and Configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
intr3p1d committed Aug 2, 2024
1 parent 668f8e2 commit 9bf2579
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import com.navercorp.pinpoint.collector.config.CollectorCommonConfiguration;
import com.navercorp.pinpoint.collector.config.CollectorConfiguration;
import com.navercorp.pinpoint.collector.config.FlinkContextModule;
import com.navercorp.pinpoint.collector.config.MicrometerConfiguration;
import com.navercorp.pinpoint.collector.config.DropwizardConfiguration;
import com.navercorp.pinpoint.collector.grpc.CollectorGrpcConfiguration;
import com.navercorp.pinpoint.collector.grpc.ssl.GrpcSslModule;
import com.navercorp.pinpoint.collector.manage.CollectorAdminConfiguration;
Expand Down Expand Up @@ -36,9 +34,6 @@

ClusterModule.class,

DropwizardConfiguration.class,
MicrometerConfiguration.class,

GrpcSslModule.class,

RealtimeCollectorModule.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import com.navercorp.pinpoint.collector.grpc.config.GrpcStatConfiguration;
import com.navercorp.pinpoint.collector.grpc.config.GrpcStatReceiverConfiguration;
import com.navercorp.pinpoint.collector.monitor.MonitoredThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.collector.monitor.config.DropwizardConfiguration;
import com.navercorp.pinpoint.collector.monitor.config.MicrometerConfiguration;
import com.navercorp.pinpoint.collector.monitor.dropwizard.DropwizardThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.collector.monitor.MonitoringExecutors;
import com.navercorp.pinpoint.collector.monitor.micrometer.MicrometerThreadPoolExecutorFactoryProvider;
Expand Down Expand Up @@ -58,6 +60,9 @@

GrpcKeepAliveScheduler.class,

DropwizardConfiguration.class,
MicrometerConfiguration.class,

ChannelzConfiguration.class
})
@ComponentScan({
Expand All @@ -72,26 +77,4 @@ public MonitoringExecutors monitoringExecutors(
) {
return new MonitoringExecutors(customizer, monitoredThreadPoolExecutorFactoryProvider);
}

@Bean
@ConditionalOnProperty(
value = "pinpoint.modules.collector.monitor.metric",
havingValue = "dropwizard", matchIfMissing = true
)
public MonitoredThreadPoolExecutorFactoryProvider dropwizardMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MetricRegistry metricRegistry
) {
return new DropwizardThreadPoolExecutorFactoryProvider(metricRegistry);
}

@Bean
@ConditionalOnProperty(
value = "pinpoint.modules.collector.monitor.metric",
havingValue = "micrometer"
)
public MonitoredThreadPoolExecutorFactoryProvider micrometerMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MeterRegistry meterRegistry
) {
return new MicrometerThreadPoolExecutorFactoryProvider(meterRegistry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,4 @@ public FactoryBean<ExecutorService> grpcAgentServerCallExecutor(MonitoringExecut
return executors.newExecutorFactoryBean(properties, beanName);
}

@Bean
public MonitoredThreadPoolExecutorFactoryProvider dropwizardMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MetricRegistry metricRegistry
) {
return new DropwizardThreadPoolExecutorFactoryProvider(metricRegistry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,4 @@ public FactoryBean<ExecutorService> grpcSpanServerExecutor(MonitoringExecutors e
return executors.newExecutorFactoryBean(properties, beanName);
}

@Bean
public MonitoredThreadPoolExecutorFactoryProvider dropwizardMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MetricRegistry metricRegistry
) {
return new DropwizardThreadPoolExecutorFactoryProvider(metricRegistry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,4 @@ public FactoryBean<ExecutorService> grpcStatServerExecutor(MonitoringExecutors e
MonitoringExecutorProperties properties = grpcStatServerExecutorProperties();
return executors.newExecutorFactoryBean(properties, beanName);
}

@Bean
public MonitoredThreadPoolExecutorFactoryProvider dropwizardMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MetricRegistry metricRegistry
) {
return new DropwizardThreadPoolExecutorFactoryProvider(metricRegistry);
}

}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package com.navercorp.pinpoint.collector.config;
package com.navercorp.pinpoint.collector.monitor.config;

import com.codahale.metrics.MetricRegistry;
import com.navercorp.pinpoint.collector.config.CollectorProperties;
import com.navercorp.pinpoint.collector.monitor.MonitoredThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.collector.monitor.dropwizard.BulkOperationMetrics;
import com.navercorp.pinpoint.collector.monitor.dropwizard.CollectorMetric;
import com.navercorp.pinpoint.collector.monitor.dropwizard.DropwizardThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.collector.monitor.dropwizard.HBaseAsyncOperationMetrics;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -44,4 +47,14 @@ public CollectorMetric collectorMetric(
return new CollectorMetric(collectorProperties, metricRegistry, hBaseAsyncOperationMetrics, cachedStatisticsDaoMetrics);
}

@Bean
@ConditionalOnProperty(
value = "pinpoint.modules.collector.monitor.metric",
havingValue = "dropwizard", matchIfMissing = true
)
public MonitoredThreadPoolExecutorFactoryProvider dropwizardMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MetricRegistry metricRegistry
) {
return new DropwizardThreadPoolExecutorFactoryProvider(metricRegistry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.collector.config;
package com.navercorp.pinpoint.collector.monitor.config;

import com.navercorp.pinpoint.collector.monitor.MonitoredThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.collector.monitor.micrometer.MicrometerThreadPoolExecutorFactoryProvider;
import io.micrometer.core.instrument.MeterRegistry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
Expand All @@ -34,4 +39,15 @@ public class MicrometerConfiguration {
public MicrometerConfiguration() {
logger.info("Install {}", MicrometerConfiguration.class.getSimpleName());
}

@Bean
@ConditionalOnProperty(
value = "pinpoint.modules.collector.monitor.metric",
havingValue = "micrometer"
)
public MonitoredThreadPoolExecutorFactoryProvider micrometerMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MeterRegistry meterRegistry
) {
return new MicrometerThreadPoolExecutorFactoryProvider(meterRegistry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,33 @@

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

import com.codahale.metrics.MetricRegistry;
import com.navercorp.pinpoint.collector.monitor.MonitoredThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.collector.monitor.MonitoringExecutors;
import com.navercorp.pinpoint.collector.monitor.dropwizard.DropwizardThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.common.server.executor.ExecutorCustomizer;
import com.navercorp.pinpoint.common.server.executor.ThreadPoolExecutorCustomizer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean;


@Configuration
@Import(MonitoringExecutors.class)
@Import({
MonitoringExecutors.class,
})
public class TestReceiverConfig {
@Bean
public ExecutorCustomizer<ThreadPoolExecutorFactoryBean> collectorExecutorCustomizer() {
return new ThreadPoolExecutorCustomizer();
}

@Bean
public MonitoredThreadPoolExecutorFactoryProvider dropwizardMonitoredThreadPoolExecutorFactoryProvider(
@Autowired(required = false) MetricRegistry metricRegistry
) {
return new DropwizardThreadPoolExecutorFactoryProvider(metricRegistry);
}
}

0 comments on commit 9bf2579

Please sign in to comment.