Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing log fields #489

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public List<Worker> workers(
metrics,
messageBroker,
processReport.orElseGet(
() -> new DefaultProcessReport(appProperties.name())),
() -> new DefaultProcessReport(appProperties.name(), tracing)),
taskQueue,
tracing))
.collect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ public class DefaultProcessReport implements ProcessReport {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultProcessReport.class);

private final String name;
private final Tracing tracing;

public DefaultProcessReport(String name) {
public DefaultProcessReport(String name, Tracing tracing) {
this.name = requireNonNull(name);
this.tracing = requireNonNull(tracing);
}

@Override
public void reportSuccess(Message message) {
LOGGER.info("{} successful", name);
LOGGER.info("{} successful", name, keyValue("tracing", tracing.tracingPath()));
}

@Override
Expand All @@ -32,7 +34,6 @@ public void reportFail(Message message, StopProcessingException e) {
name,
e.getMessage(),
keyValue("amqp_message", message.toString()),
keyValue("exception", e.toString()),
e);
}

Expand All @@ -44,7 +45,6 @@ public void reportFailAfterMaxRetries(Message message, Exception e) {
name,
e.getMessage(),
keyValue("amqp_message", message.toString()),
keyValue("exception", e.toString()),
e);
}

Expand All @@ -64,7 +64,7 @@ public void reportRetry(Message message, RuntimeException e) {
name,
e.getMessage(),
keyValue("amqp_message", message.toString()),
keyValue("exception", e.toString()));
e);
}

@Override
Expand All @@ -79,7 +79,7 @@ public void reportComplexRetry(Message message, RetryProcessingException e) {
messagesSent,
e.getMessage(),
keyValue("amqp_message", message.toString()),
keyValue("exception", e.toString()));
schmika marked this conversation as resolved.
Show resolved Hide resolved
e);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.dbmdz.flusswerk.framework.reporting;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
Expand Down Expand Up @@ -29,7 +30,7 @@ void setUp() {
listAppender.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
listAppender.start();
logger.addAppender(listAppender);
defaultProcessReport = new DefaultProcessReport("testapp");
defaultProcessReport = new DefaultProcessReport("testapp", mock(Tracing.class));
}

@DisplayName("should report success")
Expand Down