forked from apache/skywalking
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some new thread metric and class metric to JVMMetric(apache#7230)
- Loading branch information
1 parent
04bb667
commit 2e2a008
Showing
11 changed files
with
257 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...gent-core/src/main/java/org/apache/skywalking/apm/agent/core/jvm/clazz/ClassProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.skywalking.apm.agent.core.jvm.clazz; | ||
|
||
import java.lang.management.ClassLoadingMXBean; | ||
import java.lang.management.ManagementFactory; | ||
import org.apache.skywalking.apm.network.language.agent.v3.Class; | ||
|
||
public enum ClassProvider { | ||
INSTANCE; | ||
private final ClassLoadingMXBean classLoadingMXBean; | ||
|
||
ClassProvider() { | ||
this.classLoadingMXBean = ManagementFactory.getClassLoadingMXBean(); | ||
} | ||
|
||
public Class getClassMetrics() { | ||
int loadedClassCount = classLoadingMXBean.getLoadedClassCount(); | ||
long unloadedClassCount = classLoadingMXBean.getUnloadedClassCount(); | ||
long totalLoadedClassCount = classLoadingMXBean.getTotalLoadedClassCount(); | ||
return Class.newBuilder().setLoadedClassCount(loadedClassCount) | ||
.setUnloadedClassCount(unloadedClassCount) | ||
.setTotalLoadedClassCount(totalLoadedClassCount) | ||
.build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...e/src/main/java/org/apache/skywalking/oap/server/core/source/ServiceInstanceJVMClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.skywalking.oap.server.core.source; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SERVICE_INSTANCE_CATALOG_NAME; | ||
import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SERVICE_INSTANCE_JVM_CLASS; | ||
|
||
@ScopeDeclaration(id = SERVICE_INSTANCE_JVM_CLASS, name = "ServiceInstanceJVMClass", catalog = SERVICE_INSTANCE_CATALOG_NAME) | ||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class) | ||
public class ServiceInstanceJVMClass extends Source { | ||
@Override | ||
public int scope() { | ||
return SERVICE_INSTANCE_JVM_CLASS; | ||
} | ||
|
||
@Override | ||
public String getEntityId() { | ||
return String.valueOf(id); | ||
} | ||
|
||
@Getter | ||
@Setter | ||
private String id; | ||
@Getter | ||
@Setter | ||
@ScopeDefaultColumn.DefinedByField(columnName = "name", requireDynamicActive = true) | ||
private String name; | ||
@Getter | ||
@Setter | ||
@ScopeDefaultColumn.DefinedByField(columnName = "service_name", requireDynamicActive = true) | ||
private String serviceName; | ||
@Getter | ||
@Setter | ||
@ScopeDefaultColumn.DefinedByField(columnName = "service_id") | ||
private String serviceId; | ||
@Getter | ||
@Setter | ||
private long loadedClassCount; | ||
@Getter | ||
@Setter | ||
private long unloadedClassCount; | ||
@Getter | ||
@Setter | ||
private long totalLoadedClassCount; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters