diff --git a/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/AbstractOpenTelemetryAppenderTest.java b/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/AbstractOpenTelemetryAppenderTest.java index 39244e330122..7595d9ddd22d 100644 --- a/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/AbstractOpenTelemetryAppenderTest.java +++ b/instrumentation/logback/logback-appender-1.0/library/src/test/java/io/opentelemetry/instrumentation/logback/appender/v1_0/AbstractOpenTelemetryAppenderTest.java @@ -113,6 +113,7 @@ void logWithExtras() { executeAfterLogsExecution(); + Instant now = Instant.now(); List logDataList = logRecordExporter.getFinishedLogRecordItems(); assertThat(logDataList).hasSize(1); LogRecordData logData = logDataList.get(0); @@ -121,7 +122,7 @@ void logWithExtras() { assertThat(logData.getBody().asString()).isEqualTo("log message 1"); assertThat(logData.getTimestampEpochNanos()) .isGreaterThanOrEqualTo(TimeUnit.MILLISECONDS.toNanos(start.toEpochMilli())) - .isLessThanOrEqualTo(TimeUnit.MILLISECONDS.toNanos(Instant.now().toEpochMilli())); + .isLessThanOrEqualTo(TimeUnit.SECONDS.toNanos(now.getEpochSecond()) + now.getNano()); assertThat(logData.getSeverity()).isEqualTo(Severity.INFO); assertThat(logData.getSeverityText()).isEqualTo("INFO"); assertThat(logData.getAttributes().size())