Skip to content

Commit

Permalink
improved logging for queries and counts in SearchActor
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Feb 23, 2022
1 parent eb34037 commit a081de0
Showing 1 changed file with 10 additions and 3 deletions.
Expand Up @@ -151,19 +151,24 @@ private void namespaceReport(final SudoRetrieveNamespaceReport namespaceReport)
}

private void count(final CountThings countThings) {
final ThreadSafeDittoLoggingAdapter l = log.withCorrelationId(countThings);
l.info("Processing CountThings command with namespaces <{}> and filter: <{}>",
countThings.getNamespaces(), countThings.getFilter());
l.debug("Processing CountThings command: <{}>", countThings);
executeCount(countThings, queryParser::parse, false);
}

private void sudoCount(final SudoCountThings sudoCountThings) {
final ThreadSafeDittoLoggingAdapter l = log.withCorrelationId(sudoCountThings);
l.info("Processing SudoCountThings command with filter: <{}>", sudoCountThings.getFilter());
l.debug("Processing SudoCountThings command: <{}>", sudoCountThings);
executeCount(sudoCountThings, queryParser::parseSudoCountThings, true);
}

private <T extends Command<?>> void executeCount(final T countCommand,
final Function<T, CompletionStage<Query>> queryParseFunction,
final boolean isSudo) {
final var dittoHeaders = countCommand.getDittoHeaders();
log.withCorrelationId(dittoHeaders)
.info("Processing CountThings command: {}", countCommand);
final JsonSchemaVersion version = countCommand.getImplementedSchemaVersion();
final var queryType = "count";
final StartedTimer countTimer = startNewTimer(version, queryType, countCommand);
Expand Down Expand Up @@ -248,7 +253,9 @@ private void query(final QueryThings queryThings) {
cursor.ifPresent(c -> c.logCursorCorrelationId(l));
final QueryThings command = ThingsSearchCursor.adjust(cursor, queryThings);
final var dittoHeaders = command.getDittoHeaders();
l.info("Processing QueryThings command: {}", queryThings);
l.info("Processing QueryThings command with namespaces <{}> and filter: <{}>",
queryThings.getNamespaces(), queryThings.getFilter());
l.debug("Processing QueryThings command: <{}>", queryThings);
return createQuerySource(queryParser::parse, command)
.flatMapConcat(parsedQuery -> {
final var query =
Expand Down

0 comments on commit a081de0

Please sign in to comment.