Skip to content

Commit

Permalink
Display memory pool pinpoint-apm#628
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidmalina committed Dec 17, 2015
1 parent 78b3374 commit e578059
Show file tree
Hide file tree
Showing 37 changed files with 4,339 additions and 3,089 deletions.
3 changes: 3 additions & 0 deletions agent/src/main/resources/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ profiler.enable=true

profiler.jvm.collect.interval=1000

# Allow to add detailed collector's metrics
profiler.jvm.collect.detailed.metrics=true

# Allow sampling.
profiler.sampling.enable=true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public static ProfilerConfig load(String pinpointConfigFileName) throws IOExcept
private int ioBufferingBufferSize;

private int profileJvmCollectInterval;
private boolean profilerJvmCollectDetailedMetrics;

private Filter<String> profilableClassFilter = new SkipFilter<String>();

Expand Down Expand Up @@ -316,6 +317,16 @@ public int getProfileJvmCollectInterval() {
return profileJvmCollectInterval;
}

@Override
public boolean isProfilerJvmCollectDetailedMetrics() {
return profilerJvmCollectDetailedMetrics;
}

@Override
public void setProfilerJvmCollectDetailedMetrics(boolean profilerJvmCollectDetailedMetrics) {
this.profilerJvmCollectDetailedMetrics = profilerJvmCollectDetailedMetrics;
}

