use of ddf.catalog.operation.ProcessingDetails in project ddf by codice.
the class RemoveAllCommand method needsAlternateQueryAndResponse.
private boolean needsAlternateQueryAndResponse(SourceResponse response) {
Set<ProcessingDetails> processingDetails = (Set<ProcessingDetails>) response.getProcessingDetails();
if (processingDetails == null || processingDetails.iterator() == null) {
return false;
}
Iterator<ProcessingDetails> iterator = processingDetails.iterator();
while (iterator.hasNext()) {
ProcessingDetails next = iterator.next();
if (next != null && next.getException() != null && next.getException().getMessage() != null && next.getException().getMessage().contains(UnsupportedQueryException.class.getSimpleName())) {
return true;
}
}
return false;
}
use of ddf.catalog.operation.ProcessingDetails in project ddf by codice.
the class CatalogMetrics method recordSourceQueryExceptions.
private void recordSourceQueryExceptions(QueryResponse response) {
Set<ProcessingDetails> processingDetails = (Set<ProcessingDetails>) response.getProcessingDetails();
if (processingDetails == null || processingDetails.iterator() == null) {
return;
}
Iterator<ProcessingDetails> iterator = processingDetails.iterator();
while (iterator.hasNext()) {
ProcessingDetails next = iterator.next();
if (next != null && next.getException() != null) {
if (next.getException() instanceof UnsupportedQueryException) {
unsupportedQueryExceptions.mark();
} else if (next.getException() instanceof SourceUnavailableException) {
sourceUnavailableExceptions.mark();
} else if (next.getException() instanceof FederationException) {
federationExceptions.mark();
}
exceptions.mark();
}
}
return;
}
use of ddf.catalog.operation.ProcessingDetails in project ddf by codice.
the class CatalogMetricsTest method catalogExceptionMetric.
@Test
public void catalogExceptionMetric() throws Exception {
QueryResponse response = new QueryResponseImpl(new QueryRequestImpl(new QueryImpl(idFilter)));
Set<ProcessingDetails> details = response.getProcessingDetails();
details.addAll(new HashSet<ProcessingDetails>() {
{
add(new ProcessingDetailsImpl("source1", new UnsupportedQueryException()));
add(new ProcessingDetailsImpl("source2", new SourceUnavailableException()));
add(new ProcessingDetailsImpl("source3", new FederationException()));
add(new ProcessingDetailsImpl("source4", new Exception()));
}
});
underTest.process(response);
assertThat(underTest.exceptions.getCount(), is(4L));
assertThat(underTest.unsupportedQueryExceptions.getCount(), is(1L));
assertThat(underTest.sourceUnavailableExceptions.getCount(), is(1L));
assertThat(underTest.federationExceptions.getCount(), is(1L));
}
use of ddf.catalog.operation.ProcessingDetails in project ddf by codice.
the class QueryMonitorPluginImpl method process.
/**
* Method that is implemented for {@link PostFederatedQueryPlugin}. Uses the given {@link QueryResponse} information
* to remove the {@link ActiveSearch} from the {@link ActiveSearch} {@link Map}.
*
* @param input {@link QueryResponse} that corresponds to response from the source that was queried
* by the user's original {@link QueryRequest}
* @return {@link QueryResponse} that was given as a parameter
*/
@Override
public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException {
if (!removeSearchAfterComplete) {
LOGGER.debug("Not removing active search from map due to catalog:removeSearchAfterComplete false. To enable removing searches as searches finish, use command catalog:removesearchaftercomplete true.");
return input;
}
if (input == null) {
LOGGER.debug("Cannot remove ActiveSearch from the ActiveSearch Map. QueryResponse received in QueryMonitorPluginImpl was null.");
return null;
}
if (!removeActiveSearch((UUID) input.getRequest().getPropertyValue(SEARCH_ID))) {
QueryResponseImpl queryResponse = new QueryResponseImpl(input.getRequest(), new ArrayList<>(), 0);
queryResponse.closeResultQueue();
Set<ProcessingDetails> processingDetails = Collections.singleton(new ProcessingDetailsImpl(QueryMonitorPlugin.class.getCanonicalName(), new StopProcessingException("Query was cancelled by administrator")));
queryResponse.setProcessingDetails(processingDetails);
return queryResponse;
}
return input;
}
use of ddf.catalog.operation.ProcessingDetails in project ddf by codice.
the class UpdateOperations method doRemoteUpdate.
private UpdateResponse doRemoteUpdate(UpdateRequest updateRequest) {
HashSet<ProcessingDetails> exceptions = new HashSet<>();
Map<String, Serializable> properties = new HashMap<>();
List<CatalogStore> stores = opsCatStoreSupport.getCatalogStoresForRequest(updateRequest, exceptions);
List<Update> updates = new ArrayList<>();
for (CatalogStore store : stores) {
try {
if (!store.isAvailable()) {
exceptions.add(new ProcessingDetailsImpl(store.getId(), null, "CatalogStore is not available"));
} else {
UpdateResponse response = store.update(updateRequest);
properties.put(store.getId(), new ArrayList<>(response.getUpdatedMetacards()));
updates = response.getUpdatedMetacards();
}
} catch (IngestException e) {
INGEST_LOGGER.error("Error updating metacards for CatalogStore {}", store.getId(), e);
exceptions.add(new ProcessingDetailsImpl(store.getId(), e));
}
}
return new UpdateResponseImpl(updateRequest, properties, updates, exceptions);
}
Aggregations