org.elasticsearch.indices.breaker.AllCircuitBreakerStats Java Examples

The following examples show how to use org.elasticsearch.indices.breaker.AllCircuitBreakerStats. 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 updateCircuitBreakersMetrics(AllCircuitBreakerStats acbs) {
    if (acbs != null) {
        for (CircuitBreakerStats cbs : acbs.getAllStats()) {
            String name = cbs.getName();
            catalog.setNodeGauge("circuitbreaker_estimated_bytes", cbs.getEstimated(), name);
            catalog.setNodeGauge("circuitbreaker_limit_bytes", cbs.getLimit(), name);
            catalog.setNodeGauge("circuitbreaker_overhead_ratio", cbs.getOverhead(), name);
            catalog.setNodeGauge("circuitbreaker_tripped_count", cbs.getTrippedCount(), name);
        }
    }
}
 
Example #4
Source File: CrateCircuitBreakerService.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public AllCircuitBreakerStats stats() {
    return esCircuitBreakerService.stats();
}
 
Example #5
Source File: NodeStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Nullable
public AllCircuitBreakerStats getBreaker() {
    return this.breaker;
}
 
Example #6
Source File: AllCircuitBreakerStatsMonitor.java    From Raigad with Apache License 2.0 4 votes vote down vote up
@Override
public void execute() throws Exception {
    // Only start monitoring if Elasticsearch is started
    if (!ElasticsearchProcessMonitor.isElasticsearchRunning()) {
        String exceptionMsg = "Elasticsearch is not yet started, check back again later";
        logger.info(exceptionMsg);
        return;
    }

    AllCircuitBreakerStatsBean allCircuitBreakerStatsBean = new AllCircuitBreakerStatsBean();

    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("Circuit breaker stats is not available (node stats is not available)");
            return;
        }

        AllCircuitBreakerStats allCircuitBreakerStats = nodeStats.getBreaker();
        if (allCircuitBreakerStats == null) {
            logger.info("Circuit breaker stats is not available");
            return;
        }

        CircuitBreakerStats[] circuitBreakerStats = allCircuitBreakerStats.getAllStats();
        if (circuitBreakerStats == null || circuitBreakerStats.length == 0) {
            logger.info("Circuit breaker stats is not available (stats are empty)");
            return;
        }

        for (CircuitBreakerStats circuitBreakerStat : circuitBreakerStats) {
            if (CircuitBreaker.FIELDDATA.equals(circuitBreakerStat.getName())) {
                allCircuitBreakerStatsBean.fieldDataEstimatedSizeInBytes = circuitBreakerStat.getEstimated();
                allCircuitBreakerStatsBean.fieldDataLimitMaximumSizeInBytes = circuitBreakerStat.getLimit();
                allCircuitBreakerStatsBean.fieldDataOverhead = circuitBreakerStat.getOverhead();
                allCircuitBreakerStatsBean.fieldDataTrippedCount = circuitBreakerStat.getTrippedCount();
            }

            if (CircuitBreaker.REQUEST.equals(circuitBreakerStat.getName())) {
                allCircuitBreakerStatsBean.requestEstimatedSizeInBytes = circuitBreakerStat.getEstimated();
                allCircuitBreakerStatsBean.requestLimitMaximumSizeInBytes = circuitBreakerStat.getLimit();
                allCircuitBreakerStatsBean.requestOverhead = circuitBreakerStat.getOverhead();
                allCircuitBreakerStatsBean.requestTrippedCount = circuitBreakerStat.getTrippedCount();
            }
        }
    } catch (Exception e) {
        logger.warn("Failed to load circuit breaker stats data", e);
    }

    allCircuitBreakerStatsReporter.allCircuitBreakerStatsBean.set(allCircuitBreakerStatsBean);
}