org.elasticsearch.transport.TransportStats Java Examples

The following examples show how to use org.elasticsearch.transport.TransportStats. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NodeStats.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: NodeStats.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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());

}
 
Example #3
Source File: PrometheusMetricsCollector.java    From elasticsearch-prometheus-exporter with Apache License 2.0 5 votes vote down vote up
private void updateTransportMetrics(TransportStats ts) {
    if (ts != null) {
        catalog.setNodeGauge("transport_server_open_number", ts.getServerOpen());

        catalog.setNodeGauge("transport_rx_packets_count", ts.getRxCount());
        catalog.setNodeGauge("transport_tx_packets_count", ts.getTxCount());

        catalog.setNodeGauge("transport_rx_bytes_count", ts.getRxSize().getBytes());
        catalog.setNodeGauge("transport_tx_bytes_count", ts.getTxSize().getBytes());
    }
}
 
Example #4
Source File: GraphiteReporter.java    From elasticsearch-graphite-plugin with Do What The F*ck You Want To Public License 5 votes vote down vote up
private void sendNodeTransportStats(TransportStats transportStats) {
    String type = buildMetricName("node.transport");
    sendInt(type, "serverOpen", transportStats.serverOpen());
    sendInt(type, "rxCount", transportStats.rxCount());
    sendInt(type, "rxSizeBytes", transportStats.rxSize().bytes());
    sendInt(type, "txCount", transportStats.txCount());
    sendInt(type, "txSizeBytes", transportStats.txSize().bytes());
}
 
Example #5
Source File: NodeStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Nullable
public TransportStats getTransport() {
    return this.transport;
}
 
Example #6
Source File: TransportStatsMonitor.java    From Raigad with Apache License 2.0 4 votes vote down vote up
@Override
public void execute() throws Exception {
    // If Elasticsearch is started then only start the monitoring
    if (!ElasticsearchProcessMonitor.isElasticsearchRunning()) {
        String exceptionMsg = "Elasticsearch is not yet started, check back again later";
        logger.info(exceptionMsg);
        return;
    }

    TransportStatsBean transportStatsBean = new TransportStatsBean();

    try {
        NodesStatsResponse nodesStatsResponse = ElasticsearchTransportClient.getNodesStatsResponse(config);
        NodeStats nodeStats = null;

        List<NodeStats> nodeStatsList = nodesStatsResponse.getNodes();

        if (nodeStatsList.size() > 0) {
            nodeStats = nodeStatsList.get(0);
        }

        if (nodeStats == null) {
            logger.info("Transport stats are not available (node stats is not available)");
            return;
        }

        TransportStats transportStats = nodeStats.getTransport();

        if (transportStats == null) {
            logger.info("Transport stats are not available");
            return;
        }

        transportStatsBean.serverOpen = transportStats.getServerOpen();
        transportStatsBean.rxCount = transportStats.getRxCount();
        transportStatsBean.rxSize = transportStats.getRxSize().getBytes();
        transportStatsBean.rxSizeDelta = transportStats.getRxSize().getBytes() - transportStatsBean.rxSize;
        transportStatsBean.txCount = transportStats.getTxCount();
        transportStatsBean.txSize = transportStats.getTxSize().getBytes();
        transportStatsBean.txSizeDelta = transportStats.getTxSize().getBytes() - transportStatsBean.txSize;
    } catch (Exception e) {
        logger.warn("Failed to load transport stats data", e);
    }

    transportStatsReporter.transportStatsBean.set(transportStatsBean);
}
 
Example #7
Source File: StubbableTransport.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public TransportStats getStats() {
    return delegate.getStats();
}
 
Example #8
Source File: MockTransport.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public TransportStats getStats() {
    throw new UnsupportedOperationException();
}