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


Java NodesStatsResponse类代码示例

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


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

示例1: ensureEstimatedStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的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.NodesStatsResponse; //导入依赖的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: noopBreakerUsed

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的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

示例4: clearFieldData

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的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

示例5: getTranslogDirs

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
private Set<Path> getTranslogDirs(String indexName) throws IOException {
    ClusterState state = client().admin().cluster().prepareState().get().getState();
    GroupShardsIterator shardIterators = state.getRoutingTable().activePrimaryShardsGrouped(new String[]{indexName}, false);
    final Index idx = state.metaData().index(indexName).getIndex();
    List<ShardIterator> iterators = iterableAsArrayList(shardIterators);
    ShardIterator shardIterator = RandomPicks.randomFrom(random(), iterators);
    ShardRouting shardRouting = shardIterator.nextOrNull();
    assertNotNull(shardRouting);
    assertTrue(shardRouting.primary());
    assertTrue(shardRouting.assignedToNode());
    String nodeId = shardRouting.currentNodeId();
    NodesStatsResponse nodeStatses = client().admin().cluster().prepareNodesStats(nodeId).setFs(true).get();
    Set<Path> translogDirs = new TreeSet<>(); // treeset makes sure iteration order is deterministic
    for (FsInfo.Path fsPath : nodeStatses.getNodes().get(0).getFs()) {
        String path = fsPath.getPath();
        final String relativeDataLocationPath =  "indices/"+ idx.getUUID() +"/" + Integer.toString(shardRouting.getId()) + "/translog";
        Path translogPath = PathUtils.get(path).resolve(relativeDataLocationPath);
        if (Files.isDirectory(translogPath)) {
            translogDirs.add(translogPath);
        }
    }
    return translogDirs;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:TruncateTranslogIT.java

示例6: listShardFiles

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
public List<Path> listShardFiles(ShardRouting routing) throws IOException {
    NodesStatsResponse nodeStatses = client().admin().cluster().prepareNodesStats(routing.currentNodeId()).setFs(true).get();
    ClusterState state = client().admin().cluster().prepareState().get().getState();
    final Index test = state.metaData().index("test").getIndex();
    assertThat(routing.toString(), nodeStatses.getNodes().size(), equalTo(1));
    List<Path> files = new ArrayList<>();
    for (FsInfo.Path info : nodeStatses.getNodes().get(0).getFs()) {
        String path = info.getPath();
        Path file = PathUtils.get(path).resolve("indices/" + test.getUUID() + "/" + Integer.toString(routing.getId()) + "/index");
        if (Files.exists(file)) { // multi data path might only have one path in use
            try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) {
                for (Path item : stream) {
                    files.add(item);
                }
            }
        }
    }
    return files;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:CorruptedFileIT.java

示例7: getNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的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

示例8: doRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
@Override
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {

    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.indices(true);
    String[] fields = request.paramAsStringArray("fields", null);
    nodesStatsRequest.indices().fieldDataFields(fields == null ? new String[] {"*"} : fields);

    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
        @Override
        public RestResponse buildResponse(NodesStatsResponse nodeStatses) throws Exception {
            return RestTable.buildResponse(buildTable(request, nodeStatses), channel);
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:RestFielddataAction.java

示例9: testCircuitBreakerOnShard

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的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

示例10: testCircuitBreakerOnCoordinator

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的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

示例11: doCatRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
    final boolean fullId = request.paramAsBoolean("full_id", false);
    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(true).os(true).process(true).http(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(true).os(true).fs(true).indices(true).process(true).script(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(fullId, request, clusterStateResponse, nodesInfoResponse,
                                nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:30,代码来源:RestNodesAction.java

示例12: doCatRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
@Override
protected RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.indices(true);
    String[] fields = request.paramAsStringArray("fields", null);
    nodesStatsRequest.indices().fieldDataFields(fields == null ? new String[] {"*"} : fields);

    return channel -> client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
        @Override
        public RestResponse buildResponse(NodesStatsResponse nodeStatses) throws Exception {
            return RestTable.buildResponse(buildTable(request, nodeStatses), channel);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:RestFielddataAction.java

示例13: doCatRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().process(true).threadPool(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().threadPool(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:RestThreadPoolAction.java

示例14: updateNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
/**
 * Retrieve the latest nodes stats, calling the listener when complete
 * @return a latch that can be used to wait for the nodes stats to complete if desired
 */
protected CountDownLatch updateNodeStats(final ActionListener<NodesStatsResponse> listener) {
    final CountDownLatch latch = new CountDownLatch(1);
    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.fs(true);
    nodesStatsRequest.timeout(fetchTimeout);
    client.admin().cluster().nodesStats(nodesStatsRequest, new LatchedActionListener<>(listener, latch));
    return latch;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:InternalClusterInfoService.java

示例15: testCustomCircuitBreakerRegistration

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; //导入依赖的package包/类
public void testCustomCircuitBreakerRegistration() throws Exception {
    Iterable<CircuitBreakerService> serviceIter = internalCluster().getInstances(CircuitBreakerService.class);

    final String breakerName = "customBreaker";
    BreakerSettings breakerSettings = new BreakerSettings(breakerName, 8, 1.03);
    CircuitBreaker breaker = null;

    for (CircuitBreakerService s : serviceIter) {
        s.registerBreaker(breakerSettings);
        breaker = s.getBreaker(breakerSettings.getName());
    }

    if (breaker != null) {
        try {
            breaker.addEstimateBytesAndMaybeBreak(16, "test");
        } catch (CircuitBreakingException e) {
            // ignore, we forced a circuit break
        }
    }

    NodesStatsResponse stats = client().admin().cluster().prepareNodesStats().clear().setBreaker(true).get();
    int breaks = 0;
    for (NodeStats stat : stats.getNodes()) {
        CircuitBreakerStats breakerStats = stat.getBreaker().getStats(breakerName);
        breaks += breakerStats.getTrippedCount();
    }
    assertThat(breaks, greaterThanOrEqualTo(1));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:CircuitBreakerServiceIT.java


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