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

[#11267] Use micrometer metric as default #11349

Merged
merged 1 commit into from
Aug 14, 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
17 changes: 0 additions & 17 deletions collector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 +262,6 @@
<scope>test</scope>
</dependency>

<!-- serving performance metrics -->
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-jvm</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-jmx</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlets</artifactId>
</dependency>
<dependency>
<!-- servlet artifactid is odd -->
<groupId>jakarta.servlet</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

package com.navercorp.pinpoint.collector.config;

import com.navercorp.pinpoint.collector.dao.hbase.BulkOperationReporter;
import com.navercorp.pinpoint.collector.manage.HBaseManager;
import com.navercorp.pinpoint.collector.monitor.dropwizard.BulkOperationMetrics;
import com.navercorp.pinpoint.collector.monitor.dropwizard.HBaseAsyncOperationMetrics;
import com.navercorp.pinpoint.common.hbase.async.HBaseTableMultiplexerFactory;
import com.navercorp.pinpoint.common.hbase.async.HbasePutWriter;
import com.navercorp.pinpoint.common.hbase.async.LoggingHbasePutWriter;
Expand All @@ -38,8 +35,6 @@
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;

import java.util.List;

@Configuration
@Import({
CommonCacheManagerConfiguration.class,
Expand All @@ -54,11 +49,6 @@ public HbaseBatchPerformanceCounter batchPerformanceCounter() {
return new HbaseBatchPerformanceCounter();
}

@Bean
public HBaseAsyncOperationMetrics asyncOperationMetrics(List<HBaseBatchPerformance> hBaseAsyncOperationList) {
return new HBaseAsyncOperationMetrics(hBaseAsyncOperationList);
}

@Configuration
@ConditionalOnProperty(name = "hbase.client.put-writer", havingValue = "tableMultiplexer")
public static class TableMultiplexerConfig {
Expand All @@ -81,8 +71,8 @@ public HbasePutWriter hbasePutWriter(@Qualifier("batchConnectionFactory") Connec

@Bean
public HbasePutWriter spanPutWriter(@Qualifier("batchConnectionFactory") Connection connection,
HbaseBatchPerformanceCounter counter,
HbaseMultiplexerProperties properties) throws Exception {
HbaseBatchPerformanceCounter counter,
HbaseMultiplexerProperties properties) throws Exception {
HbasePutWriter writer = newPutWriter(connection, counter, properties);
logger.info("HbaseSpanPutWriter:{}", writer);
return writer;
Expand All @@ -98,16 +88,9 @@ private HbasePutWriter newPutWriter(Connection connection, HbaseBatchPerformance

}


@Bean
public BulkOperationMetrics cachedStatisticsDaoMetrics(List<BulkOperationReporter> bulkOperationReporters) {
return new BulkOperationMetrics(bulkOperationReporters);
}

@Bean
public HBaseManager hBaseManager(@Qualifier("batchPerformanceCounter") HBaseBatchPerformance hBaseAsyncOperation) {
return new HBaseManager(hBaseAsyncOperation);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

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;
Expand All @@ -28,17 +27,10 @@
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;
import com.navercorp.pinpoint.common.server.executor.ExecutorCustomizer;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
Expand All @@ -60,7 +52,6 @@

GrpcKeepAliveScheduler.class,

DropwizardConfiguration.class,
MicrometerConfiguration.class,

ChannelzConfiguration.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@

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.collector.receiver.BindAddress;
import com.navercorp.pinpoint.common.server.thread.MonitoringExecutorProperties;
import com.navercorp.pinpoint.common.server.util.CallerUtils;
import com.navercorp.pinpoint.grpc.server.ServerOption;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@

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.collector.receiver.BindAddress;
import com.navercorp.pinpoint.common.server.thread.MonitoringExecutorProperties;
import com.navercorp.pinpoint.common.server.util.CallerUtils;
import com.navercorp.pinpoint.grpc.server.ServerOption;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@

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.collector.receiver.BindAddress;
import com.navercorp.pinpoint.common.server.thread.MonitoringExecutorProperties;
import com.navercorp.pinpoint.common.server.util.CallerUtils;
import com.navercorp.pinpoint.grpc.server.ServerOption;
import jakarta.inject.Provider;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
*/
package com.navercorp.pinpoint.collector.monitor;

import com.codahale.metrics.MetricRegistry;
import com.navercorp.pinpoint.collector.monitor.dropwizard.DropwizardThreadPoolExecutorFactory;
import com.navercorp.pinpoint.collector.monitor.micrometer.MicrometerThreadPoolExecutorFactory;
import com.navercorp.pinpoint.common.server.thread.MonitoringExecutorProperties;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;

/**
* @author intr3p1d
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,36 @@
*/
package com.navercorp.pinpoint.collector.monitor.config;

import com.navercorp.pinpoint.collector.dao.hbase.BulkOperationReporter;
import com.navercorp.pinpoint.collector.monitor.MonitoredThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.collector.monitor.micrometer.BulkOperationMetrics;
import com.navercorp.pinpoint.collector.monitor.micrometer.HBaseAsyncOperationMetrics;
import com.navercorp.pinpoint.collector.monitor.micrometer.MicrometerThreadPoolExecutorFactoryProvider;
import com.navercorp.pinpoint.common.hbase.counter.HBaseBatchPerformance;
import io.grpc.ServerInterceptor;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.binder.MeterBinder;
import io.micrometer.core.instrument.binder.grpc.MetricCollectingServerInterceptor;
import io.micrometer.core.instrument.binder.logging.Log4j2Metrics;
import io.micrometer.core.instrument.binder.netty4.NettyAllocatorMetrics;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBufAllocatorMetricProvider;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.EventLoopGroup;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
* @author intr3p1d
*/
@Configuration
@ConditionalOnProperty(
value = "pinpoint.modules.collector.monitor.metric",
havingValue = "micrometer"
)
public class MicrometerConfiguration {
private final Logger logger = LogManager.getLogger(MicrometerConfiguration.class);
private static final String GRPC_INTERCEPTOR_TAG_KEY = "service";
Expand All @@ -54,10 +55,12 @@ public MicrometerConfiguration() {
}

@Bean
@ConditionalOnProperty(
value = "pinpoint.modules.collector.monitor.metric",
havingValue = "micrometer"
)
@ConditionalOnMissingBean(MeterRegistry.class)
public MeterRegistry simpleMeterRegistry() {
return new SimpleMeterRegistry();
}

@Bean
public MonitoredThreadPoolExecutorFactoryProvider micrometerMonitoredThreadPoolExecutorFactoryProvider(
MeterRegistry meterRegistry
) {
Expand Down Expand Up @@ -112,11 +115,28 @@ private Timer.Builder addTimerTag(Timer.Builder builder, String tagValue) {

@Bean
@Qualifier("monitoredByteBufAllocator")
public ByteBufAllocator monitoredByteBufAllocator(MeterRegistry meterRegistry){
public ByteBufAllocator monitoredByteBufAllocator(MeterRegistry meterRegistry) {
ByteBufAllocator allocator = PooledByteBufAllocator.DEFAULT;
if (allocator != null) {
new NettyAllocatorMetrics((ByteBufAllocatorMetricProvider) allocator).bindTo(meterRegistry);
}
return allocator;
}

@Bean
public BulkOperationMetrics cachedStatisticsDaoMetrics(
List<BulkOperationReporter> bulkOperationReporters,
MeterRegistry meterRegistry
) {
return new BulkOperationMetrics(bulkOperationReporters, meterRegistry);
}

@Bean
public HBaseAsyncOperationMetrics asyncOperationMetrics(
List<HBaseBatchPerformance> hBaseAsyncOperationList,
MeterRegistry meterRegistry
) {
return new HBaseAsyncOperationMetrics(hBaseAsyncOperationList, meterRegistry);
}

}
Loading