Skip to content
Permalink
Browse files

added prometheus metrics: used non-heap memory, used buffered memory,…

… used physical memory, used swap space, loaded classes count
  • Loading branch information
evernat committed Aug 22, 2019
1 parent 4e01f28 commit a704562bb6d872d111e0c15185a2bdc13640d644
@@ -189,27 +189,27 @@ public double getUsedPermGenPercentage() {
return -1d;
}

long getUsedNonHeapMemory() {
public long getUsedNonHeapMemory() {
return usedNonHeapMemory;
}

long getUsedBufferedMemory() {
public long getUsedBufferedMemory() {
return usedBufferedMemory;
}

int getLoadedClassesCount() {
public int getLoadedClassesCount() {
return loadedClassesCount;
}

public long getGarbageCollectionTimeMillis() {
return garbageCollectionTimeMillis;
}

long getUsedPhysicalMemorySize() {
public long getUsedPhysicalMemorySize() {
return usedPhysicalMemorySize;
}

long getUsedSwapSpaceSize() {
public long getUsedSwapSpaceSize() {
return usedSwapSpaceSize;
}

@@ -536,6 +536,25 @@ private void reportOnMemoryInformations(MemoryInformations memoryInformations) {

printDouble(MetricType.COUNTER, "memory_gc_millis", "gc time millis",
memoryInformations.getGarbageCollectionTimeMillis());

if (memoryInformations.getUsedBufferedMemory() >= 0) {
printLong(MetricType.GAUGE, "memory_used_buffered_bytes",
"used buffered memory in bytes", memoryInformations.getUsedBufferedMemory());
}
printLong(MetricType.GAUGE, "memory_used_non_heap_bytes", "used non-heap memory in bytes",
memoryInformations.getUsedNonHeapMemory());
if (memoryInformations.getUsedSwapSpaceSize() >= 0) {
printLong(MetricType.GAUGE, "memory_used_swap_space_bytes",
"used memory in the OS swap space in bytes",
memoryInformations.getUsedSwapSpaceSize());
}
if (memoryInformations.getUsedPhysicalMemorySize() > 0) {
printLong(MetricType.GAUGE, "memory_used_physical_bytes",
"used memory in the OS in bytes",
memoryInformations.getUsedPhysicalMemorySize());
}
printLong(MetricType.GAUGE, "loaded_classes_count", "loaded classes count",
memoryInformations.getLoadedClassesCount());
}

/**

0 comments on commit a704562

Please sign in to comment.
You can’t perform that action at this time.