org.elasticsearch.indices.NodeIndicesStats Java Examples
The following examples show how to use
org.elasticsearch.indices.NodeIndicesStats.
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 |
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 |
@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: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 5 votes |
private void updateRefreshFlush(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.refreshTotal = nodeIndicesStats.getRefresh().getTotal(); nodeIndicesStatsBean.refreshTotalTime = nodeIndicesStats.getRefresh().getTotalTimeInMillis(); if (nodeIndicesStatsBean.refreshTotal != 0) { nodeIndicesStatsBean.refreshAvgTimeInMillisPerRequest = nodeIndicesStatsBean.refreshTotalTime / nodeIndicesStatsBean.refreshTotal; } nodeIndicesStatsBean.flushTotal = nodeIndicesStats.getFlush().getTotal(); nodeIndicesStatsBean.flushTotalTime = nodeIndicesStats.getFlush().getTotalTimeInMillis(); if (nodeIndicesStatsBean.flushTotal != 0) { nodeIndicesStatsBean.flushAvgTimeInMillisPerRequest = nodeIndicesStatsBean.flushTotalTime / nodeIndicesStatsBean.flushTotal; } }
Example #4
Source File: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 5 votes |
private void updateMerge(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.mergesCurrent = nodeIndicesStats.getMerge().getCurrent(); nodeIndicesStatsBean.mergesCurrentDocs = nodeIndicesStats.getMerge().getCurrentNumDocs(); nodeIndicesStatsBean.mergesCurrentSize = nodeIndicesStats.getMerge().getCurrentSizeInBytes(); nodeIndicesStatsBean.mergesTotal = nodeIndicesStats.getMerge().getTotal(); nodeIndicesStatsBean.mergesTotalTime = nodeIndicesStats.getMerge().getTotalTimeInMillis(); nodeIndicesStatsBean.mergesTotalSize = nodeIndicesStats.getMerge().getTotalSizeInBytes(); }
Example #5
Source File: GraphiteReporter.java From elasticsearch-graphite-plugin with Do What The F*ck You Want To Public License | 5 votes |
public GraphiteReporter(String host, int port, String prefix, NodeIndicesStats nodeIndicesStats, List<IndexShard> indexShards, NodeStats nodeStats, Pattern graphiteInclusionRegex, Pattern graphiteExclusionRegex) { this.host = host; this.port = port; this.prefix = prefix; this.indexShards = indexShards; this.nodeStats = nodeStats; this.graphiteInclusionRegex = graphiteInclusionRegex; this.graphiteExclusionRegex = graphiteExclusionRegex; this.timestamp = Long.toString(System.currentTimeMillis() / 1000); this.nodeIndicesStats = nodeIndicesStats; }
Example #6
Source File: GraphiteService.java From elasticsearch-graphite-plugin with Do What The F*ck You Want To Public License | 5 votes |
public void run() { while (!closed) { DiscoveryNode node = clusterService.localNode(); boolean isClusterStarted = clusterService.lifecycleState().equals(Lifecycle.State.STARTED); if (isClusterStarted && node != null && node.isMasterNode()) { NodeIndicesStats nodeIndicesStats = indicesService.stats(false); CommonStatsFlags commonStatsFlags = new CommonStatsFlags().clear(); NodeStats nodeStats = nodeService.stats(commonStatsFlags, true, true, true, true, true, true, true, true, true); List<IndexShard> indexShards = getIndexShards(indicesService); GraphiteReporter graphiteReporter = new GraphiteReporter(graphiteHost, graphitePort, graphitePrefix, nodeIndicesStats, indexShards, nodeStats, graphiteInclusionRegex, graphiteExclusionRegex); graphiteReporter.run(); } else { if (node != null) { logger.debug("[{}]/[{}] is not master node, not triggering update", node.getId(), node.getName()); } } try { Thread.sleep(graphiteRefreshInternal.millis()); } catch (InterruptedException e1) { continue; } } }
Example #7
Source File: NodeStats.java From Elasticsearch with Apache License 2.0 | 4 votes |
/** * Indices level stats. */ @Nullable public NodeIndicesStats getIndices() { return this.indices; }
Example #8
Source File: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 4 votes |
@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; } NodeIndicesStatsBean nodeIndicesStatsBean = new NodeIndicesStatsBean(); 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("Node indices stats is not available (node stats is not available)"); return; } NodeIndicesStats nodeIndicesStats = nodeStats.getIndices(); if (nodeIndicesStats == null) { logger.info("Node indices stats is not available"); return; } updateStoreDocs(nodeIndicesStatsBean, nodeIndicesStats); updateRefreshFlush(nodeIndicesStatsBean, nodeIndicesStats); updateMerge(nodeIndicesStatsBean, nodeIndicesStats); updateCache(nodeIndicesStatsBean, nodeIndicesStats); updateSearch(nodeIndicesStatsBean, nodeIndicesStats); updateGet(nodeIndicesStatsBean, nodeIndicesStats); updateIndexing(nodeIndicesStatsBean, nodeIndicesStats); } catch (Exception e) { logger.warn("Failed to load indices stats data", e); } nodeIndicesStatsReporter.nodeIndicesStatsBean.set(nodeIndicesStatsBean); }
Example #9
Source File: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 4 votes |
private void updateStoreDocs(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.storeSize = nodeIndicesStats.getStore().getSizeInBytes(); nodeIndicesStatsBean.storeThrottleTime = nodeIndicesStats.getStore().getThrottleTime().millis(); nodeIndicesStatsBean.docsCount = nodeIndicesStats.getDocs().getCount(); nodeIndicesStatsBean.docsDeleted = nodeIndicesStats.getDocs().getDeleted(); }
Example #10
Source File: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 4 votes |
private void updateCache(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.cacheFieldEvictions = nodeIndicesStats.getFieldData().getEvictions(); nodeIndicesStatsBean.cacheFieldSize = nodeIndicesStats.getFieldData().getMemorySizeInBytes(); }
Example #11
Source File: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 4 votes |
private void updateSearch(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.searchQueryTotal = nodeIndicesStats.getSearch().getTotal().getQueryCount(); nodeIndicesStatsBean.searchFetchTotal = nodeIndicesStats.getSearch().getTotal().getFetchCount(); nodeIndicesStatsBean.searchQueryCurrent = nodeIndicesStats.getSearch().getTotal().getQueryCurrent(); long tmpSearchQueryDelta = nodeIndicesStatsBean.searchQueryTotal - cachedQueryCount; nodeIndicesStatsBean.searchQueryDelta = tmpSearchQueryDelta < 0 ? 0 : tmpSearchQueryDelta; long tmpSearchFetchDelta = nodeIndicesStatsBean.searchFetchTotal - cachedFetchCount; nodeIndicesStatsBean.searchFetchDelta = tmpSearchFetchDelta < 0 ? 0 : tmpSearchFetchDelta; nodeIndicesStatsBean.searchQueryTime = nodeIndicesStats.getSearch().getTotal().getQueryTimeInMillis(); nodeIndicesStatsBean.searchFetchTime = nodeIndicesStats.getSearch().getTotal().getFetchTimeInMillis(); long searchQueryDeltaTimeInMillis = (nodeIndicesStatsBean.searchQueryTime - cachedSearchQueryTime); if (nodeIndicesStatsBean.searchQueryDelta != 0) { recordSearchQueryLatencies(searchQueryDeltaTimeInMillis / nodeIndicesStatsBean.searchQueryDelta, TimeUnit.MILLISECONDS); nodeIndicesStatsBean.latencySearchQuery95 = latencySearchQuery95Histo.percentile(PERCENTILE_95); nodeIndicesStatsBean.latencySearchQuery99 = latencySearchQuery99Histo.percentile(PERCENTILE_99); } else { nodeIndicesStatsBean.latencySearchQuery95 = 0; nodeIndicesStatsBean.latencySearchQuery99 = 0; } if (nodeIndicesStatsBean.searchQueryTotal != 0) { nodeIndicesStatsBean.searchQueryAvgTimeInMillisPerRequest = nodeIndicesStatsBean.searchQueryTime / nodeIndicesStatsBean.searchQueryTotal; } long searchFetchDeltaTimeInMillis = (nodeIndicesStatsBean.searchFetchTime - cachedSearchFetchTime); if (nodeIndicesStatsBean.searchFetchDelta != 0) { recordSearchFetchLatencies(searchFetchDeltaTimeInMillis / nodeIndicesStatsBean.searchFetchDelta, TimeUnit.MILLISECONDS); nodeIndicesStatsBean.latencySearchFetch95 = latencySearchFetch95Histo.percentile(PERCENTILE_95); nodeIndicesStatsBean.latencySearchFetch99 = latencySearchFetch99Histo.percentile(PERCENTILE_99); } else { nodeIndicesStatsBean.latencySearchFetch95 = 0; nodeIndicesStatsBean.latencySearchFetch99 = 0; } if (nodeIndicesStatsBean.searchFetchTotal != 0) { nodeIndicesStatsBean.searchFetchAvgTimeInMillisPerRequest = nodeIndicesStatsBean.searchFetchTime / nodeIndicesStatsBean.searchFetchTotal; } nodeIndicesStatsBean.searchFetchCurrent = nodeIndicesStats.getSearch().getTotal().getFetchCurrent(); cachedQueryCount += nodeIndicesStatsBean.searchQueryDelta; cachedFetchCount += nodeIndicesStatsBean.searchFetchDelta; cachedSearchQueryTime += searchQueryDeltaTimeInMillis; cachedSearchFetchTime += searchFetchDeltaTimeInMillis; }
Example #12
Source File: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 4 votes |
private void updateGet(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.getTotal = nodeIndicesStats.getGet().getCount(); nodeIndicesStatsBean.getExistsTotal = nodeIndicesStats.getGet().getExistsCount(); nodeIndicesStatsBean.getMissingTotal = nodeIndicesStats.getGet().getMissingCount(); nodeIndicesStatsBean.getTime = nodeIndicesStats.getGet().getTimeInMillis(); nodeIndicesStatsBean.getExistsTime = nodeIndicesStats.getGet().getExistsTimeInMillis(); nodeIndicesStatsBean.getMissingTime = nodeIndicesStats.getGet().getMissingTimeInMillis(); long tmpGetTotalDelta = nodeIndicesStatsBean.getTotal - cachedGetCount; nodeIndicesStatsBean.getTotalDelta = tmpGetTotalDelta < 0 ? 0 : tmpGetTotalDelta; long tmpGetExistsDelta = nodeIndicesStatsBean.getExistsTotal - cachedGetExistsCount; nodeIndicesStatsBean.getExistsDelta = tmpGetExistsDelta < 0 ? 0 : tmpGetExistsDelta; long tmpGetMissingDelta = nodeIndicesStatsBean.getMissingTotal - cachedGetMissingCount; nodeIndicesStatsBean.getMissingDelta = tmpGetMissingDelta < 0 ? 0 : tmpGetMissingDelta; long getDeltaTimeInMillis = (nodeIndicesStatsBean.getTime - cachedGetTime); if (nodeIndicesStatsBean.getTotalDelta != 0) { recordGetLatencies(getDeltaTimeInMillis / nodeIndicesStatsBean.getTotalDelta, TimeUnit.MILLISECONDS); nodeIndicesStatsBean.latencyGet95 = latencyGet95Histo.percentile(PERCENTILE_95); nodeIndicesStatsBean.latencyGet99 = latencyGet99Histo.percentile(PERCENTILE_99); } else { nodeIndicesStatsBean.latencyGet95 = 0; nodeIndicesStatsBean.latencyGet99 = 0; } if (nodeIndicesStatsBean.getTotal != 0) nodeIndicesStatsBean.getTotalAvgTimeInMillisPerRequest = nodeIndicesStatsBean.getTime / nodeIndicesStatsBean.getTotal; nodeIndicesStatsBean.getCurrent = nodeIndicesStats.getGet().current(); long getExistsDeltaTimeInMillies = (nodeIndicesStatsBean.getExistsTime - cachedGetExistsTime); if (nodeIndicesStatsBean.getExistsDelta != 0) { recordGetExistsLatencies(getExistsDeltaTimeInMillies / nodeIndicesStatsBean.getExistsDelta, TimeUnit.MILLISECONDS); nodeIndicesStatsBean.latencyGetExists95 = latencyGetExists95Histo.percentile(PERCENTILE_95); nodeIndicesStatsBean.latencyGetExists99 = latencyGetExists99Histo.percentile(PERCENTILE_99); } else { nodeIndicesStatsBean.latencyGetExists95 = 0; nodeIndicesStatsBean.latencyGetExists99 = 0; } if (nodeIndicesStatsBean.getExistsTotal != 0) nodeIndicesStatsBean.getExistsAvgTimeInMillisPerRequest = nodeIndicesStatsBean.getExistsTime / nodeIndicesStatsBean.getExistsTotal; long getMissingDeltaTimeInMillies = (nodeIndicesStatsBean.getMissingTime - cachedGetMissingTime); if (nodeIndicesStatsBean.getMissingDelta != 0) { recordGetMissingLatencies(getMissingDeltaTimeInMillies / nodeIndicesStatsBean.getMissingDelta, TimeUnit.MILLISECONDS); nodeIndicesStatsBean.latencyGetMissing95 = latencyGetMissing95Histo.percentile(PERCENTILE_95); nodeIndicesStatsBean.latencyGetMissing99 = latencyGetMissing99Histo.percentile(PERCENTILE_99); } else { nodeIndicesStatsBean.latencyGetMissing95 = 0; nodeIndicesStatsBean.latencyGetMissing99 = 0; } if (nodeIndicesStatsBean.getMissingTotal != 0) { nodeIndicesStatsBean.getMissingAvgTimeInMillisPerRequest = nodeIndicesStatsBean.getMissingTime / nodeIndicesStatsBean.getMissingTotal; } cachedGetCount += nodeIndicesStatsBean.getTotalDelta; cachedGetExistsCount += nodeIndicesStatsBean.getExistsDelta; cachedGetMissingCount += nodeIndicesStatsBean.getMissingDelta; cachedGetTime += getDeltaTimeInMillis; cachedGetExistsTime += getExistsDeltaTimeInMillies; cachedGetMissingTime += getMissingDeltaTimeInMillies; }
Example #13
Source File: NodeIndicesStatsMonitor.java From Raigad with Apache License 2.0 | 4 votes |
private void updateIndexing(NodeIndicesStatsBean nodeIndicesStatsBean, NodeIndicesStats nodeIndicesStats) { nodeIndicesStatsBean.indexingIndexTotal = nodeIndicesStats.getIndexing().getTotal().getIndexCount(); nodeIndicesStatsBean.indexingDeleteTotal = nodeIndicesStats.getIndexing().getTotal().getDeleteCount(); nodeIndicesStatsBean.indexingIndexCurrent = nodeIndicesStats.getIndexing().getTotal().getIndexCurrent(); long tmpIndexingIndexDelta = (nodeIndicesStatsBean.indexingIndexTotal - cachedIndexingIndexTotal); nodeIndicesStatsBean.indexingIndexDelta = tmpIndexingIndexDelta < 0 ? 0 : tmpIndexingIndexDelta; long tmpIndexingDeleteDelta = (nodeIndicesStatsBean.indexingDeleteTotal - cachedIndexingDeleteTotal); nodeIndicesStatsBean.indexingDeleteDelta = tmpIndexingDeleteDelta < 0 ? 0 : tmpIndexingDeleteDelta; nodeIndicesStatsBean.indexingIndexTimeInMillis = nodeIndicesStats.getIndexing().getTotal().getIndexTime().getMillis(); nodeIndicesStatsBean.indexingDeleteTime = nodeIndicesStats.getIndexing().getTotal().getDeleteTime().getMillis(); long indexingTimeInMillis = (nodeIndicesStatsBean.indexingIndexTimeInMillis - cachedIndexingTime); if (nodeIndicesStatsBean.indexingIndexDelta != 0) { recordIndexingLatencies(indexingTimeInMillis / nodeIndicesStatsBean.indexingIndexDelta, TimeUnit.MILLISECONDS); nodeIndicesStatsBean.latencyIndexing95 = latencyIndexing95Histo.percentile(PERCENTILE_95); nodeIndicesStatsBean.latencyIndexing99 = latencyIndexing99Histo.percentile(PERCENTILE_99); } else { nodeIndicesStatsBean.latencyIndexing95 = 0; nodeIndicesStatsBean.latencyIndexing99 = 0; } if (nodeIndicesStatsBean.indexingIndexTotal != 0) { nodeIndicesStatsBean.indexingAvgTimeInMillisPerRequest = nodeIndicesStatsBean.indexingIndexTimeInMillis / nodeIndicesStatsBean.indexingIndexTotal; } long indexDeleteTimeInMillis = (nodeIndicesStatsBean.indexingDeleteTime - cachedIndexDeleteTime); if (nodeIndicesStatsBean.indexingDeleteDelta != 0) { recordIndexDeleteLatencies(indexDeleteTimeInMillis / nodeIndicesStatsBean.indexingDeleteDelta, TimeUnit.MILLISECONDS); nodeIndicesStatsBean.latencyIndexDelete95 = latencyIndexDelete95Histo.percentile(PERCENTILE_95); nodeIndicesStatsBean.latencyIndexDelete99 = latencyIndexDelete99Histo.percentile(PERCENTILE_99); } else { nodeIndicesStatsBean.latencyIndexDelete95 = 0; nodeIndicesStatsBean.latencyIndexDelete99 = 0; } if (nodeIndicesStatsBean.indexingDeleteTotal != 0) { nodeIndicesStatsBean.indexingDeleteAvgTimeInMillisPerRequest = nodeIndicesStatsBean.indexingDeleteTime / nodeIndicesStatsBean.indexingDeleteTotal; } nodeIndicesStatsBean.indexingDeleteCurrent = nodeIndicesStats.getIndexing().getTotal().getDeleteCurrent(); cachedIndexingIndexTotal += nodeIndicesStatsBean.indexingIndexDelta; cachedIndexingDeleteTotal += nodeIndicesStatsBean.indexingDeleteDelta; cachedIndexingTime += indexingTimeInMillis; cachedIndexDeleteTime += indexDeleteTimeInMillis; }