Skip to content

Commit b6ec641

Browse files
authored
Merge pull request #1370 from microsoft/heya/clean-up-deprecated-perfcounter
Use MetricTelemetry for PerformanceCounter metrics
2 parents 51f5a18 + ff7240d commit b6ec641

File tree

10 files changed

+53
-132
lines changed

10 files changed

+53
-132
lines changed

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/Constants.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,27 @@ public final class Constants {
3232
public final static String PROCESS_CPU_PC_ID = PERFORMANCE_COUNTER_PREFIX + "ProcessCpuPerformanceCounter";
3333

3434
public final static String TOTAL_CPU_PC_CATEGORY_NAME = "Processor";
35+
public final static String TOTAL_CPU_PC_METRIC_NAME = "\\Processor(_Total)\\% Processor Time";
36+
public final static String PROCESS_CPU_PC_METRIC_NAME = "\\Process(??APP_WIN32_PROC??)\\% Processor Time";
3537
public final static String CPU_PC_COUNTER_NAME = "% Processor Time";
3638

3739
public final static String TOTAL_MEMORY_PC_ID = PERFORMANCE_COUNTER_PREFIX + "TotalMemoryPerformanceCounter";
3840
public final static String PROCESS_MEM_PC_ID = PERFORMANCE_COUNTER_PREFIX + "ProcessMemoryPerformanceCounter";
3941

42+
public final static String PROCESS_MEM_PC_METRICS_NAME = "\\Process(??APP_WIN32_PROC??)\\Private Bytes";
4043
public final static String PROCESS_MEM_PC_COUNTER_NAME = "Private Bytes";
4144

42-
public final static String TOTAL_MEMORY_PC_CATEGORY_NAME = "Memory";
43-
public final static String TOTAL_MEMORY_PC_COUNTER_NAME = "Available Bytes";
45+
public final static String TOTAL_MEMORY_PC_METRIC_NAME = "\\Memory\\Available Bytes";
4446

4547
public final static String PROCESS_IO_PC_ID = PERFORMANCE_COUNTER_PREFIX + "ProcessIOPerformanceCounter";
48+
public final static String PROCESS_IO_PC_METRIC_NAME = "\\Process(??APP_WIN32_PROC??)\\IO Data Bytes/sec";
4649
public final static String PROCESS_IO_PC_COUNTER_NAME = "IO Data Bytes/sec";
4750

4851
public final static String INSTANCE_NAME_TOTAL = "_Total";
4952

5053
public final static String PROCESS_CATEGORY = "Process";
5154

55+
5256
private Constants() {
5357
}
5458
}

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/FreeMemoryPerformanceCounter.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
import javax.management.ObjectName;
2626

2727
import com.microsoft.applicationinsights.TelemetryClient;
28-
import com.microsoft.applicationinsights.internal.system.SystemInformation;
29-
import com.microsoft.applicationinsights.telemetry.PerformanceCounterTelemetry;
30-
import com.microsoft.applicationinsights.telemetry.Telemetry;
28+
import com.microsoft.applicationinsights.telemetry.MetricTelemetry;
3129
import org.slf4j.Logger;
3230
import org.slf4j.LoggerFactory;
3331

