diff --git a/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/IMetricLoggerService.java b/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/IMetricLoggerService.java index c41da4fb4c..c05e8ca66b 100644 --- a/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/IMetricLoggerService.java +++ b/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/IMetricLoggerService.java @@ -10,26 +10,17 @@ public interface IMetricLoggerService { ArrayList getTagsForSubmission(String[] customTags); - MetricsPayload createMetricsPayload( - @NotNull String metricPrefix, @NotNull METRIC metric, double value, String[] tags); + MetricsPayload createMetricsPayload(@NotNull METRIC metric, double value, String[] tags); - void submitCount(@NotNull String metricPrefix, @NotNull METRIC metric, String[] tags); + void submitCount(@NotNull METRIC metric, String[] tags); - void submitCount( - @NotNull String metricPrefix, @NotNull METRIC metric, double value, String[] tags); + void submitCount(@NotNull METRIC metric, double value, String[] tags); DistributionPointsPayload createDistributionPointsPayload( - @NotNull String metricPrefix, - @NotNull METRIC metric, - double timestamp, - double value, - String[] tags); + @NotNull METRIC metric, double timestamp, double value, String[] tags); void submitRequestDuration( - @NotNull String metricPrefix, - long requestStartNanoseconds, - long requestEndNanoseconds, - String[] tags); + long requestStartNanoseconds, long requestEndNanoseconds, String[] tags); enum METRIC { REQUEST_START, diff --git a/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/MetricLoggerService.java b/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/MetricLoggerService.java index dbd096b14c..287d659f30 100644 --- a/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/MetricLoggerService.java +++ b/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/MetricLoggerService.java @@ -5,6 +5,8 @@ import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Service; @@ -19,6 +21,24 @@ public class MetricLoggerService implements IMetricLoggerService { private final MetricsApi metricsApi; + @Value("${vro.env}") + public final String env; + + @Value("${vro.it-portfolio:benefits-delivery}") + public final String itPortfolio; + + @Value("${vro.team:va-abd-rrd}") + public final String team; + + @Value("${vro.app.service}") + public final String service; + + @Value("${vro.app.dependencies:}") + public final Set dependencies; + + @Value("${vro.metric.prefix}") + public final String metricPrefix; + public static double getTimestamp() { return Long.valueOf(OffsetDateTime.now().toInstant().getEpochSecond()).doubleValue(); } @@ -39,16 +59,28 @@ public ArrayList getTagsForSubmission(String[] customTags) { // tags that will accompany the submitted data point(s). // a "key:value" format, while not required, can be convenient with querying metrics in the // datadog dashboard - ArrayList tags = new ArrayList<>(); + Set tags = new HashSet<>(); if (customTags != null) { tags.addAll(Arrays.asList(customTags)); } - return tags; + + tags.add("env:" + env); + tags.add("itportfolio:" + itPortfolio); + tags.add("team:" + team); + tags.add("service:" + service); + if (dependencies != null && !dependencies.isEmpty()) { + for (String dep : dependencies) { + if (StringUtils.isNotEmpty(dep)) { + tags.add("dependency:" + dep); + } + } + } + + return new ArrayList<>(tags); } @Override - public MetricsPayload createMetricsPayload( - @NotNull String metricPrefix, @NotNull METRIC metric, double value, String[] tags) { + public MetricsPayload createMetricsPayload(@NotNull METRIC metric, double value, String[] tags) { // create the payload for a count metric Series dataPointSeries = new Series(); dataPointSeries.setMetric(getFullMetricString(metricPrefix, metric)); @@ -60,14 +92,13 @@ public MetricsPayload createMetricsPayload( } @Override - public void submitCount(@NotNull String metricPrefix, @NotNull METRIC metric, String[] tags) { - submitCount(metricPrefix, metric, 1.0, tags); + public void submitCount(@NotNull METRIC metric, String[] tags) { + submitCount(metric, 1.0, tags); } @Override - public void submitCount( - @NotNull String metricPrefix, @NotNull METRIC metric, double value, String[] tags) { - MetricsPayload payload = createMetricsPayload(metricPrefix, metric, value, tags); + public void submitCount(@NotNull METRIC metric, double value, String[] tags) { + MetricsPayload payload = createMetricsPayload(metric, value, tags); try { metricsApi @@ -77,7 +108,7 @@ public void submitCount( if (ex != null) { log.warn(String.format("exception submitting %s: %s", metric, ex.getMessage())); } else { - log.info(String.format("submitted %s: %s", metric, payloadAccepted.getStatus())); + log.debug(String.format("submitted %s: %s", metric, payloadAccepted.getStatus())); } }); } catch (Exception e) { @@ -87,11 +118,7 @@ public void submitCount( @Override public DistributionPointsPayload createDistributionPointsPayload( - @NotNull String metricPrefix, - @NotNull METRIC metric, - double timestamp, - double value, - String[] tags) { + @NotNull METRIC metric, double timestamp, double value, String[] tags) { // create the payload for a distribution metric DistributionPointsSeries dataPointSeries = new DistributionPointsSeries(); @@ -109,14 +136,10 @@ public DistributionPointsPayload createDistributionPointsPayload( @Override public void submitRequestDuration( - @NotNull String metricPrefix, - long requestStartNanoseconds, - long requestEndNanoseconds, - String[] tags) { + long requestStartNanoseconds, long requestEndNanoseconds, String[] tags) { DistributionPointsPayload payload = createDistributionPointsPayload( - metricPrefix, METRIC.REQUEST_DURATION, getTimestamp(), getElapsedTimeInMilliseconds(requestStartNanoseconds, requestEndNanoseconds), @@ -132,7 +155,7 @@ public void submitRequestDuration( String.format( "exception submitting %s: %s", METRIC.REQUEST_DURATION, ex.getMessage())); } else { - log.info( + log.debug( String.format( "submitted %s: %s", METRIC.REQUEST_DURATION, payloadAccepted.getStatus())); diff --git a/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/NoopMetricLoggerService.java b/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/NoopMetricLoggerService.java index fba5ec5883..6605a907fa 100644 --- a/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/NoopMetricLoggerService.java +++ b/shared/lib-metrics/src/main/java/gov/va/vro/metricslogging/NoopMetricLoggerService.java @@ -2,7 +2,6 @@ import com.datadog.api.client.v1.model.DistributionPointsPayload; import com.datadog.api.client.v1.model.MetricsPayload; -import jakarta.validation.constraints.NotNull; import org.springframework.context.annotation.Conditional; import org.springframework.stereotype.Service; @@ -18,28 +17,23 @@ public ArrayList getTagsForSubmission(String[] customTags) { } @Override - public MetricsPayload createMetricsPayload( - @NotNull String metricPrefix, METRIC metric, double value, String[] tags) { + public MetricsPayload createMetricsPayload(METRIC metric, double value, String[] tags) { return new MetricsPayload(); } @Override - public void submitCount(@NotNull String metricPrefix, METRIC metric, String[] tags) {} + public void submitCount(METRIC metric, String[] tags) {} @Override - public void submitCount( - @NotNull String metricPrefix, METRIC metric, double value, String[] tags) {} + public void submitCount(METRIC metric, double value, String[] tags) {} @Override public DistributionPointsPayload createDistributionPointsPayload( - @NotNull String metricPrefix, METRIC metric, double timestamp, double value, String[] tags) { + METRIC metric, double timestamp, double value, String[] tags) { return new DistributionPointsPayload(); } @Override public void submitRequestDuration( - @NotNull String metricPrefix, - long requestStartNanoseconds, - long requestEndNanoseconds, - String[] tags) {} + long requestStartNanoseconds, long requestEndNanoseconds, String[] tags) {} } diff --git a/shared/lib-metrics/src/test/java/gov/va/vro/metricslogging/MetricLoggerServiceTest.java b/shared/lib-metrics/src/test/java/gov/va/vro/metricslogging/MetricLoggerServiceTest.java index a7198936bc..da0031b4a2 100644 --- a/shared/lib-metrics/src/test/java/gov/va/vro/metricslogging/MetricLoggerServiceTest.java +++ b/shared/lib-metrics/src/test/java/gov/va/vro/metricslogging/MetricLoggerServiceTest.java @@ -12,18 +12,29 @@ import org.mockito.ArgumentMatchers; import java.time.OffsetDateTime; +import java.util.Collections; import java.util.List; import java.util.Objects; +import java.util.Set; public class MetricLoggerServiceTest { - private MetricLoggerService mls = new MetricLoggerService(new MetricsApi()); + private MetricLoggerService mls = + new MetricLoggerService( + new MetricsApi(), + "env", + "benefits-delivery", + "va-abd-rrd", + "the-service", + Set.of("dep_1", "dep_2"), + METRICS_PREFIX); private static final String METRICS_PREFIX = "vro_short_app_name"; @Test void testConstructors() { try { - new MetricLoggerService(new MetricsApi()); + new MetricLoggerService( + new MetricsApi(), "", "", "", "", Collections.emptySet(), METRICS_PREFIX); } catch (Exception e) { fail("Constructor failed", e); } @@ -63,23 +74,46 @@ void getTagsForSubmission() { mls.getTagsForSubmission(new String[] {"source:integration-test", "version:2.1"}); assertTrue(tags.contains("source:integration-test")); assertTrue(tags.contains("version:2.1")); - assertEquals(tags.size(), 2); + + // two tags above; 4 required tags + 2 dependency tags + assertEquals(tags.size(), 8); + + List requiredTags = List.of("env:", "team:", "itportfolio:", "service:", "dependency:"); + for (String requiredTag : requiredTags) { + if (tags.stream().noneMatch(t -> t.startsWith(requiredTag))) { + fail("Required tag " + requiredTag + " not found in tags: " + tags); + } + } } @Test void getTagsForSubmissionNoCustomTags() { List tags = mls.getTagsForSubmission(null); - assertEquals(0, tags.size()); + + // 4 required tags + 2 dependency tags + assertEquals(tags.size(), 6); + + // check that all required tags are present + List requiredTags = List.of("env:", "team:", "itportfolio:", "service:", "dependency:"); + for (String requiredTag : requiredTags) { + if (tags.stream().noneMatch(t -> t.startsWith(requiredTag))) { + fail("Required tag " + requiredTag + " not found in tags: " + tags); + } + } + + // check that no extra tags were added since we passed null above + for (String tag : tags) { + if (requiredTags.stream().noneMatch(t -> t.startsWith(tag.substring(0, t.indexOf(":"))))) { + fail("Unexpected tag: " + tag); + } + } } @Test void testCreateMetricsPayload() { MetricsPayload mp = mls.createMetricsPayload( - METRICS_PREFIX, - MetricLoggerService.METRIC.RESPONSE_COMPLETE, - 14.0, - new String[] {"zone:purple"}); + MetricLoggerService.METRIC.RESPONSE_COMPLETE, 14.0, new String[] {"zone:purple"}); Assertions.assertEquals("count", mp.getSeries().get(0).getType()); Assertions.assertEquals(1, mp.getSeries().size()); Assertions.assertEquals( @@ -108,7 +142,6 @@ void testCreateDistributionPointsPayload() { DistributionPointsPayload dpl = mls.createDistributionPointsPayload( - METRICS_PREFIX, MetricLoggerService.METRIC.REQUEST_DURATION, timestamp, 1523, @@ -128,9 +161,10 @@ void testCreateDistributionPointsPayload() { @Test void testSubmitCountCallsApiWithPayload() { MetricsApi metricsApi = mock(MetricsApi.class); - MetricLoggerService mls = new MetricLoggerService(metricsApi); - mls.submitCount(METRICS_PREFIX, IMetricLoggerService.METRIC.RESPONSE_COMPLETE, null); - mls.submitCount(METRICS_PREFIX, IMetricLoggerService.METRIC.RESPONSE_COMPLETE, 3.0, null); + MetricLoggerService mls = + new MetricLoggerService(metricsApi, "", "", "", "", Collections.emptySet(), METRICS_PREFIX); + mls.submitCount(IMetricLoggerService.METRIC.RESPONSE_COMPLETE, null); + mls.submitCount(IMetricLoggerService.METRIC.RESPONSE_COMPLETE, 3.0, null); try { verify(metricsApi, times(2)).submitMetricsAsync(ArgumentMatchers.any(MetricsPayload.class)); } catch (Exception e) { @@ -141,8 +175,9 @@ void testSubmitCountCallsApiWithPayload() { @Test void testSubmitRequestDurationCallsApiWithPayload() { MetricsApi metricsApi = mock(MetricsApi.class); - MetricLoggerService mls = new MetricLoggerService(metricsApi); - mls.submitRequestDuration("app_name_placeholder", 100, 200, null); + MetricLoggerService mls = + new MetricLoggerService(metricsApi, "", "", "", "", Collections.emptySet(), METRICS_PREFIX); + mls.submitRequestDuration(100, 200, null); try { verify(metricsApi, times(1)) .submitDistributionPointsAsync(ArgumentMatchers.any(DistributionPointsPayload.class)); diff --git a/svc-bie-kafka/src/main/java/gov/va/vro/services/bie/service/kafka/ContentionEventsListener.java b/svc-bie-kafka/src/main/java/gov/va/vro/services/bie/service/kafka/ContentionEventsListener.java index 5e5612eb2c..2d42e351e9 100644 --- a/svc-bie-kafka/src/main/java/gov/va/vro/services/bie/service/kafka/ContentionEventsListener.java +++ b/svc-bie-kafka/src/main/java/gov/va/vro/services/bie/service/kafka/ContentionEventsListener.java @@ -29,7 +29,6 @@ public class ContentionEventsListener { private final IMetricLoggerService metricLogger; private final BieRecordTransformer bieRecordTransformer; private final ContentionEventPayloadTransformer contentionEventPayloadTransformer; - private static final String METRICS_PREFIX = "vro_bie_kafka"; @KafkaListener(topics = "#{bieKafkaProperties.topicNames()}") public void consume(ConsumerRecord record) { @@ -39,13 +38,7 @@ public void consume(ConsumerRecord record) { long transactionStartTime = System.nanoTime(); final String topicName = record.topic(); - final String[] metricTags = { - "env:" + System.getenv("ENV"), - "team:va-abd-rrd", - "itportfolio:benefits-delivery", - "service:svcBieKafka", - "topic:" + topicName - }; + final String[] metricTags = {"topic:" + topicName}; boolean saved = false; boolean sent = false; @@ -61,8 +54,7 @@ public void consume(ConsumerRecord record) { saved = true; } catch (DataAccessException e) { log.error("Database error while saving message: {}", e.getMessage()); - metricLogger.submitCount( - METRICS_PREFIX, MetricLoggerService.METRIC.RESPONSE_ERROR, metricTags); + metricLogger.submitCount(MetricLoggerService.METRIC.RESPONSE_ERROR, metricTags); return; } @@ -71,15 +63,13 @@ public void consume(ConsumerRecord record) { sent = true; } catch (AmqpException e) { log.error("AMQP error while sending message: {}", e.getMessage()); - metricLogger.submitCount( - METRICS_PREFIX, MetricLoggerService.METRIC.RESPONSE_ERROR, metricTags); + metricLogger.submitCount(MetricLoggerService.METRIC.RESPONSE_ERROR, metricTags); } submitMetrics(metricTags, transactionStartTime); } catch (Exception e) { log.error("General error while processing message: {}", e.getMessage()); - metricLogger.submitCount( - METRICS_PREFIX, MetricLoggerService.METRIC.RESPONSE_ERROR, metricTags); + metricLogger.submitCount(MetricLoggerService.METRIC.RESPONSE_ERROR, metricTags); } finally { log.info( "event=receivedMessage topic={} saved={} sent={} payload={}", @@ -91,11 +81,9 @@ public void consume(ConsumerRecord record) { } private void submitMetrics(String[] metricTagsWithTopicName, long transactionStartTime) { - metricLogger.submitCount( - METRICS_PREFIX, MetricLoggerService.METRIC.REQUEST_START, metricTagsWithTopicName); + metricLogger.submitCount(MetricLoggerService.METRIC.REQUEST_START, metricTagsWithTopicName); metricLogger.submitRequestDuration( - METRICS_PREFIX, transactionStartTime, System.nanoTime(), metricTagsWithTopicName); - metricLogger.submitCount( - METRICS_PREFIX, MetricLoggerService.METRIC.RESPONSE_COMPLETE, metricTagsWithTopicName); + transactionStartTime, System.nanoTime(), metricTagsWithTopicName); + metricLogger.submitCount(MetricLoggerService.METRIC.RESPONSE_COMPLETE, metricTagsWithTopicName); } } diff --git a/svc-bie-kafka/src/main/resources/application.yaml b/svc-bie-kafka/src/main/resources/application.yaml index 49cf53ebe8..1818cf48f2 100644 --- a/svc-bie-kafka/src/main/resources/application.yaml +++ b/svc-bie-kafka/src/main/resources/application.yaml @@ -69,3 +69,11 @@ management: group: liveness.include: livenessState readiness.include: readinessState + +vro: + env: ${ENV} + app: + service: vro-svc-bie-kafka + dependencies: bie + metrics: + prefix: vro_bie_kafka diff --git a/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipApiService.java b/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipApiService.java index b54dafc376..ad9fda095a 100644 --- a/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipApiService.java +++ b/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipApiService.java @@ -65,7 +65,6 @@ public class BipApiService implements IBipApiService { final ObjectMapper mapper; final IMetricLoggerService metricLogger; - public static final String METRICS_PREFIX = "vro_bip"; static final String CLAIM_DETAILS = "/claims/%s"; static final String CANCEL_CLAIM = "/claims/%s/cancel"; @@ -203,7 +202,6 @@ private T makeRequest( log.info( "event=requestSent url={} method={} auth={}", url, method, headers.get("Authorization")); metricLogger.submitCount( - METRICS_PREFIX, IMetricLoggerService.METRIC.REQUEST_START, new String[] { String.format("expectedResponse:%s", expectedResponse.getSimpleName()), @@ -221,7 +219,6 @@ private T makeRequest( method, bipResponse.getStatusCode().value()); metricLogger.submitRequestDuration( - METRICS_PREFIX, requestStartTime, System.nanoTime(), new String[] { @@ -238,7 +235,6 @@ private T makeRequest( } metricLogger.submitCount( - METRICS_PREFIX, IMetricLoggerService.METRIC.RESPONSE_COMPLETE, new String[] { String.format("expectedResponse:%s", expectedResponse.getSimpleName()), @@ -281,7 +277,6 @@ private T makeRequest( e.getMessage()); metricLogger.submitCount( - METRICS_PREFIX, IMetricLoggerService.METRIC.RESPONSE_ERROR, new String[] { String.format("expectedResponse:%s", expectedResponse.getSimpleName()), diff --git a/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipRequestErrorHandler.java b/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipRequestErrorHandler.java index 4587ed1aaf..bdf6ab7528 100644 --- a/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipRequestErrorHandler.java +++ b/svc-bip-api/src/main/java/gov/va/vro/bip/service/BipRequestErrorHandler.java @@ -67,7 +67,6 @@ public Object handleError( } metricLoggerService.submitCount( - BipApiService.METRICS_PREFIX, MetricLoggerService.METRIC.LISTENER_ERROR, new String[] { "event:statusCodeException", @@ -98,7 +97,6 @@ public Object handleError( .build()); metricLoggerService.submitCount( - BipApiService.METRICS_PREFIX, MetricLoggerService.METRIC.LISTENER_ERROR, new String[] { "event:unexpectedError", diff --git a/svc-bip-api/src/main/java/gov/va/vro/bip/service/InvalidPayloadRejectingFatalExceptionStrategy.java b/svc-bip-api/src/main/java/gov/va/vro/bip/service/InvalidPayloadRejectingFatalExceptionStrategy.java index 3d3a922023..22bac37f0a 100644 --- a/svc-bip-api/src/main/java/gov/va/vro/bip/service/InvalidPayloadRejectingFatalExceptionStrategy.java +++ b/svc-bip-api/src/main/java/gov/va/vro/bip/service/InvalidPayloadRejectingFatalExceptionStrategy.java @@ -32,7 +32,6 @@ public boolean isFatal(@NotNull Throwable t) { ((ListenerExecutionFailedException) t).getFailedMessage()); metricLoggerService.submitCount( - BipApiService.METRICS_PREFIX, MetricLoggerService.METRIC.MESSAGE_CONVERSION_ERROR, new String[] { "event:fatalMessageConversionError", diff --git a/svc-bip-api/src/main/resources/application.yaml b/svc-bip-api/src/main/resources/application.yaml index 42bf2b9fcd..87c85445c3 100644 --- a/svc-bip-api/src/main/resources/application.yaml +++ b/svc-bip-api/src/main/resources/application.yaml @@ -59,3 +59,11 @@ management: truststore: ${BIP_TRUSTSTORE} keystore: ${BIP_KEYSTORE} truststore_password: ${BIP_PASSWORD} + +vro: + env: ${ENV} + app: + service: vro-svc-bip-api + dependencies: bip-claims-api + metrics: + prefix: vro_bip diff --git a/svc-bip-api/src/test/java/gov/va/vro/bip/config/RabbitMqApiConfigTest.java b/svc-bip-api/src/test/java/gov/va/vro/bip/config/RabbitMqApiConfigTest.java index c9ff42ef58..4741cc85a9 100644 --- a/svc-bip-api/src/test/java/gov/va/vro/bip/config/RabbitMqApiConfigTest.java +++ b/svc-bip-api/src/test/java/gov/va/vro/bip/config/RabbitMqApiConfigTest.java @@ -12,11 +12,14 @@ import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException; import org.springframework.messaging.support.GenericMessage; +import java.util.Collections; import java.util.HashMap; class RabbitMqApiConfigTest { - private final MetricLoggerService metricLoggerService = new MetricLoggerService(new MetricsApi()); + private final MetricLoggerService metricLoggerService = + new MetricLoggerService( + new MetricsApi(), "", "", "", "", Collections.emptySet(), "metric_prefix"); @Test @SuppressWarnings({"unchecked", "rawtypes"}) diff --git a/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipApiServiceTest.java b/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipApiServiceTest.java index f2c6230d7a..f0d1fc94f0 100644 --- a/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipApiServiceTest.java +++ b/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipApiServiceTest.java @@ -597,7 +597,6 @@ public void testMetricsUsesBipPrefix() throws Exception { assertResponseIsSuccess(result, HttpStatus.OK); verify(metricLoggerService, times(1)) .submitCount( - "vro_bip", IMetricLoggerService.METRIC.REQUEST_START, new String[] { "expectedResponse:PutTempStationOfJurisdictionResponse", @@ -606,13 +605,9 @@ public void testMetricsUsesBipPrefix() throws Exception { }); verify(metricLoggerService, times(1)) .submitRequestDuration( - ArgumentMatchers.anyString(), - ArgumentMatchers.anyLong(), - ArgumentMatchers.anyLong(), - ArgumentMatchers.any()); + ArgumentMatchers.anyLong(), ArgumentMatchers.anyLong(), ArgumentMatchers.any()); verify(metricLoggerService, times(1)) .submitCount( - "vro_bip", IMetricLoggerService.METRIC.RESPONSE_COMPLETE, new String[] { "expectedResponse:PutTempStationOfJurisdictionResponse", @@ -630,13 +625,9 @@ private void assertResponseIsSuccess(BipPayloadResponse response, HttpStatus sta private void verifyMetricsAreLogged() { verify(metricLoggerService, times(2)) - .submitCount( - ArgumentMatchers.anyString(), - ArgumentMatchers.any(), - ArgumentMatchers.any(String[].class)); + .submitCount(ArgumentMatchers.any(), ArgumentMatchers.any(String[].class)); verify(metricLoggerService, times(1)) .submitRequestDuration( - ArgumentMatchers.anyString(), ArgumentMatchers.anyLong(), ArgumentMatchers.anyLong(), ArgumentMatchers.any(String[].class)); @@ -644,10 +635,7 @@ private void verifyMetricsAreLogged() { private void verifyMetricIsLoggedForExceptions(TestCase testCase) { verify(metricLoggerService, times(testCase == TestCase.BIP_INTERNAL ? 2 : 1)) - .submitCount( - ArgumentMatchers.anyString(), - ArgumentMatchers.any(), - ArgumentMatchers.any(String[].class)); + .submitCount(ArgumentMatchers.any(), ArgumentMatchers.any(String[].class)); } private void assertResponseExceptionWithStatus(Exception ex, HttpStatus expected) diff --git a/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipRequestErrorHandlerTest.java b/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipRequestErrorHandlerTest.java index 3a5aed88fa..1a4aa71bde 100644 --- a/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipRequestErrorHandlerTest.java +++ b/svc-bip-api/src/test/java/gov/va/vro/bip/service/BipRequestErrorHandlerTest.java @@ -24,12 +24,14 @@ import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Collections; import java.util.Objects; class BipRequestErrorHandlerTest { private static final String CLAIM_RESPONSE_404 = "bip-test-data/claim_response_404.json"; - private final MetricLoggerService metricLoggerService = new MetricLoggerService(new MetricsApi()); + private final MetricLoggerService metricLoggerService = + new MetricLoggerService(new MetricsApi(), "", "", "", "", Collections.emptySet(), "vro_bip"); enum HttpStatusCodeTestCase { NOT_FOUND(new HttpClientErrorException(HttpStatus.NOT_FOUND)),