本文整理汇总了Java中org.elasticsearch.monitor.jvm.JvmStats类的典型用法代码示例。如果您正苦于以下问题:Java JvmStats类的具体用法?Java JvmStats怎么用?Java JvmStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JvmStats类属于org.elasticsearch.monitor.jvm包,在下文中一共展示了JvmStats类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFrom
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
timestamp = in.readVLong();
if (in.readBoolean()) {
indices = NodeIndicesStats.readIndicesStats(in);
}
os = in.readOptionalWriteable(OsStats::new);
process = in.readOptionalWriteable(ProcessStats::new);
jvm = in.readOptionalWriteable(JvmStats::new);
threadPool = in.readOptionalWriteable(ThreadPoolStats::new);
fs = in.readOptionalWriteable(FsInfo::new);
transport = in.readOptionalWriteable(TransportStats::new);
http = in.readOptionalWriteable(HttpStats::new);
breaker = in.readOptionalWriteable(AllCircuitBreakerStats::new);
scriptStats = in.readOptionalWriteable(ScriptStats::new);
discoveryStats = in.readOptionalWriteable(DiscoveryStats::new);
ingestStats = in.readOptionalWriteable(IngestStats::new);
}
示例2: NodeStats
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices,
@Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool,
@Nullable FsInfo fs, @Nullable TransportStats transport, @Nullable HttpStats http,
@Nullable AllCircuitBreakerStats breaker,
@Nullable ScriptStats scriptStats,
@Nullable DiscoveryStats discoveryStats,
@Nullable IngestStats ingestStats) {
super(node);
this.timestamp = timestamp;
this.indices = indices;
this.os = os;
this.process = process;
this.jvm = jvm;
this.threadPool = threadPool;
this.fs = fs;
this.transport = transport;
this.http = http;
this.breaker = breaker;
this.scriptStats = scriptStats;
this.discoveryStats = discoveryStats;
this.ingestStats = ingestStats;
}
示例3: addChildImplementations
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
private void addChildImplementations(final JvmStats stats) {
childImplementations.put(FREE, new HeapExpression() {
@Override
public Long value() {
return stats.getMem().getHeapMax().bytes() - stats.getMem().getHeapUsed().bytes();
}
});
childImplementations.put(USED, new HeapExpression() {
@Override
public Long value() {
return stats.getMem().getHeapUsed().bytes();
}
});
childImplementations.put(MAX, new HeapExpression() {
@Override
public Long value() {
return stats.getMem().getHeapMax().bytes();
}
});
childImplementations.put(PROBE_TIMESTAMP, new SysNodeExpression<Long>() {
@Override
public Long value() {
return stats.getTimestamp();
}
});
}
示例4: NodeStats
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
public NodeStats(DiscoveryNode node, long timestamp, @Nullable NodeIndicesStats indices,
@Nullable OsStats os, @Nullable ProcessStats process, @Nullable JvmStats jvm, @Nullable ThreadPoolStats threadPool,
@Nullable FsInfo fs, @Nullable TransportStats transport, @Nullable HttpStats http,
@Nullable AllCircuitBreakerStats breaker,
@Nullable ScriptStats scriptStats) {
super(node);
this.timestamp = timestamp;
this.indices = indices;
this.os = os;
this.process = process;
this.jvm = jvm;
this.threadPool = threadPool;
this.fs = fs;
this.transport = transport;
this.http = http;
this.breaker = breaker;
this.scriptStats = scriptStats;
}
示例5: readFrom
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
timestamp = in.readVLong();
if (in.readBoolean()) {
indices = NodeIndicesStats.readIndicesStats(in);
}
if (in.readBoolean()) {
os = OsStats.readOsStats(in);
}
if (in.readBoolean()) {
process = ProcessStats.readProcessStats(in);
}
if (in.readBoolean()) {
jvm = JvmStats.readJvmStats(in);
}
if (in.readBoolean()) {
threadPool = ThreadPoolStats.readThreadPoolStats(in);
}
if (in.readBoolean()) {
fs = FsInfo.readFsInfo(in);
}
if (in.readBoolean()) {
transport = TransportStats.readTransportStats(in);
}
if (in.readBoolean()) {
http = HttpStats.readHttpStats(in);
}
breaker = AllCircuitBreakerStats.readOptionalAllCircuitBreakerStats(in);
scriptStats = in.readOptionalStreamable(new ScriptStats());
}
示例6: getJvm
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
/**
* JVM level statistics.
*/
@Nullable
public JvmStats getJvm() {
return jvm;
}
示例7: generateMetrics
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
@Override
public void generateMetrics(PrometheusFormatWriter writer, JvmStats jvmStats) {
logger.debug("Generating output for JVM stats: {}", jvmStats);
//Aligned with prometheus client_java
logger.debug("Now memory: {}", jvmStats.getMem());
writer.addGauge("jvm_memory_bytes_used")
.withHelp("Used bytes of a given JVM memory area.")
.value(jvmStats.getMem().getHeapUsed().getBytes(), "area", "heap")
.value(jvmStats.getMem().getNonHeapUsed().getBytes(), "area", "nonheap");
writer.addGauge("jvm_memory_bytes_committed")
.withHelp("Committed (bytes) of a given JVM memory area")
.value(jvmStats.getMem().getHeapCommitted().getBytes(), "area", "heap")
.value(jvmStats.getMem().getNonHeapCommitted().getBytes(), "area", "nonheap");
writer.addGauge("jvm_memory_bytes_max")
.withHelp("Max (bytes) of a given JVM memory area.")
.value(jvmStats.getMem().getHeapMax().getBytes(), "area", "heap");
//JVM threads
logger.debug("Now threads: {}", jvmStats.getThreads());
writer.addGauge("jvm_threads_current")
.withHelp("Current thread count of a JVM")
.value(jvmStats.getThreads().getCount());
writer.addGauge("jvm_threads_peak")
.withHelp("Peak thread count of a JVM")
.value(jvmStats.getThreads().getPeakCount());
//JVM classes
logger.debug("Now classes: {}", jvmStats.getClasses());
writer.addGauge("jvm_classes_loaded")
.withHelp("The number of classes that are currently loaded in the JVM")
.value(jvmStats.getClasses().getLoadedClassCount());
writer.addCounter("jvm_classes_loaded_total")
.withHelp("The total number of classes that have been loaded since the JVM has started execution")
.value(jvmStats.getClasses().getTotalLoadedClassCount());
writer.addCounter("jvm_classes_unloaded_total")
.withHelp("The total number of classes that have been unloaded since the JVM has started execution")
.value(jvmStats.getClasses().getUnloadedClassCount());
ValueWriter gcValueWriter = writer.addSummary("jvm_gc_collection_seconds")
.withHelp("The total number of seconds spend on GC collection");
for (GarbageCollector collector : jvmStats.getGc().getCollectors()) {
gcValueWriter.summary(collector.getCollectionCount(), collector.getCollectionTime().getMillis(), "name", collector.getName());
}
//ES custom fields
logger.debug("Now custom: {}", jvmStats.getClasses());
writer.addGauge("es_jvm_timestamp")
.withHelp("Timestamp of last JVM status scrap")
.value(jvmStats.getTimestamp());
writer.addGauge("es_jvm_uptime")
.withHelp("Node uptime in millis")
.value(jvmStats.getUptime().millis());
writer.addGauge("es_jvm_memory_heap_used_percent")
.withHelp("Heap memory of JVM (in percentage)")
.value(jvmStats.getMem().getHeapUsedPercent());
//TODO: memory pools
}
示例8: NodeHeapExpression
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
public NodeHeapExpression(JvmStats stats) {
addChildImplementations(stats);
}
示例9: sendNodeJvmStats
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
private void sendNodeJvmStats(JvmStats jvmStats)
{
String type = buildMetricName("node.jvm");
sendGauge(type, "uptime", jvmStats.uptime().seconds());
// mem
sendGauge(type + ".mem", "heapCommitted", jvmStats.mem().heapCommitted().bytes());
sendGauge(type + ".mem", "heapUsed", jvmStats.mem().heapUsed().bytes());
sendGauge(type + ".mem", "nonHeapCommitted", jvmStats.mem().nonHeapCommitted().bytes());
sendGauge(type + ".mem", "nonHeapUsed", jvmStats.mem().nonHeapUsed().bytes());
Iterator<JvmStats.MemoryPool> memoryPoolIterator = jvmStats.mem().iterator();
while (memoryPoolIterator.hasNext()) {
JvmStats.MemoryPool memoryPool = memoryPoolIterator.next();
String memoryPoolType = type + ".mem.pool." + memoryPool.name();
sendGauge(memoryPoolType, "max", memoryPool.max().bytes());
sendGauge(memoryPoolType, "used", memoryPool.used().bytes());
sendGauge(memoryPoolType, "peakUsed", memoryPool.peakUsed().bytes());
sendGauge(memoryPoolType, "peakMax", memoryPool.peakMax().bytes());
}
// threads
sendGauge(type + ".threads", "count", jvmStats.threads().count());
sendGauge(type + ".threads", "peakCount", jvmStats.threads().peakCount());
// garbage collectors
sendCount(type + ".gc", "collectionCount", jvmStats.gc().collectionCount());
sendTime(type + ".gc", "collectionTimeSeconds", jvmStats.gc().collectionTime().seconds());
for (JvmStats.GarbageCollector collector : jvmStats.gc().collectors()) {
String id = type + ".gc." + collector.name();
sendCount(id, "collectionCount", collector.collectionCount());
sendTime(id, "collectionTimeSeconds", collector.collectionTime().seconds());
JvmStats.GarbageCollector.LastGc lastGc = collector.lastGc();
String lastGcType = type + ".lastGc";
if (lastGc != null) {
sendTime(lastGcType, "time", lastGc.endTime() - lastGc.startTime());
sendGauge(lastGcType, "max", lastGc.max().bytes());
sendGauge(lastGcType, "beforeUsed", lastGc.beforeUsed().bytes());
sendGauge(lastGcType, "afterUsed", lastGc.afterUsed().bytes());
sendGauge(lastGcType, "durationSeconds", lastGc.duration().seconds());
}
}
}
示例10: sendNodeJvmStats
import org.elasticsearch.monitor.jvm.JvmStats; //导入依赖的package包/类
private void sendNodeJvmStats(JvmStats jvmStats) {
String type = buildMetricName("node.jvm");
sendInt(type, "uptime", jvmStats.uptime().seconds());
// mem
sendInt(type + ".mem", "heapCommitted", jvmStats.mem().heapCommitted().bytes());
sendInt(type + ".mem", "heapUsed", jvmStats.mem().heapUsed().bytes());
sendInt(type + ".mem", "nonHeapCommitted", jvmStats.mem().nonHeapCommitted().bytes());
sendInt(type + ".mem", "nonHeapUsed", jvmStats.mem().nonHeapUsed().bytes());
Iterator<JvmStats.MemoryPool> memoryPoolIterator = jvmStats.mem().iterator();
while (memoryPoolIterator.hasNext()) {
JvmStats.MemoryPool memoryPool = memoryPoolIterator.next();
String memoryPoolType = type + ".mem.pool." + memoryPool.name();
sendInt(memoryPoolType, "max", memoryPool.max().bytes());
sendInt(memoryPoolType, "used", memoryPool.used().bytes());
sendInt(memoryPoolType, "peakUsed", memoryPool.peakUsed().bytes());
sendInt(memoryPoolType, "peakMax", memoryPool.peakMax().bytes());
}
// threads
sendInt(type + ".threads", "count", jvmStats.threads().count());
sendInt(type + ".threads", "peakCount", jvmStats.threads().peakCount());
// garbage collectors
for (JvmStats.GarbageCollector collector : jvmStats.gc().collectors()) {
String id = type + ".gc." + collector.name();
sendInt(id, "collectionCount", collector.collectionCount());
sendInt(id, "collectionTimeSeconds", collector.collectionTime().seconds());
JvmStats.GarbageCollector.LastGc lastGc = collector.lastGc();
String lastGcType = type + ".lastGc";
if (lastGc != null) {
sendInt(lastGcType, "startTime", lastGc.startTime());
sendInt(lastGcType, "endTime", lastGc.endTime());
sendInt(lastGcType, "max", lastGc.max().bytes());
sendInt(lastGcType, "beforeUsed", lastGc.beforeUsed().bytes());
sendInt(lastGcType, "afterUsed", lastGc.afterUsed().bytes());
sendInt(lastGcType, "durationSeconds", lastGc.duration().seconds());
}
}
// TODO: bufferPools - where to get them?
}