From 9f4c35c686649c7396e6e48ca0ac2ac0a4a3ee33 Mon Sep 17 00:00:00 2001
From: Mark Allen <3417310+maallen@users.noreply.github.com>
Date: Fri, 15 Nov 2024 16:27:26 +0000
Subject: [PATCH 1/6] Added AI translation quality metrics
---
pom.xml | 6 ++
.../box/l10n/mojito/service/tm/TMService.java | 74 +++++++++++++++++++
2 files changed, 80 insertions(+)
diff --git a/pom.xml b/pom.xml
index 60dc1473a2..f0889f2a0a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,6 +80,12 @@
${icu4j.version}
+
+ org.apache.commons
+ commons-text
+ 1.12.0
+
+
diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
index 5bb8e238dc..9f20aef549 100644
--- a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
+++ b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
@@ -61,6 +61,7 @@
import com.google.common.base.Preconditions;
import com.ibm.icu.text.MessageFormat;
import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.Timer;
import jakarta.persistence.EntityManager;
import java.io.ByteArrayOutputStream;
@@ -79,6 +80,7 @@
import net.sf.okapi.steps.common.FilterEventsWriterStep;
import net.sf.okapi.steps.common.RawDocumentToFilterEventsStep;
import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.text.similarity.LevenshteinDistance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -150,6 +152,15 @@ public class TMService {
@Value("${l10n.tmService.quartz.schedulerName:" + DEFAULT_SCHEDULER_NAME + "}")
String schedulerName;
+ @Value("${l10n.ai.translation.similarity.review.editDistanceMax:100}")
+ int editDistanceMax;
+
+ @Value("${l10n.ai.translation.review.similarity.highPercentage:90}")
+ int aiTranslationSimilarityHighPercentage;
+
+ @Value("${l10n.ai.translation.review.similarity.mediumPercentage:70}")
+ int aiTranslationSimilarityMediumPercentage;
+
/**
* Adds a {@link TMTextUnit} in a {@link TM}.
*
@@ -608,6 +619,11 @@ public AddTMTextUnitCurrentVariantResult addTMTextUnitCurrentVariantWithResult(
boolean overridden =
checkOverridden
&& currentTmTextUnitVariant.getStatus() == TMTextUnitVariant.Status.OVERRIDDEN;
+ if (currentTmTextUnitVariant.getStatus() == TMTextUnitVariant.Status.MT_REVIEW_NEEDED
+ && status == TMTextUnitVariant.Status.APPROVED) {
+
+ logAiReviewMetrics(content, currentTmTextUnitVariant);
+ }
boolean updateNeeded =
!overridden
&& isUpdateNeededForTmTextUnitVariant(
@@ -653,6 +669,64 @@ && isUpdateNeededForTmTextUnitVariant(
return new AddTMTextUnitCurrentVariantResult(!noUpdate, tmTextUnitCurrentVariant);
}
+ private void logAiReviewMetrics(
+ String reviewedTranslation, TMTextUnitVariant currentTmTextUnitVariant) {
+ if (currentTmTextUnitVariant.getContent().equals(reviewedTranslation)) {
+ meterRegistry
+ .counter(
+ "AiTranslation.review.similarity.match",
+ Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ .increment();
+ } else {
+ // Translation has been updated in review, check similarity of original to new
+ logSimilarityMetrics(reviewedTranslation, currentTmTextUnitVariant);
+ }
+ }
+
+ private void logSimilarityMetrics(
+ String reviewedTranslation, TMTextUnitVariant currentTmTextUnitVariant) {
+ LevenshteinDistance levenshteinDistance = new LevenshteinDistance(editDistanceMax);
+ int editDistance =
+ levenshteinDistance.apply(currentTmTextUnitVariant.getContent(), reviewedTranslation);
+ if (editDistance < 0) {
+ // Negative edit distance means the edit distance threshold was exceeded, log as low
+ // similarity
+ meterRegistry
+ .counter(
+ "AiTranslation.review.similarity.low",
+ Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ .increment();
+ } else {
+ double similarityPercentage =
+ calculateSimilarityPercentage(
+ currentTmTextUnitVariant.getContent(), reviewedTranslation, editDistance);
+ if (similarityPercentage >= aiTranslationSimilarityHighPercentage) {
+ meterRegistry
+ .counter(
+ "AiTranslation.review.similarity.high",
+ Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ .increment();
+ } else if (similarityPercentage >= aiTranslationSimilarityMediumPercentage) {
+ meterRegistry
+ .counter(
+ "AiTranslation.review.similarity.medium",
+ Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ .increment();
+ } else {
+ meterRegistry
+ .counter(
+ "AiTranslation.review.similarity.low",
+ Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ .increment();
+ }
+ }
+ }
+
+ private double calculateSimilarityPercentage(String original, String updated, int editDistance) {
+ int maxLength = Math.max(original.length(), updated.length());
+ return ((double) (maxLength - editDistance) / maxLength) * 100;
+ }
+
public AddTMTextUnitCurrentVariantResult addTMTextUnitCurrentVariantWithResult(
TMTextUnitCurrentVariant tmTextUnitCurrentVariant,
Long tmId,
From 77612644410b5bb8b2cfeb82a8ced8f2a9c615a9 Mon Sep 17 00:00:00 2001
From: Mark Allen <3417310+maallen@users.noreply.github.com>
Date: Fri, 15 Nov 2024 17:32:00 +0000
Subject: [PATCH 2/6] Added unit test to verify metric logging
---
.../box/l10n/mojito/service/tm/TMService.java | 1 -
.../l10n/mojito/service/tm/TMServiceTest.java | 240 ++++++++++++++++++
2 files changed, 240 insertions(+), 1 deletion(-)
diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
index 9f20aef549..7b37a6d8e4 100644
--- a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
+++ b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
@@ -621,7 +621,6 @@ public AddTMTextUnitCurrentVariantResult addTMTextUnitCurrentVariantWithResult(
&& currentTmTextUnitVariant.getStatus() == TMTextUnitVariant.Status.OVERRIDDEN;
if (currentTmTextUnitVariant.getStatus() == TMTextUnitVariant.Status.MT_REVIEW_NEEDED
&& status == TMTextUnitVariant.Status.APPROVED) {
-
logAiReviewMetrics(content, currentTmTextUnitVariant);
}
boolean updateNeeded =
diff --git a/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java b/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java
index 0bc2813f02..adee8f0e73 100644
--- a/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java
+++ b/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java
@@ -48,6 +48,10 @@
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Lists;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.Tags;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
+import jakarta.transaction.Transactional;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -63,6 +67,7 @@
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+import org.mockito.Mockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -4808,4 +4813,239 @@ public void testAddTMTextUnitWithOverriddenStatus() throws RepositoryNameAlready
assertEquals("this is the newest content", textUnitDTOFromSearch.getTarget());
assertEquals(TMTextUnitVariant.Status.APPROVED, textUnitDTOFromSearch.getStatus());
}
+
+ @Test
+ @Transactional
+ public void testMTReviewMetricsLoggingTranslationUpdatedMediumSimilarity()
+ throws RepositoryNameAlreadyUsedException {
+ MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
+ this.tmService.meterRegistry = meterRegistry;
+ createTestData();
+
+ Long textUnitId =
+ addTextUnitAndCheck(
+ this.tmId,
+ this.assetId,
+ "mtReviewMetricsLogging",
+ "mt translation content",
+ "some comment",
+ "3212c3beb09db681379b7a1ed9f37bfe",
+ "5f3ca19eb49f50b55326065f4185dadd");
+
+ Locale targetLocale = this.localeService.findByBcp47Tag("fr-FR");
+
+ TMTextUnitCurrentVariant tmTextUnitCurrentVariant =
+ this.tmService.addTMTextUnitCurrentVariant(
+ textUnitId,
+ targetLocale.getId(),
+ "mt translation content",
+ "some comment",
+ TMTextUnitVariant.Status.MT_REVIEW_NEEDED,
+ false);
+
+ this.tmService.addTMTextUnitCurrentVariantWithResult(
+ tmTextUnitCurrentVariant,
+ this.tmId,
+ this.assetId,
+ textUnitId,
+ tmTextUnitCurrentVariant.getLocale().getId(),
+ "mt translation content changed",
+ "some comment",
+ TMTextUnitVariant.Status.APPROVED,
+ true,
+ JSR310Migration.dateTimeNow(),
+ null,
+ false);
+
+ Mockito.verify(meterRegistry, Mockito.times(1))
+ .counter("AiTranslation.review.similarity.medium", Tags.of("locale", "fr-FR"));
+ }
+
+ @Test
+ @Transactional
+ public void testMTReviewMetricsLoggingTranslationUpdatedHighSimilarity()
+ throws RepositoryNameAlreadyUsedException {
+ MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
+ this.tmService.meterRegistry = meterRegistry;
+ createTestData();
+
+ Long textUnitId =
+ addTextUnitAndCheck(
+ this.tmId,
+ this.assetId,
+ "mtReviewMetricsLogging",
+ "mt translation content",
+ "some comment",
+ "3212c3beb09db681379b7a1ed9f37bfe",
+ "5f3ca19eb49f50b55326065f4185dadd");
+
+ Locale targetLocale = this.localeService.findByBcp47Tag("fr-FR");
+
+ TMTextUnitCurrentVariant tmTextUnitCurrentVariant =
+ this.tmService.addTMTextUnitCurrentVariant(
+ textUnitId,
+ targetLocale.getId(),
+ "mt translation content",
+ "some comment",
+ TMTextUnitVariant.Status.MT_REVIEW_NEEDED,
+ false);
+
+ this.tmService.addTMTextUnitCurrentVariantWithResult(
+ tmTextUnitCurrentVariant,
+ this.tmId,
+ this.assetId,
+ textUnitId,
+ tmTextUnitCurrentVariant.getLocale().getId(),
+ "mt translations content",
+ "some comment",
+ TMTextUnitVariant.Status.APPROVED,
+ true,
+ JSR310Migration.dateTimeNow(),
+ null,
+ false);
+
+ Mockito.verify(meterRegistry, Mockito.times(1))
+ .counter("AiTranslation.review.similarity.high", Tags.of("locale", "fr-FR"));
+ }
+
+ @Test
+ @Transactional
+ public void testMTReviewMetricsLoggingTranslationUpdatedLowSimilarity()
+ throws RepositoryNameAlreadyUsedException {
+ MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
+ this.tmService.meterRegistry = meterRegistry;
+ createTestData();
+
+ Long textUnitId =
+ addTextUnitAndCheck(
+ this.tmId,
+ this.assetId,
+ "mtReviewMetricsLogging",
+ "mt translation content",
+ "some comment",
+ "3212c3beb09db681379b7a1ed9f37bfe",
+ "5f3ca19eb49f50b55326065f4185dadd");
+
+ Locale targetLocale = this.localeService.findByBcp47Tag("fr-FR");
+
+ TMTextUnitCurrentVariant tmTextUnitCurrentVariant =
+ this.tmService.addTMTextUnitCurrentVariant(
+ textUnitId,
+ targetLocale.getId(),
+ "mt translation content",
+ "some comment",
+ TMTextUnitVariant.Status.MT_REVIEW_NEEDED,
+ false);
+
+ this.tmService.addTMTextUnitCurrentVariantWithResult(
+ tmTextUnitCurrentVariant,
+ this.tmId,
+ this.assetId,
+ textUnitId,
+ tmTextUnitCurrentVariant.getLocale().getId(),
+ "completely different",
+ "some comment",
+ TMTextUnitVariant.Status.APPROVED,
+ true,
+ JSR310Migration.dateTimeNow(),
+ null,
+ false);
+
+ Mockito.verify(meterRegistry, Mockito.times(1))
+ .counter("AiTranslation.review.similarity.low", Tags.of("locale", "fr-FR"));
+ }
+
+ @Test
+ @Transactional
+ public void testMTReviewMetricsLoggingTranslationMatch()
+ throws RepositoryNameAlreadyUsedException {
+ MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
+ this.tmService.meterRegistry = meterRegistry;
+ createTestData();
+
+ Long textUnitId =
+ addTextUnitAndCheck(
+ this.tmId,
+ this.assetId,
+ "mtReviewMetricsLogging",
+ "mt translation content",
+ "some comment",
+ "3212c3beb09db681379b7a1ed9f37bfe",
+ "5f3ca19eb49f50b55326065f4185dadd");
+
+ Locale targetLocale = this.localeService.findByBcp47Tag("fr-FR");
+
+ TMTextUnitCurrentVariant tmTextUnitCurrentVariant =
+ this.tmService.addTMTextUnitCurrentVariant(
+ textUnitId,
+ targetLocale.getId(),
+ "mt translation content",
+ "some comment",
+ TMTextUnitVariant.Status.MT_REVIEW_NEEDED,
+ false);
+
+ this.tmService.addTMTextUnitCurrentVariantWithResult(
+ tmTextUnitCurrentVariant,
+ this.tmId,
+ this.assetId,
+ textUnitId,
+ tmTextUnitCurrentVariant.getLocale().getId(),
+ "mt translation content",
+ "some comment",
+ TMTextUnitVariant.Status.APPROVED,
+ true,
+ JSR310Migration.dateTimeNow(),
+ null,
+ false);
+
+ Mockito.verify(meterRegistry, Mockito.times(1))
+ .counter("AiTranslation.review.similarity.match", Tags.of("locale", "fr-FR"));
+ }
+
+ @Test
+ @Transactional
+ public void testMTReviewMetricsLoggingTranslationNotApproved()
+ throws RepositoryNameAlreadyUsedException {
+ MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
+ this.tmService.meterRegistry = meterRegistry;
+ createTestData();
+
+ Long textUnitId =
+ addTextUnitAndCheck(
+ this.tmId,
+ this.assetId,
+ "mtReviewMetricsLogging",
+ "mt translation content",
+ "some comment",
+ "3212c3beb09db681379b7a1ed9f37bfe",
+ "5f3ca19eb49f50b55326065f4185dadd");
+
+ Locale targetLocale = this.localeService.findByBcp47Tag("fr-FR");
+
+ TMTextUnitCurrentVariant tmTextUnitCurrentVariant =
+ this.tmService.addTMTextUnitCurrentVariant(
+ textUnitId,
+ targetLocale.getId(),
+ "mt translation content",
+ "some comment",
+ TMTextUnitVariant.Status.MT_REVIEW_NEEDED,
+ false);
+
+ this.tmService.addTMTextUnitCurrentVariantWithResult(
+ tmTextUnitCurrentVariant,
+ this.tmId,
+ this.assetId,
+ textUnitId,
+ tmTextUnitCurrentVariant.getLocale().getId(),
+ "mt translation content",
+ "some comment",
+ TMTextUnitVariant.Status.REVIEW_NEEDED,
+ true,
+ JSR310Migration.dateTimeNow(),
+ null,
+ false);
+
+ Mockito.verify(meterRegistry, Mockito.times(0))
+ .counter("AiTranslation.review.similarity.match", Tags.of("locale", "fr-FR"));
+ }
}
From 6bc9da937ce7c79751c36eea5885e3bd78742053 Mon Sep 17 00:00:00 2001
From: Mark Allen <3417310+maallen@users.noreply.github.com>
Date: Mon, 18 Nov 2024 10:24:49 +0000
Subject: [PATCH 3/6] Reduce default edit distance max
---
.../src/main/java/com/box/l10n/mojito/service/tm/TMService.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
index 7b37a6d8e4..ad53726dc4 100644
--- a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
+++ b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
@@ -152,7 +152,7 @@ public class TMService {
@Value("${l10n.tmService.quartz.schedulerName:" + DEFAULT_SCHEDULER_NAME + "}")
String schedulerName;
- @Value("${l10n.ai.translation.similarity.review.editDistanceMax:100}")
+ @Value("${l10n.ai.translation.similarity.review.editDistanceMax:50}")
int editDistanceMax;
@Value("${l10n.ai.translation.review.similarity.highPercentage:90}")
From cf9c99f12ca1525f04486d6102bc0936d95b2cd8 Mon Sep 17 00:00:00 2001
From: Mark Allen <3417310+maallen@users.noreply.github.com>
Date: Mon, 18 Nov 2024 10:25:57 +0000
Subject: [PATCH 4/6] Parameterise version
---
pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index f0889f2a0a..eb3f58acc9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,6 +38,7 @@
true
1.9.21
2.13.5
+ 1.12.0
@@ -83,7 +84,7 @@
org.apache.commons
commons-text
- 1.12.0
+ ${commons.text.version}
From b1f66ef05d0f8b011a2e2a97699b4bed831f9f13 Mon Sep 17 00:00:00 2001
From: Mark Allen <3417310+maallen@users.noreply.github.com>
Date: Mon, 18 Nov 2024 10:28:22 +0000
Subject: [PATCH 5/6] Use uniform config naming
---
.../src/main/java/com/box/l10n/mojito/service/tm/TMService.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
index ad53726dc4..8756cf1afa 100644
--- a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
+++ b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
@@ -152,7 +152,7 @@ public class TMService {
@Value("${l10n.tmService.quartz.schedulerName:" + DEFAULT_SCHEDULER_NAME + "}")
String schedulerName;
- @Value("${l10n.ai.translation.similarity.review.editDistanceMax:50}")
+ @Value("${l10n.ai.translation.review.similarity.editDistanceMax:50}")
int editDistanceMax;
@Value("${l10n.ai.translation.review.similarity.highPercentage:90}")
From 58efa6bc269242f64856b6e8c8b01387254e60db Mon Sep 17 00:00:00 2001
From: Mark Allen <3417310+maallen@users.noreply.github.com>
Date: Mon, 18 Nov 2024 11:02:04 +0000
Subject: [PATCH 6/6] Use LocalService, drop @Transactional in tests
---
.../box/l10n/mojito/service/tm/TMService.java | 18 +++++++++---------
.../l10n/mojito/service/tm/TMServiceTest.java | 6 ------
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
index 8756cf1afa..bfaef4b208 100644
--- a/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
+++ b/webapp/src/main/java/com/box/l10n/mojito/service/tm/TMService.java
@@ -621,7 +621,7 @@ public AddTMTextUnitCurrentVariantResult addTMTextUnitCurrentVariantWithResult(
&& currentTmTextUnitVariant.getStatus() == TMTextUnitVariant.Status.OVERRIDDEN;
if (currentTmTextUnitVariant.getStatus() == TMTextUnitVariant.Status.MT_REVIEW_NEEDED
&& status == TMTextUnitVariant.Status.APPROVED) {
- logAiReviewMetrics(content, currentTmTextUnitVariant);
+ logAiReviewMetrics(content, currentTmTextUnitVariant, localeId);
}
boolean updateNeeded =
!overridden
@@ -669,21 +669,21 @@ && isUpdateNeededForTmTextUnitVariant(
}
private void logAiReviewMetrics(
- String reviewedTranslation, TMTextUnitVariant currentTmTextUnitVariant) {
+ String reviewedTranslation, TMTextUnitVariant currentTmTextUnitVariant, Long localeId) {
if (currentTmTextUnitVariant.getContent().equals(reviewedTranslation)) {
meterRegistry
.counter(
"AiTranslation.review.similarity.match",
- Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ Tags.of("locale", localeService.findById(localeId).getBcp47Tag()))
.increment();
} else {
// Translation has been updated in review, check similarity of original to new
- logSimilarityMetrics(reviewedTranslation, currentTmTextUnitVariant);
+ logSimilarityMetrics(reviewedTranslation, currentTmTextUnitVariant, localeId);
}
}
private void logSimilarityMetrics(
- String reviewedTranslation, TMTextUnitVariant currentTmTextUnitVariant) {
+ String reviewedTranslation, TMTextUnitVariant currentTmTextUnitVariant, Long localeId) {
LevenshteinDistance levenshteinDistance = new LevenshteinDistance(editDistanceMax);
int editDistance =
levenshteinDistance.apply(currentTmTextUnitVariant.getContent(), reviewedTranslation);
@@ -693,7 +693,7 @@ private void logSimilarityMetrics(
meterRegistry
.counter(
"AiTranslation.review.similarity.low",
- Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ Tags.of("locale", localeService.findById(localeId).getBcp47Tag()))
.increment();
} else {
double similarityPercentage =
@@ -703,19 +703,19 @@ private void logSimilarityMetrics(
meterRegistry
.counter(
"AiTranslation.review.similarity.high",
- Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ Tags.of("locale", localeService.findById(localeId).getBcp47Tag()))
.increment();
} else if (similarityPercentage >= aiTranslationSimilarityMediumPercentage) {
meterRegistry
.counter(
"AiTranslation.review.similarity.medium",
- Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ Tags.of("locale", localeService.findById(localeId).getBcp47Tag()))
.increment();
} else {
meterRegistry
.counter(
"AiTranslation.review.similarity.low",
- Tags.of("locale", currentTmTextUnitVariant.getLocale().getBcp47Tag()))
+ Tags.of("locale", localeService.findById(localeId).getBcp47Tag()))
.increment();
}
}
diff --git a/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java b/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java
index adee8f0e73..e50235bc6e 100644
--- a/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java
+++ b/webapp/src/test/java/com/box/l10n/mojito/service/tm/TMServiceTest.java
@@ -51,7 +51,6 @@
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
-import jakarta.transaction.Transactional;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -4815,7 +4814,6 @@ public void testAddTMTextUnitWithOverriddenStatus() throws RepositoryNameAlready
}
@Test
- @Transactional
public void testMTReviewMetricsLoggingTranslationUpdatedMediumSimilarity()
throws RepositoryNameAlreadyUsedException {
MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
@@ -4862,7 +4860,6 @@ public void testMTReviewMetricsLoggingTranslationUpdatedMediumSimilarity()
}
@Test
- @Transactional
public void testMTReviewMetricsLoggingTranslationUpdatedHighSimilarity()
throws RepositoryNameAlreadyUsedException {
MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
@@ -4909,7 +4906,6 @@ public void testMTReviewMetricsLoggingTranslationUpdatedHighSimilarity()
}
@Test
- @Transactional
public void testMTReviewMetricsLoggingTranslationUpdatedLowSimilarity()
throws RepositoryNameAlreadyUsedException {
MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
@@ -4956,7 +4952,6 @@ public void testMTReviewMetricsLoggingTranslationUpdatedLowSimilarity()
}
@Test
- @Transactional
public void testMTReviewMetricsLoggingTranslationMatch()
throws RepositoryNameAlreadyUsedException {
MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());
@@ -5003,7 +4998,6 @@ public void testMTReviewMetricsLoggingTranslationMatch()
}
@Test
- @Transactional
public void testMTReviewMetricsLoggingTranslationNotApproved()
throws RepositoryNameAlreadyUsedException {
MeterRegistry meterRegistry = Mockito.spy(new SimpleMeterRegistry());