@Override
public long getAgentInfoSendRetryInterval() {
return agentInfoSendRetryInterval;
Expand Down Expand Up @@ -639,6 +650,7 @@ void readPropertyValues() {

// JVM
this.profileJvmCollectInterval = readInt("profiler.jvm.collect.interval", 1000);
this.profilerJvmCollectDetailedMetrics = readBoolean("profiler.jvm.collect.detailed.metrics", false);

this.agentInfoSendRetryInterval = readLong("profiler.agentInfo.send.retry.interval", DEFAULT_AGENT_INFO_SEND_RETRY_INTERVAL);

Expand Down Expand Up @@ -871,4 +883,5 @@ public String toString() {
builder.append("}");
return builder.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public interface ProfilerConfig {

int getProfileJvmCollectInterval();

boolean isProfilerJvmCollectDetailedMetrics();

void setProfilerJvmCollectDetailedMetrics(boolean profilerJvmCollectDetailedMetrics);

long getAgentInfoSendRetryInterval();

boolean isTomcatHidePinpointHeader();
Expand Down
6 changes: 3 additions & 3 deletions collector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@

<!-- serving performance metrics -->
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-jvm</artifactId>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlets</artifactId>
</dependency>
<dependency>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<jdk.version>1.6</jdk.version>
<jdk.home>${env.JAVA_6_HOME}</jdk.home>
<slf4j.version>1.7.5</slf4j.version>
<metrics.version>3.0.1</metrics.version>
<metrics.version>3.1.2</metrics.version>
<spring.version>4.1.8.RELEASE</spring.version>
<jetty.version>8.1.12.v20130726</jetty.version>
<codehaus.jackson.version>1.9.13</codehaus.jackson.version>
Expand Down Expand Up @@ -251,17 +251,17 @@

<!-- serving performance metrics -->
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>${metrics.version}</version>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-jvm</artifactId>
<version>${metrics.version}</version>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlets</artifactId>
<version>${metrics.version}</version>
</dependency>
Expand Down
8 changes: 4 additions & 4 deletions profiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,20 @@

<!-- serving performance metrics -->
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-jvm</artifactId>
</dependency>
<!--<dependency> -->
<!--<groupId>com.codahale.metrics</groupId> -->
<!--<groupId>io.dropwizard.metrics</groupId> -->
<!--<artifactId>metrics-json</artifactId> -->
<!--<version>${metrics.version}</version> -->
<!--</dependency> -->
<!--<dependency> -->
<!--<groupId>com.codahale.metrics</groupId> -->
<!--<groupId>io.dropwizard.metrics</groupId> -->
<!--<artifactId>metrics-healthchecks</artifactId> -->
<!--<version>${metrics.version}</version> -->
<!--</dependency> -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public DefaultAgent(AgentOption agentOption, final InterceptorRegistryBinder int
this.agentInfoSender = new AgentInfoSender.Builder(tcpDataSender, this.agentInformation).sendInterval(profilerConfig.getAgentInfoSendRetryInterval()).build();
this.serverMetaDataHolder.addListener(this.agentInfoSender);

AgentStatCollectorFactory agentStatCollectorFactory = new AgentStatCollectorFactory(this.getTransactionCounter(this.traceContext));
AgentStatCollectorFactory agentStatCollectorFactory = new AgentStatCollectorFactory(this.getTransactionCounter(this.traceContext), this.profilerConfig);
this.agentStatMonitor = new AgentStatMonitor(this.statDataSender, this.agentInformation.getAgentId(), this.agentInformation.getStartTime(), agentStatCollectorFactory);

InterceptorInvokerHelper.setPropagateException(profilerConfig.isPropagateInterceptorException());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@

package com.navercorp.pinpoint.profiler.monitor.codahale;

import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
import com.navercorp.pinpoint.profiler.context.TransactionCounter;
import com.navercorp.pinpoint.profiler.monitor.MonitorName;
import com.navercorp.pinpoint.profiler.monitor.codahale.cpu.CpuLoadCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.cpu.metric.CpuLoadMetricSet;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.CmsCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.CmsDetailedMetricsCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.G1Collector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.G1DetailedMetricsCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.GarbageCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.ParallelCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.ParallelDetailedMetricsCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.SerialCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.SerialDetailedMetricsCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.gc.UnknownGarbageCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.tps.TransactionMetricCollector;
import com.navercorp.pinpoint.profiler.monitor.codahale.tps.metric.TransactionMetricSet;
Expand All @@ -49,9 +54,9 @@ public class AgentStatCollectorFactory {
private final CpuLoadCollector cpuLoadCollector;
private final TransactionMetricCollector transactionMetricCollector;

public AgentStatCollectorFactory(TransactionCounter transactionCounter) {
public AgentStatCollectorFactory(TransactionCounter transactionCounter, ProfilerConfig profilerConfig) {
this.monitorRegistry = createRegistry();
this.garbageCollector = createGarbageCollector();
this.garbageCollector = createGarbageCollector(profilerConfig.isProfilerJvmCollectDetailedMetrics());
this.cpuLoadCollector = createCpuLoadCollector();
this.transactionMetricCollector = createTransactionMetricCollector(transactionCounter);
}
Expand All @@ -64,24 +69,36 @@ private MetricMonitorRegistry createRegistry() {
/**
* create with garbage collector types based on metric registry keys
*/
private GarbageCollector createGarbageCollector() {
private GarbageCollector createGarbageCollector(boolean collectDetailedMetrics) {
MetricMonitorRegistry registry = this.monitorRegistry;
registry.registerJvmMemoryMonitor(new MonitorName(MetricMonitorValues.JVM_MEMORY));
registry.registerJvmGcMonitor(new MonitorName(MetricMonitorValues.JVM_GC));

Collection<String> keys = registry.getRegistry().getNames();
GarbageCollector garbageCollectorToReturn;
if (keys.contains(JVM_GC_SERIAL_MSC_COUNT)) {
garbageCollectorToReturn = new SerialCollector(registry);
} else if (keys.contains(JVM_GC_PS_MS_COUNT)) {
garbageCollectorToReturn = new ParallelCollector(registry);
} else if (keys.contains(JVM_GC_CMS_COUNT)) {
garbageCollectorToReturn = new CmsCollector(registry);
} else if (keys.contains(JVM_GC_G1_OLD_COUNT)) {
garbageCollectorToReturn = new G1Collector(registry);
GarbageCollector garbageCollectorToReturn = new UnknownGarbageCollector();

if (collectDetailedMetrics) {
if (keys.contains(JVM_GC_SERIAL_OLDGEN_COUNT)) {
garbageCollectorToReturn = new SerialDetailedMetricsCollector(registry);
} else if (keys.contains(JVM_GC_PS_OLDGEN_COUNT)) {
garbageCollectorToReturn = new ParallelDetailedMetricsCollector(registry);
} else if (keys.contains(JVM_GC_CMS_OLDGEN_COUNT)) {
garbageCollectorToReturn = new CmsDetailedMetricsCollector(registry);
} else if (keys.contains(JVM_GC_G1_OLDGEN_COUNT)) {
garbageCollectorToReturn = new G1DetailedMetricsCollector(registry);
}
} else {
garbageCollectorToReturn = new UnknownGarbageCollector();
if (keys.contains(JVM_GC_SERIAL_OLDGEN_COUNT)) {
garbageCollectorToReturn = new SerialCollector(registry);
} else if (keys.contains(JVM_GC_PS_OLDGEN_COUNT)) {
garbageCollectorToReturn = new ParallelCollector(registry);
} else if (keys.contains(JVM_GC_CMS_OLDGEN_COUNT)) {
garbageCollectorToReturn = new CmsCollector(registry);
} else if (keys.contains(JVM_GC_G1_OLDGEN_COUNT)) {
garbageCollectorToReturn = new G1Collector(registry);
}
}

if (logger.isInfoEnabled()) {
logger.info("found : {}", garbageCollectorToReturn);
}
Expand Down
Loading

0 comments on commit e578059

Please # to comment.