remove unnecessary MessageMetrics default constructor

This commit is contained in:
Jonathan Klabunde Tomer authored and GitHub committed 2025-08-11 12:28:28 -07:00
1 parent 36d0c4422e
commit dabe1c157b
5 files changed
+7 -11

No files matched your search

@@ -45,11 +45,6 @@ public final class MessageMetrics {
this(Metrics.globalRegistry, messageTtl);
}
@VisibleForTesting
public MessageMetrics() {
this(Metrics.globalRegistry, Duration.ofDays(30));
}
public void measureAccountOutgoingMessageUuidMismatches(final Account account,
final OutgoingMessageEntity outgoingMessage) {
measureAccountDestinationUuidMismatches(account, outgoingMessage.destinationUuid());
@@ -90,6 +85,7 @@ public final class MessageMetrics {
tags.add(Tag.of("isUrgent", String.valueOf(isUrgent)));
tags.add(Tag.of("isEphemeral", String.valueOf(isEphemeral)));
// This tag makes the metric extremely expensive on some platforms
// UserAgentTagUtil.getClientVersionTag(userAgent, clientReleaseManager).ifPresent(tags::add);
Timer.builder(DELIVERY_LATENCY_TIMER_NAME)
@@ -195,7 +195,7 @@ class MessageControllerTest {
new MessageController(rateLimiters, cardinalityEstimator, messageSender, receiptSender, accountsManager,
messagesManager, phoneNumberIdentifiers, pushNotificationManager, pushNotificationScheduler,
reportMessageManager, messageDeliveryScheduler, mock(ClientReleaseManager.class),
serverSecretParams, SpamChecker.noop(), new MessageMetrics(), mock(MessageDeliveryLoopMonitor.class),
serverSecretParams, SpamChecker.noop(), new MessageMetrics(Duration.ofDays(30)), mock(MessageDeliveryLoopMonitor.class),
clock))
.build();
@@ -99,7 +99,7 @@ class MetricsUtilTest {
final OpenTelemetryConfiguration openTelemetryConfig =
new OpenTelemetryConfiguration(true, Duration.ZERO, 8, Map.of(), Map.of());
// Yes, this has to be OtlpMeterRegistry—its histograms behave differently than SimpleMeterRegistry's 😭
// Yes, this has to be OtlpMeterRegistry—its histograms behave differently than SimpleMeterRegistry's
final MeterRegistry registry = new OtlpMeterRegistry(openTelemetryConfig, Clock.SYSTEM);
MetricsUtil.configureHistogramFilters(registry.config(), openTelemetryConfig);
@@ -134,7 +134,7 @@ class WebSocketConnectionIntegrationTest {
final WebSocketConnection webSocketConnection = new WebSocketConnection(
mock(ReceiptSender.class),
new MessagesManager(messagesDynamoDb, messagesCache, redisMessageAvailabilityManager, reportMessageManager, sharedExecutorService, Clock.systemUTC()),
new MessageMetrics(),
new MessageMetrics(Duration.ofDays(30)),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,
@@ -223,7 +223,7 @@ class WebSocketConnectionIntegrationTest {
final WebSocketConnection webSocketConnection = new WebSocketConnection(
mock(ReceiptSender.class),
new MessagesManager(messagesDynamoDb, messagesCache, redisMessageAvailabilityManager, reportMessageManager, sharedExecutorService, Clock.systemUTC()),
new MessageMetrics(),
new MessageMetrics(Duration.ofDays(30)),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,
@@ -119,7 +119,7 @@ class WebSocketConnectionTest {
WebSocketAccountAuthenticator webSocketAuthenticator =
new WebSocketAccountAuthenticator(accountAuthenticator);
AuthenticatedConnectListener connectListener = new AuthenticatedConnectListener(accountsManager, receiptSender, messagesManager,
new MessageMetrics(), mock(PushNotificationManager.class), mock(PushNotificationScheduler.class),
new MessageMetrics(Duration.ofDays(30)), mock(PushNotificationManager.class), mock(PushNotificationScheduler.class),
mock(RedisMessageAvailabilityManager.class), mock(DisconnectionRequestManager.class),
messageDeliveryScheduler, clientReleaseManager, mock(MessageDeliveryLoopMonitor.class),
mock(ExperimentEnrollmentManager.class));
@@ -625,7 +625,7 @@ class WebSocketConnectionTest {
private WebSocketConnection webSocketConnection(final WebSocketClient client) {
return new WebSocketConnection(receiptSender,
messagesManager,
new MessageMetrics(),
new MessageMetrics(Duration.ofDays(30)),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,