From 9f4630db069b2e276c6b221a0282c4661fab56ed Mon Sep 17 00:00:00 2001 From: jdar Date: Wed, 25 Sep 2024 16:20:08 -0700 Subject: [PATCH] address code review comments --- .../uhn/hapi/fhir/docs/server_jpa_batch/introduction.md | 4 ++++ .../coordinator/WorkChannelMessageHandlerTest.java | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_batch/introduction.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_batch/introduction.md index 1c3bb485c21..03468909d7f 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_batch/introduction.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_batch/introduction.md @@ -70,3 +70,7 @@ If a Job Definition is set to having Gated Execution, then all work chunks for a ### Job Instance Completion A Batch Job Maintenance Service runs every minute to monitor the status of all Job Instances and the Job Instance is transitioned to either `COMPLETED`, `ERRORED` or `FAILED` according to the status of all outstanding work chunks for that job instance. If the job instance is still `IN_PROGRESS` this maintenance service also estimates the time remaining to complete the job. + +## Logging + +The job instance ID and work chunk ID are both available through the logback MDC and can be accessed using the `%X` specifier in a `logback.xml` file. See [Logging](/docs/appendix/logging.html#logging) for more details about logging in HAPI. diff --git a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/WorkChannelMessageHandlerTest.java b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/WorkChannelMessageHandlerTest.java index a3a05856723..1b2c00cd42e 100644 --- a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/WorkChannelMessageHandlerTest.java +++ b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/WorkChannelMessageHandlerTest.java @@ -18,6 +18,7 @@ import jakarta.annotation.Nonnull; import java.util.Collection; +import java.util.Map; import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; @@ -67,11 +68,9 @@ class WorkChannelMessageHandlerTest extends BaseBatch2Test { verify(myAppender, atLeastOnce()).doAppend(myLoggingEvent.capture()); myLoggingEvent.getAllValues() .forEach(event -> { - Set mdcPropertySetKeys = event.getMDCPropertyMap().keySet(); - assertThat(mdcPropertySetKeys).containsExactlyInAnyOrder(BatchJobTracingContext.CHUNK_ID, BatchJobTracingContext.INSTANCE_ID); - - Collection mdcPropertySetValues = event.getMDCPropertyMap().values(); - assertThat(mdcPropertySetValues).containsExactlyInAnyOrder(INSTANCE_ID, CHUNK_ID); + Map mdcPropertyMap = event.getMDCPropertyMap(); + assertThat(mdcPropertyMap).containsEntry(BatchJobTracingContext.CHUNK_ID, CHUNK_ID); + assertThat(mdcPropertyMap).containsEntry(BatchJobTracingContext.INSTANCE_ID, INSTANCE_ID); }); }