当前位置: 首页>>代码示例>>Java>>正文


Java NodeStats类代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.cluster.node.stats.NodeStats的典型用法代码示例。如果您正苦于以下问题:Java NodeStats类的具体用法?Java NodeStats怎么用?Java NodeStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodeStats类属于org.elasticsearch.action.admin.cluster.node.stats包,在下文中一共展示了NodeStats类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ensureEstimatedStats

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
@Override
public void ensureEstimatedStats() {
    if (size() > 0) {
        NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats()
                .clear().setBreaker(true).setIndices(true).execute().actionGet();
        for (NodeStats stats : nodeStats.getNodes()) {
            assertThat("Fielddata breaker not reset to 0 on node: " + stats.getNode(),
                    stats.getBreaker().getStats(CircuitBreaker.FIELDDATA).getEstimated(), equalTo(0L));
            // ExternalTestCluster does not check the request breaker,
            // because checking it requires a network request, which in
            // turn increments the breaker, making it non-0

            assertThat("Fielddata size must be 0 on node: " +
                stats.getNode(), stats.getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0L));
            assertThat("Query cache size must be 0 on node: " +
                stats.getNode(), stats.getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0L));
            assertThat("FixedBitSet cache size must be 0 on node: " +
                stats.getNode(), stats.getIndices().getSegments().getBitsetMemoryInBytes(), equalTo(0L));
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:ExternalTestCluster.java

示例2: buildTable

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
private Table buildTable(final RestRequest request, final NodesStatsResponse nodeStatses) {
    Table table = getTableWithHeader(request);

    for (NodeStats nodeStats: nodeStatses.getNodes()) {
        if (nodeStats.getIndices().getFieldData().getFields() != null) {
            for (ObjectLongCursor<String> cursor : nodeStats.getIndices().getFieldData().getFields()) {
                table.startRow();
                table.addCell(nodeStats.getNode().getId());
                table.addCell(nodeStats.getNode().getHostName());
                table.addCell(nodeStats.getNode().getHostAddress());
                table.addCell(nodeStats.getNode().getName());
                table.addCell(cursor.key);
                table.addCell(new ByteSizeValue(cursor.value));
                table.endRow();
            }
        }
    }

    return table;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:RestFielddataAction.java

示例3: stats

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
public NodeStats stats(CommonStatsFlags indices, boolean os, boolean process, boolean jvm, boolean threadPool,
                       boolean fs, boolean transport, boolean http, boolean circuitBreaker,
                       boolean script, boolean discoveryStats, boolean ingest) {
    // for indices stats we want to include previous allocated shards stats as well (it will
    // only be applied to the sensible ones to use, like refresh/merge/flush/indexing stats)
    return new NodeStats(discovery.localNode(), System.currentTimeMillis(),
            indices.anySet() ? indicesService.stats(true, indices) : null,
            os ? monitorService.osService().stats() : null,
            process ? monitorService.processService().stats() : null,
            jvm ? monitorService.jvmService().stats() : null,
            threadPool ? this.threadPool.stats() : null,
            fs ? monitorService.fsService().stats() : null,
            transport ? transportService.stats() : null,
            http ? (httpServerTransport == null ? null : httpServerTransport.stats()) : null,
            circuitBreaker ? circuitBreakerService.stats() : null,
            script ? scriptService.stats() : null,
            discoveryStats ? discovery.stats() : null,
            ingest ? ingestService.getPipelineExecutionService().stats() : null
    );
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:NodeService.java

示例4: noopBreakerUsed

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
/** Returns true if any of the nodes used a noop breaker */
private boolean noopBreakerUsed() {
    NodesStatsResponse stats = client().admin().cluster().prepareNodesStats().setBreaker(true).get();
    for (NodeStats nodeStats : stats.getNodes()) {
        if (nodeStats.getBreaker().getStats(CircuitBreaker.REQUEST).getLimit() == NoopCircuitBreaker.LIMIT) {
            return true;
        }
        if (nodeStats.getBreaker().getStats(CircuitBreaker.IN_FLIGHT_REQUESTS).getLimit() == NoopCircuitBreaker.LIMIT) {
            return true;
        }
        if (nodeStats.getBreaker().getStats(CircuitBreaker.FIELDDATA).getLimit() == NoopCircuitBreaker.LIMIT) {
            return true;
        }
    }
    return false;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:CircuitBreakerServiceIT.java

示例5: clearFieldData

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
/** Issues a cache clear and waits 30 seconds for the field data breaker to be cleared */
public void clearFieldData() throws Exception {
    client().admin().indices().prepareClearCache().setFieldDataCache(true).execute().actionGet();
    assertBusy(new Runnable() {
        @Override
        public void run() {
            NodesStatsResponse resp = client().admin().cluster().prepareNodesStats()
                    .clear().setBreaker(true).get(new TimeValue(15, TimeUnit.SECONDS));
            for (NodeStats nStats : resp.getNodes()) {
                assertThat("fielddata breaker never reset back to 0",
                        nStats.getBreaker().getStats(CircuitBreaker.FIELDDATA).getEstimated(),
                        equalTo(0L));
            }
        }
    }, 30, TimeUnit.SECONDS);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:CircuitBreakerServiceIT.java

示例6: getNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
private static CompletableFuture<NodeStats> getNodeStats(final Client client) {
    CompletableFuture<NodeStats> result = new CompletableFuture<>();

    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("_local").all();
    client.admin().cluster().nodesStats(nodesStatsRequest, new ActionListener<NodesStatsResponse>() {
        @Override
        public void onResponse(NodesStatsResponse nodesStatsResponse) {
            NodeStats stats = nodesStatsResponse.getNodes().get(0);
            result.complete(stats);
        }

        @Override
        public void onFailure(Exception e) {
            result.completeExceptionally(e);
        }
    });
    return result;
}
 
开发者ID:jsuchenia,项目名称:elasticsearch-prometheus-metrics,代码行数:19,代码来源:PrometheusExporterPlugin.java

示例7: logNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
private void logNodeStats(Map<String, NodeStats> statsMap) {
  Map<String, String> tags = new HashMap<>();
  for (NodeStats stat : statsMap.values()) {
    tags.put("esnode", stat.getHostname());
    Stats.setGauge(StatsUtil.getStatsName("eshealth", "heapUsedPercent", tags),
        stat.getJvm().getMem().getHeapUsedPrecent());
    Stats.setGauge(StatsUtil.getStatsName("eshealth", "heapMaxMB", tags),
        stat.getJvm().getMem().getHeapMax().getMbFrac());
    Stats.setGauge(StatsUtil.getStatsName("eshealth", "heapUsedMB", tags),
        stat.getJvm().getMem().getHeapUsed().getMbFrac());
    Stats.setGauge(StatsUtil.getStatsName("eshealth", "upMinutes", tags),
        stat.getJvm().getUptime().getMinutesFrac());
    Stats.setGauge(StatsUtil.getStatsName("eshealth", "docCount", tags),
        stat.getIndices().getDocs().getCount());
  }
}
 
开发者ID:pinterest,项目名称:soundwave,代码行数:17,代码来源:ElasticSearchHealthCheckJob.java

示例8: stats

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
public NodeStats stats() throws IOException {
    // for indices stats we want to include previous allocated shards stats as well (it will
    // only be applied to the sensible ones to use, like refresh/merge/flush/indexing stats)
    return new NodeStats(discovery.localNode(), System.currentTimeMillis(),
            indicesService.stats(true),
            monitorService.osService().stats(),
            monitorService.processService().stats(),
            monitorService.jvmService().stats(),
            threadPool.stats(),
            monitorService.fsService().stats(),
            transportService.stats(),
            httpServer == null ? null : httpServer.stats(),
            circuitBreakerService.stats(),
            scriptService.stats()
    );
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:NodeService.java

示例9: nodeOperation

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
@Override
protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeRequest) {
    NodeInfo nodeInfo = nodeService.info(false, true, false, true, false, true, false, true);
    NodeStats nodeStats = nodeService.stats(CommonStatsFlags.NONE, true, true, true, false, true, false, false, false, false);
    List<ShardStats> shardsStats = new ArrayList<>();
    for (IndexService indexService : indicesService) {
        for (IndexShard indexShard : indexService) {
            if (indexShard.routingEntry() != null && indexShard.routingEntry().active()) {
                // only report on fully started shards
                shardsStats.add(new ShardStats(indexShard.routingEntry(), indexShard.shardPath(), new CommonStats(indexShard, SHARD_STATS_FLAGS), indexShard.commitStats()));
            }
        }
    }

    ClusterHealthStatus clusterStatus = null;
    if (clusterService.state().nodes().localNodeMaster()) {
        clusterStatus = new ClusterStateHealth(clusterService.state()).getStatus();
    }

    return new ClusterStatsNodeResponse(nodeInfo.getNode(), clusterStatus, nodeInfo, nodeStats, shardsStats.toArray(new ShardStats[shardsStats.size()]));

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:TransportClusterStatsAction.java

示例10: addNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
public void addNodeStats(NodeStats nodeStats) {
    if (nodeStats.getProcess() == null) {
        return;
    }
    count++;
    if (nodeStats.getProcess().getCpu() != null) {
        cpuPercent += nodeStats.getProcess().getCpu().getPercent();
    }
    long fd = nodeStats.getProcess().getOpenFileDescriptors();
    if (fd > 0) {
        // fd can be -1 if not supported on platform
        totalOpenFileDescriptors += fd;
    }
    // we still do min max calc on -1, so we'll have an indication of it not being supported on one of the nodes.
    minOpenFileDescriptors = Math.min(minOpenFileDescriptors, fd);
    maxOpenFileDescriptors = Math.max(maxOpenFileDescriptors, fd);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:ClusterStatsNodes.java

示例11: testCircuitBreakerOnShard

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
@Test
public void testCircuitBreakerOnShard() throws Exception {
  // Update circuit breaker settings
  Settings settings = settingsBuilder()
          .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, "8b")
          .build();
  assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings));

  SearchRequestBuilder searchRequest = new CoordinateSearchRequestBuilder(client()).setIndices("index1").setQuery(
          QueryBuilders.filterJoin("foreign_key").indices("index2").types("type").path("id").query(
                  boolQuery().filter(termQuery("tag", "aaa"))
          ).termsEncoding(TermsByQueryRequest.TermsEncoding.LONG)
  );
  assertFailures(searchRequest, RestStatus.INTERNAL_SERVER_ERROR,
          containsString("Data too large, data for [<terms_set>] would be larger than limit of [8/8b]"));

  NodesStatsResponse stats = client().admin().cluster().prepareNodesStats().setBreaker(true).get();
  int breaks = 0;
  for (NodeStats stat : stats.getNodes()) {
    CircuitBreakerStats breakerStats = stat.getBreaker().getStats(CircuitBreaker.REQUEST);
    breaks += breakerStats.getTrippedCount();
  }
  assertThat(breaks, greaterThanOrEqualTo(1));
}
 
开发者ID:sirensolutions,项目名称:siren-join,代码行数:25,代码来源:CircuitBreakerTest.java

示例12: testCircuitBreakerOnCoordinator

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
@Test
public void testCircuitBreakerOnCoordinator() throws Exception {
  // Update circuit breaker settings
  Settings settings = settingsBuilder()
          .put(HierarchyCircuitBreakerService.REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, "60b")
          .build();
  assertAcked(client().admin().cluster().prepareUpdateSettings().setTransientSettings(settings));

  SearchRequestBuilder searchRequest = new CoordinateSearchRequestBuilder(client()).setIndices("index1").setQuery(
          QueryBuilders.filterJoin("foreign_key").indices("index2").types("type").path("id").query(
                  boolQuery().filter(termQuery("tag", "aaa"))
          ).termsEncoding(TermsByQueryRequest.TermsEncoding.LONG)
  );
  assertFailures(searchRequest, RestStatus.INTERNAL_SERVER_ERROR,
          containsString("Data too large, data for [<terms_set>] would be larger than limit of [60/60b]"));

  NodesStatsResponse stats = client().admin().cluster().prepareNodesStats().setBreaker(true).get();
  int breaks = 0;
  for (NodeStats stat : stats.getNodes()) {
    CircuitBreakerStats breakerStats = stat.getBreaker().getStats(CircuitBreaker.REQUEST);
    breaks += breakerStats.getTrippedCount();
  }
  assertThat(breaks, greaterThanOrEqualTo(1));
}
 
开发者ID:sirensolutions,项目名称:siren-join,代码行数:25,代码来源:CircuitBreakerTest.java

示例13: makeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
/** Create a fake NodeStats for the given node and usage */
public static NodeStats makeStats(String nodeName, DiskUsage usage) {
    FsInfo.Path[] paths = new FsInfo.Path[1];
    FsInfo.Path path = new FsInfo.Path("/dev/null", null,
        usage.getTotalBytes(), usage.getFreeBytes(), usage.getFreeBytes());
    paths[0] = path;
    FsInfo fsInfo = new FsInfo(System.currentTimeMillis(), null, paths);
    return new NodeStats(new DiscoveryNode(nodeName, ESTestCase.buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT),
        System.currentTimeMillis(),
        null, null, null, null, null,
        fsInfo,
        null, null, null,
        null, null, null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:MockInternalClusterInfoService.java

示例14: nodeOperation

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
@Override
protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeRequest) {
    NodeInfo nodeInfo = nodeService.info(true, true, false, true, false, true, false, true, false, false);
    NodeStats nodeStats = nodeService.stats(CommonStatsFlags.NONE, true, true, true, false, true, false, false, false, false, false, false);
    List<ShardStats> shardsStats = new ArrayList<>();
    for (IndexService indexService : indicesService) {
        for (IndexShard indexShard : indexService) {
            if (indexShard.routingEntry() != null && indexShard.routingEntry().active()) {
                // only report on fully started shards
                shardsStats.add(
                    new ShardStats(
                        indexShard.routingEntry(),
                        indexShard.shardPath(),
                        new CommonStats(indicesService.getIndicesQueryCache(), indexShard, SHARD_STATS_FLAGS),
                        indexShard.commitStats(),
                        indexShard.seqNoStats()));
            }
        }
    }

    ClusterHealthStatus clusterStatus = null;
    if (clusterService.state().nodes().isLocalNodeElectedMaster()) {
        clusterStatus = new ClusterStateHealth(clusterService.state()).getStatus();
    }

    return new ClusterStatsNodeResponse(nodeInfo.getNode(), clusterStatus, nodeInfo, nodeStats, shardsStats.toArray(new ShardStats[shardsStats.size()]));

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:TransportClusterStatsAction.java

示例15: ClusterStatsNodes

import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; //导入依赖的package包/类
ClusterStatsNodes(List<ClusterStatsNodeResponse> nodeResponses) {
    this.versions = new HashSet<>();
    this.fs = new FsInfo.Path();
    this.plugins = new HashSet<>();

    Set<InetAddress> seenAddresses = new HashSet<>(nodeResponses.size());
    List<NodeInfo> nodeInfos = new ArrayList<>();
    List<NodeStats> nodeStats = new ArrayList<>();
    for (ClusterStatsNodeResponse nodeResponse : nodeResponses) {
        nodeInfos.add(nodeResponse.nodeInfo());
        nodeStats.add(nodeResponse.nodeStats());
        this.versions.add(nodeResponse.nodeInfo().getVersion());
        this.plugins.addAll(nodeResponse.nodeInfo().getPlugins().getPluginInfos());

        // now do the stats that should be deduped by hardware (implemented by ip deduping)
        TransportAddress publishAddress = nodeResponse.nodeInfo().getTransport().address().publishAddress();
        final InetAddress inetAddress = publishAddress.address().getAddress();
        if (!seenAddresses.add(inetAddress)) {
            continue;
        }
        if (nodeResponse.nodeStats().getFs() != null) {
            this.fs.add(nodeResponse.nodeStats().getFs().getTotal());
        }
    }
    this.counts = new Counts(nodeInfos);
    this.os = new OsStats(nodeInfos, nodeStats);
    this.process = new ProcessStats(nodeStats);
    this.jvm = new JvmStats(nodeInfos, nodeStats);
    this.networkTypes = new NetworkTypes(nodeInfos);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:ClusterStatsNodes.java


注:本文中的org.elasticsearch.action.admin.cluster.node.stats.NodeStats类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。