Follow protocol grammar fix `GCPhrase -> GCPhase` (#90)

This commit is contained in:
吴晟 Wu Sheng 2022-01-12 23:10:58 +08:00 committed by GitHub
parent dfda1aafca
commit 7b160b5fec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 9 deletions

View File

@ -19,6 +19,7 @@ Release Notes.
* Add support `returnedObj` expression for apm-customize-enhance-plugin
* Fix the bug that httpasyncclient-4.x-plugin puts the dirty tracing context in the connection context
* Compatible with the versions after dubbo-2.7.14
* Follow protocol grammar fix `GCPhrase -> GCPhase`.
#### Documentation

@ -1 +1 @@
Subproject commit e626ee04850703c220f64b642d2893fa65572943
Subproject commit 667134d08ffd63122062971d320c34e7e10a7c9e

View File

@ -22,7 +22,7 @@ import java.lang.management.GarbageCollectorMXBean;
import java.util.LinkedList;
import java.util.List;
import org.apache.skywalking.apm.network.language.agent.v3.GC;
import org.apache.skywalking.apm.network.language.agent.v3.GCPhrase;
import org.apache.skywalking.apm.network.language.agent.v3.GCPhase;
public abstract class GCModule implements GCMetricAccessor {
private List<GarbageCollectorMXBean> beans;
@ -41,11 +41,11 @@ public abstract class GCModule implements GCMetricAccessor {
List<GC> gcList = new LinkedList<GC>();
for (GarbageCollectorMXBean bean : beans) {
String name = bean.getName();
GCPhrase phrase;
GCPhase phase;
long gcCount = 0;
long gcTime = 0;
if (name.equals(getNewGCName())) {
phrase = GCPhrase.NEW;
phase = GCPhase.NEW;
long collectionCount = bean.getCollectionCount();
gcCount = collectionCount - lastYGCCount;
lastYGCCount = collectionCount;
@ -54,7 +54,7 @@ public abstract class GCModule implements GCMetricAccessor {
gcTime = time - lastYGCCollectionTime;
lastYGCCollectionTime = time;
} else if (name.equals(getOldGCName())) {
phrase = GCPhrase.OLD;
phase = GCPhase.OLD;
long collectionCount = bean.getCollectionCount();
gcCount = collectionCount - lastOGCCount;
lastOGCCount = collectionCount;
@ -66,7 +66,7 @@ public abstract class GCModule implements GCMetricAccessor {
continue;
}
gcList.add(GC.newBuilder().setPhrase(phrase).setCount(gcCount).setTime(gcTime).build());
gcList.add(GC.newBuilder().setPhase(phase).setCount(gcCount).setTime(gcTime).build());
}
return gcList;

View File

@ -21,14 +21,14 @@ package org.apache.skywalking.apm.agent.core.jvm.gc;
import java.util.LinkedList;
import java.util.List;
import org.apache.skywalking.apm.network.language.agent.v3.GC;
import org.apache.skywalking.apm.network.language.agent.v3.GCPhrase;
import org.apache.skywalking.apm.network.language.agent.v3.GCPhase;
public class UnknowGC implements GCMetricAccessor {
@Override
public List<GC> getGCList() {
List<GC> gcList = new LinkedList<GC>();
gcList.add(GC.newBuilder().setPhrase(GCPhrase.NEW).build());
gcList.add(GC.newBuilder().setPhrase(GCPhrase.OLD).build());
gcList.add(GC.newBuilder().setPhase(GCPhase.NEW).build());
gcList.add(GC.newBuilder().setPhase(GCPhase.OLD).build());
return gcList;
}
}