use of org.graylog2.rest.models.system.deflector.responses.DeflectorSummary in project graylog2-server by Graylog2.
the class IndexerOverviewResource method getIndexerOverview.
private IndexerOverview getIndexerOverview(IndexSet indexSet) throws TooManyAliasesException {
final String indexSetId = indexSet.getConfig().id();
final DeflectorSummary deflectorSummary = deflectorResource.deflector(indexSetId);
final List<IndexRangeSummary> indexRanges = indexRangesResource.list().ranges();
final Map<String, IndexStats> allDocCounts = indices.getAllDocCounts(indexSet).entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
final Map<String, Boolean> areReopened = indices.areReopened(allDocCounts.keySet());
final Map<String, IndexSummary> indicesSummaries = allDocCounts.values().stream().parallel().collect(Collectors.toMap(IndexStats::getIndex, (indexStats) -> IndexSummary.create(IndexSizeSummary.create(indexStats.getPrimaries().getDocs().getCount(), indexStats.getPrimaries().getDocs().getDeleted(), indexStats.getPrimaries().getStore().sizeInBytes()), indexRanges.stream().filter((indexRangeSummary) -> indexRangeSummary.indexName().equals(indexStats.getIndex())).findFirst().orElse(null), deflectorSummary.currentTarget() != null && deflectorSummary.currentTarget().equals(indexStats.getIndex()), false, areReopened.get(indexStats.getIndex()))));
indices.getClosedIndices(indexSet).forEach(indexName -> indicesSummaries.put(indexName, IndexSummary.create(null, indexRanges.stream().filter((indexRangeSummary) -> indexRangeSummary.indexName().equals(indexName)).findFirst().orElse(null), deflectorSummary.currentTarget() != null && deflectorSummary.currentTarget().equals(indexName), true, false)));
return IndexerOverview.create(deflectorSummary, IndexerClusterOverview.create(indexerClusterResource.clusterHealth(), indexerClusterResource.clusterName().name()), countResource.total(indexSetId), indicesSummaries);
}
Aggregations