32+
import static com.microsoft.applicationinsights.internal.perfcounter.Constants.TOTAL_MEMORY_PC_METRIC_NAME;
33+
3434
/**
3535
* The class supplies the memory usage in Mega Bytes of the Java process the SDK is in.
3636
* <p>
@@ -61,14 +61,8 @@ public void report(TelemetryClient telemetryClient) {
6161
return;
6262
}
6363

64-
logger.trace("Performance Counter: {} {}: {}", Constants.TOTAL_MEMORY_PC_CATEGORY_NAME,
65-
Constants.TOTAL_MEMORY_PC_COUNTER_NAME, freePhysicalMemorySize);
66-
Telemetry telemetry = new PerformanceCounterTelemetry(
67-
Constants.TOTAL_MEMORY_PC_CATEGORY_NAME,
68-
Constants.TOTAL_MEMORY_PC_COUNTER_NAME,
69-
"",
70-
freePhysicalMemorySize);
71-
64+
logger.trace("Performance Counter: {}: {}", TOTAL_MEMORY_PC_METRIC_NAME, freePhysicalMemorySize);
65+
MetricTelemetry telemetry = new MetricTelemetry(TOTAL_MEMORY_PC_METRIC_NAME, freePhysicalMemorySize);
7266
telemetryClient.track(telemetry);
7367
}
7468

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/JmxMetricPerformanceCounter.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import org.slf4j.Logger;
3030
import org.slf4j.LoggerFactory;
3131

32-
import static com.microsoft.applicationinsights.internal.perfcounter.Constants.TOTAL_MEMORY_PC_COUNTER_NAME;
33-
3432
/**
3533
* A performance counter that sends {@link com.microsoft.applicationinsights.telemetry.MetricTelemetry}
3634
*
@@ -48,15 +46,7 @@ public JmxMetricPerformanceCounter(String id, String objectName, Collection<JmxA
4846
protected void send(TelemetryClient telemetryClient, String displayName, double value) {
4947
logger.trace("Metric JMX: {}, {}", displayName, value);
5048

51-
MetricTelemetry telemetry = new MetricTelemetry();
52-
telemetry.setName(displayName);
53-
telemetry.setValue(value);
54-
55-
// keep "Available Bytes" under PerformanceCounter to prevent breaking performance blade on the ApplicationInsights Portal
56-
if (displayName.equals(TOTAL_MEMORY_PC_COUNTER_NAME)) {
57-
telemetry.markAsCustomPerfCounter();
58-
}
59-
49+
MetricTelemetry telemetry = new MetricTelemetry(displayName, value);
6050
telemetryClient.track(telemetry);
6151
}
6252
}

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/ProcessCpuPerformanceCounter.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
package com.microsoft.applicationinsights.internal.perfcounter;
2323

2424
import com.microsoft.applicationinsights.TelemetryClient;
25-
import com.microsoft.applicationinsights.internal.system.SystemInformation;
26-
import com.microsoft.applicationinsights.telemetry.PerformanceCounterTelemetry;
27-
import com.microsoft.applicationinsights.telemetry.Telemetry;
25+
import com.microsoft.applicationinsights.telemetry.MetricTelemetry;
2826
import org.slf4j.Logger;
2927
import org.slf4j.LoggerFactory;
3028

29+
import static com.microsoft.applicationinsights.internal.perfcounter.Constants.PROCESS_CPU_PC_METRIC_NAME;
30+
3131
/**
3232
* The class supplies the cpu usage of the Java process the SDK is in.
3333
* <p>
@@ -72,12 +72,8 @@ public void report(TelemetryClient telemetryClient) {
7272
return;
7373
}
7474

75-
logger.trace("Performance Counter: {} {}: {}", getProcessCategoryName(), Constants.CPU_PC_COUNTER_NAME, processCpuUsage);
76-
Telemetry telemetry = new PerformanceCounterTelemetry(
77-
getProcessCategoryName(),
78-
Constants.CPU_PC_COUNTER_NAME,
79-
SystemInformation.INSTANCE.getProcessId(),
80-
processCpuUsage);
75+
logger.trace("Performance Counter: {}: {}", PROCESS_CPU_PC_METRIC_NAME, processCpuUsage);
76+
MetricTelemetry telemetry = new MetricTelemetry(PROCESS_CPU_PC_METRIC_NAME, processCpuUsage);
8177
telemetryClient.track(telemetry);
8278
}
8379
}

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/ProcessMemoryPerformanceCounter.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@
2626
import java.lang.management.MemoryUsage;
2727

2828
import com.microsoft.applicationinsights.TelemetryClient;
29-
import com.microsoft.applicationinsights.internal.system.SystemInformation;
3029
import com.microsoft.applicationinsights.telemetry.MetricTelemetry;
31-
import com.microsoft.applicationinsights.telemetry.PerformanceCounterTelemetry;
32-
import com.microsoft.applicationinsights.telemetry.Telemetry;
3330
import org.slf4j.Logger;
3431
import org.slf4j.LoggerFactory;
3532

36-
import static com.microsoft.applicationinsights.internal.perfcounter.Constants.PROCESS_MEM_PC_COUNTER_NAME;
33+
import static com.microsoft.applicationinsights.internal.perfcounter.Constants.PROCESS_MEM_PC_METRICS_NAME;
3734

3835
/**
3936
* The class supplies the memory usage in Mega Bytes of the Java process the SDK is in.
@@ -62,8 +59,8 @@ public void report(TelemetryClient telemetryClient) {
6259
double memoryBytes = (double)heapMemoryUsage.getUsed();
6360
memoryBytes += (double)nonHeapMemoryUsage.getUsed();
6461

65-
logger.trace("Performance Counter: {} {}: {}", getProcessCategoryName(), PROCESS_MEM_PC_COUNTER_NAME, memoryBytes);
66-
MetricTelemetry metricTelemetry = new MetricTelemetry(PROCESS_MEM_PC_COUNTER_NAME, memoryBytes);
62+
logger.trace("Performance Counter: {}: {}", PROCESS_MEM_PC_METRICS_NAME, memoryBytes);
63+
MetricTelemetry metricTelemetry = new MetricTelemetry(PROCESS_MEM_PC_METRICS_NAME, memoryBytes);
6764
telemetryClient.track(metricTelemetry);
6865
}
6966
}

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/UnixProcessIOPerformanceCounter.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626

2727
import com.microsoft.applicationinsights.TelemetryClient;
2828
import com.microsoft.applicationinsights.internal.system.SystemInformation;
29-
import com.microsoft.applicationinsights.telemetry.PerformanceCounterTelemetry;
30-
import com.microsoft.applicationinsights.telemetry.Telemetry;
29+
import com.microsoft.applicationinsights.telemetry.MetricTelemetry;
3130
import org.slf4j.Logger;
3231
import org.slf4j.LoggerFactory;
3332

33+
import static com.microsoft.applicationinsights.internal.perfcounter.Constants.PROCESS_IO_PC_METRIC_NAME;
34+
3435
/**
3536
* The class knows how to supply the io usage of the current process under the Unix OS.
3637
*
@@ -75,13 +76,8 @@ public void report(TelemetryClient telemetryClient) {
7576
double value = (processIO - prevProcessIO) / timeElapsedInSeconds;
7677
prevProcessIO = processIO;
7778

78-
logger.trace("Sending Performance Counter: {} {}: {}", getProcessCategoryName(), Constants.PROCESS_IO_PC_COUNTER_NAME, value);
79-
Telemetry telemetry = new PerformanceCounterTelemetry(
80-
getProcessCategoryName(),
81-
Constants.PROCESS_IO_PC_COUNTER_NAME,
82-
SystemInformation.INSTANCE.getProcessId(),
83-
value);
84-
79+
logger.trace("Sending Performance Counter: {} {}: {}", getProcessCategoryName(), PROCESS_IO_PC_METRIC_NAME, value);
80+
MetricTelemetry telemetry = new MetricTelemetry(PROCESS_IO_PC_METRIC_NAME, value);
8581
telemetryClient.track(telemetry);
8682
}
8783

@@ -108,7 +104,7 @@ public Double getCurrentIOForCurrentProcess() {
108104
result = parser.getValue();
109105
} catch (Exception e) {
110106
result = null;
111-
logPerfCounterErrorError("Error while parsing file: '{}'", getId(), e);
107+
logPerfCounterErrorError("Error while parsing file: '{}'", PROCESS_IO_PC_METRIC_NAME, e);
112108
} finally {
113109
if (bufferedReader != null ) {
114110
try {

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/UnixTotalCpuPerformanceCounter.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
import java.util.ArrayList;
2727

2828
import com.microsoft.applicationinsights.TelemetryClient;
29-
import com.microsoft.applicationinsights.telemetry.PerformanceCounterTelemetry;
30-
import com.microsoft.applicationinsights.telemetry.Telemetry;
29+
import com.microsoft.applicationinsights.telemetry.MetricTelemetry;
3130

3231
import com.google.common.base.Strings;
3332
import org.slf4j.Logger;
3433
import org.slf4j.LoggerFactory;
3534

35+
import static com.microsoft.applicationinsights.internal.perfcounter.Constants.TOTAL_CPU_PC_METRIC_NAME;
36+
3637
/**
3738
* The class supplies the overall cpu usage of the machine.
3839
*
@@ -83,13 +84,8 @@ public void report(TelemetryClient telemetryClient) {
8384

8485
double totalCpuUsage = calculateTotalCpuUsage(array);
8586

86-
logger.trace("Sending Performance Counter: {} {} {}: {}", Constants.TOTAL_CPU_PC_CATEGORY_NAME, Constants.CPU_PC_COUNTER_NAME, Constants.INSTANCE_NAME_TOTAL, totalCpuUsage);
87-
Telemetry telemetry = new PerformanceCounterTelemetry(
88-
Constants.TOTAL_CPU_PC_CATEGORY_NAME,
89-
Constants.CPU_PC_COUNTER_NAME,
90-
Constants.INSTANCE_NAME_TOTAL,
91-
totalCpuUsage);
92-
87+
logger.trace("Sending Performance Counter: {}: {}", TOTAL_CPU_PC_METRIC_NAME, totalCpuUsage);
88+
MetricTelemetry telemetry = new MetricTelemetry(TOTAL_CPU_PC_METRIC_NAME, totalCpuUsage);
9389
telemetryClient.track(telemetry);
9490
}
9591
}

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/WindowsPerformanceCounterAsPC.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.common.base.Preconditions;
2828
import com.microsoft.applicationinsights.TelemetryClient;
2929
import com.microsoft.applicationinsights.internal.system.SystemInformation;
30+
import com.microsoft.applicationinsights.telemetry.MetricTelemetry;
3031
import com.microsoft.applicationinsights.telemetry.PerformanceCounterTelemetry;
3132

3233
import com.google.common.base.Strings;
@@ -56,8 +57,9 @@ public final class WindowsPerformanceCounterAsPC extends AbstractWindowsPerforma
5657
public WindowsPerformanceCounterAsPC() throws Throwable {
5758
Preconditions.checkState(SystemInformation.INSTANCE.isWindows(), "Must be used under Windows OS.");
5859

59-
register(Constants.TOTAL_CPU_PC_CATEGORY_NAME, Constants.CPU_PC_COUNTER_NAME, Constants.INSTANCE_NAME_TOTAL);
60-
register(Constants.PROCESS_CATEGORY, Constants.PROCESS_IO_PC_COUNTER_NAME, JniPCConnector.translateInstanceName(JniPCConnector.PROCESS_SELF_INSTANCE_NAME));
60+
register(Constants.TOTAL_CPU_PC_CATEGORY_NAME, Constants.CPU_PC_COUNTER_NAME, Constants.INSTANCE_NAME_TOTAL, Constants.TOTAL_CPU_PC_METRIC_NAME);
61+
register(Constants.PROCESS_CATEGORY, Constants.PROCESS_IO_PC_COUNTER_NAME, JniPCConnector.translateInstanceName(JniPCConnector.PROCESS_SELF_INSTANCE_NAME),
62+
Constants.PROCESS_IO_PC_METRIC_NAME);
6163

6264
if (pcs.isEmpty()) {
6365
// Failed to register, the performance counter is not needed.
@@ -100,7 +102,7 @@ public String getId() {
100102
}
101103

102104
private void send(TelemetryClient telemetryClient, double value, WindowsPerformanceCounterData data) {
103-
PerformanceCounterTelemetry telemetry = new PerformanceCounterTelemetry(data.categoryName, data.counterName, data.instanceName, value);
105+
MetricTelemetry telemetry = new MetricTelemetry(data.getDisplayName(), value);
104106
telemetryClient.track(telemetry);
105107
}
106108

@@ -111,15 +113,15 @@ private void send(TelemetryClient telemetryClient, double value, WindowsPerforma
111113
* @param counter The counter
112114
* @param instance The instnace
113115
*/
114-
private void register(String category, String counter, String instance) {
116+
private void register(String category, String counter, String instance, String metricName) {
115117
String key = JniPCConnector.addPerformanceCounter(category, counter, instance);
116118
if (!Strings.isNullOrEmpty(key)) {
117119
try {
118120
WindowsPerformanceCounterData data = new WindowsPerformanceCounterData().
119121
setCategoryName(category).
120122
setCounterName(counter).
121123
setInstanceName(instance).
122-
setDisplayName(category + " " + counter);
124+
setDisplayName(metricName);
123125
pcs.put(key, data);
124126
} catch (ThreadDeath td) {
125127
throw td;

core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/jvm/JvmHeapMemoryUsedPerformanceCounter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class JvmHeapMemoryUsedPerformanceCounter implements PerformanceCounter {
3838

3939
public final static String NAME = "MemoryUsage";
4040

41-
private final static String HEAP_MEM_USED = "Heap Memory Used (MB)";
41+
private final static String HEAP_MEM_USED = "Heap Memory Used (MB)";
4242

4343
private static final long Megabyte = 1024 * 1024;
4444

test/smoke/testApps/AutoPerfCounters/src/smokeTest/java/com/microsoft/applicationinsights/smoketest/PerfCountersDataTest.java

Lines changed: 14 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
import com.google.common.base.Preconditions;
44
import com.google.common.base.Predicate;
5-
import com.microsoft.applicationinsights.internal.schemav2.Base;
6-
import com.microsoft.applicationinsights.internal.schemav2.Data;
75
import com.microsoft.applicationinsights.internal.schemav2.DataPoint;
86
import com.microsoft.applicationinsights.internal.schemav2.DataPointType;
97
import com.microsoft.applicationinsights.internal.schemav2.Envelope;
108
import com.microsoft.applicationinsights.internal.schemav2.MetricData;
11-
import com.microsoft.applicationinsights.internal.schemav2.PerformanceCounterData;
129
import org.junit.*;
1310

1411
import javax.annotation.Nullable;
@@ -26,37 +23,25 @@ public void testPerformanceCounterData() throws Exception {
2623
System.out.println("Waiting for performance data...");
2724
long start = System.currentTimeMillis();
2825

29-
// we should get these envelopes:
30-
// MetricData, metrics.name="Suspected Deadlocked Threads"
31-
// MetricData, metrics.name="Heap Memory Used (MB)"
32-
// MetricData, metrics.name="GC Total Count"
33-
// MetricData, metrics.name="GC Total Time"
34-
// PerformanceCounterData, categoryName=Memory, counterName=Available Bytes
35-
// PerformanceCounterData, category=Process, counter="IO Data Bytes/sec"
36-
// PerformanceCounterData, category=Processor, counter="% Processor Time", instance="_Total"
37-
// PerformanceCounterData, category=Process, counter=Private Bytes
38-
// PerformanceCounterData, Process, "% Processor Time"
39-
40-
Envelope availableMem = mockedIngestion.waitForItem(getPerfCounterPredicate("Memory", "Available Bytes"), 150, TimeUnit.SECONDS);
41-
Envelope totalCpu = mockedIngestion.waitForItem(getPerfCounterPredicate("Processor", "% Processor Time", "_Total"), 150, TimeUnit.SECONDS);
42-
43-
Envelope processIo = mockedIngestion.waitForItem(getPerfCounterPredicate("Process", "IO Data Bytes/sec"), 150, TimeUnit.SECONDS);
44-
Envelope processMemUsed = mockedIngestion.waitForItem(getPerfMetricPredicate("Private Bytes"), 150, TimeUnit.SECONDS);
45-
Envelope processCpu = mockedIngestion.waitForItem(getPerfCounterPredicate("Process", "% Processor Time"), 150, TimeUnit.SECONDS);
26+
Envelope availableMem = mockedIngestion.waitForItem(getPerfMetricPredicate("\\Memory\\Available Bytes"), 150, TimeUnit.SECONDS);
27+
Envelope totalCpu = mockedIngestion.waitForItem(getPerfMetricPredicate("\\Processor(_Total)\\% Processor Time"), 150, TimeUnit.SECONDS);
28+
29+
Envelope processIo = mockedIngestion.waitForItem(getPerfMetricPredicate("\\Process(??APP_WIN32_PROC??)\\IO Data Bytes/sec"), 150, TimeUnit.SECONDS);
30+
Envelope processMemUsed = mockedIngestion.waitForItem(getPerfMetricPredicate("\\Process(??APP_WIN32_PROC??)\\Private Bytes"), 150, TimeUnit.SECONDS);
31+
Envelope processCpu = mockedIngestion.waitForItem(getPerfMetricPredicate("\\Process(??APP_WIN32_PROC??)\\% Processor Time"), 150, TimeUnit.SECONDS);
4632
System.out.println("PerformanceCounterData are good: " + (System.currentTimeMillis() - start));
4733

48-
PerformanceCounterData pdMem = getBaseData(availableMem);
49-
assertPerfCounter(pdMem);
50-
assertNull(pdMem.getInstanceName());
34+
MetricData metricMem = getBaseData(availableMem);
35+
assertPerfMetric(metricMem);
36+
assertEquals("\\Memory\\Available Bytes", metricMem.getMetrics().get(0).getName());
5137

52-
PerformanceCounterData pdCpu = getBaseData(totalCpu);
53-
assertPerfCounter(pdCpu);
54-
assertEquals("_Total", pdCpu.getInstanceName());
38+
MetricData pdCpu = getBaseData(totalCpu);
39+
assertPerfMetric(pdCpu);
40+
assertEquals("\\Processor(_Total)\\% Processor Time", pdCpu.getMetrics().get(0).getName());
5541

56-
assertPerfCounter(getBaseData(processIo));
42+
assertPerfMetric(getBaseData(processIo));
5743
assertPerfMetric(getBaseData(processMemUsed));
58-
assertPerfCounter(getBaseData(processCpu));
59-
assertSameInstanceName(processIo, processCpu);
44+
assertPerfMetric(getBaseData(processCpu));
6045

6146
start = System.currentTimeMillis();
6247
System.out.println("Waiting for metric data...");
@@ -83,52 +68,13 @@ public void testPerformanceCounterData() throws Exception {
8368
assertPerfMetric(mdGcTotalTime);
8469
}
8570

86-
private void assertSameInstanceName(Envelope... envelopes) {
87-
Preconditions.checkArgument(envelopes.length > 0);
88-
PerformanceCounterData firstOne = getBaseData(envelopes[0]);
89-
String instanceName = firstOne.getInstanceName();
90-
assertNotNull(instanceName);
91-
if (envelopes.length == 1) {
92-
return;
93-
}
94-
for (int i = 1; i < envelopes.length; i++) {
95-
PerformanceCounterData pcd = getBaseData(envelopes[i]);
96-
assertEquals(instanceName, pcd.getInstanceName());
97-
}
98-
}
99-
100-
private void assertPerfCounter(PerformanceCounterData perfCounter) {
101-
assertTrue(perfCounter.getValue() > 0.0);
102-
}
103-
10471
private void assertPerfMetric(MetricData perfMetric) {
10572
List<DataPoint> metrics = perfMetric.getMetrics();
10673
assertEquals(1, metrics.size());
10774
DataPoint dp = metrics.get(0);
10875
assertEquals(DataPointType.Measurement, dp.getKind());
10976
}
11077

111-
private static Predicate<Envelope> getPerfCounterPredicate(String category, String counter) {
112-
return getPerfCounterPredicate(category, counter, null);
113-
}
114-
115-
private static Predicate<Envelope> getPerfCounterPredicate(String category, String counter, String instance) {
116-
Preconditions.checkNotNull(category, "category");
117-
Preconditions.checkNotNull(counter, "counter");
118-
return new Predicate<Envelope>() {
119-
@Override
120-
public boolean apply(@Nullable Envelope input) {
121-
Base data = input.getData();
122-
if (!data.getBaseType().equals("PerformanceCounterData")) {
123-
return false;
124-
}
125-
PerformanceCounterData pcd = getBaseData(input);
126-
return category.equals(pcd.getCategoryName()) && counter.equals(pcd.getCounterName())
127-
&& (instance == null || instance.equals(pcd.getInstanceName()));
128-
}
129-
};
130-
}
131-
13278
private static Predicate<Envelope> getPerfMetricPredicate(String name) {
13379
Preconditions.checkNotNull(name, "name");
13480
return new Predicate<Envelope>() {

0 commit comments

Comments
 (0)