From a9d0574ea83f8bef5bb61bbf6bf75ad81deb7409 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Tue, 15 Aug 2023 10:50:04 -0400 Subject: [PATCH] Remove most `@Timed` annotations --- .../controllers/AccountController.java | 18 ----------------- .../controllers/AccountControllerV2.java | 5 ----- .../controllers/ArtController.java | 2 -- .../controllers/AttachmentControllerV2.java | 2 -- .../controllers/AttachmentControllerV3.java | 8 -------- .../controllers/AttachmentControllerV4.java | 4 ---- .../controllers/CallLinkController.java | 20 +++++++++---------- .../controllers/CertificateController.java | 7 +------ .../controllers/ChallengeController.java | 4 ---- .../controllers/DeviceController.java | 8 -------- .../controllers/DirectoryV2Controller.java | 2 -- .../controllers/DonationController.java | 2 -- .../controllers/KeepAliveController.java | 3 --- .../controllers/KeysController.java | 4 ---- .../controllers/PaymentsController.java | 3 --- .../controllers/ProfileController.java | 14 ------------- .../controllers/ProvisioningController.java | 2 -- .../controllers/RegistrationController.java | 6 ------ .../controllers/RemoteConfigController.java | 4 ---- .../controllers/SecureBackupController.java | 3 --- .../controllers/SecureStorageController.java | 2 -- .../SecureValueRecovery2Controller.java | 3 --- .../controllers/SubscriptionController.java | 19 ------------------ .../controllers/VerificationController.java | 8 +------- 24 files changed, 11 insertions(+), 142 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java index 1ffc037de..599a1b95e 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java @@ -4,7 +4,6 @@ */ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -91,7 +90,6 @@ public class AccountController { this.usernameHashZkProofVerifier = usernameHashZkProofVerifier; } - @Timed @GET @Path("/turn/") @Produces(MediaType.APPLICATION_JSON) @@ -100,7 +98,6 @@ public class AccountController { return turnTokenGenerator.generate(auth.getAccount().getUuid()); } - @Timed @PUT @Path("/gcm/") @Consumes(MediaType.APPLICATION_JSON) @@ -124,7 +121,6 @@ public class AccountController { }); } - @Timed @DELETE @Path("/gcm/") @ChangesDeviceEnabledState @@ -139,7 +135,6 @@ public class AccountController { }); } - @Timed @PUT @Path("/apn/") @Consumes(MediaType.APPLICATION_JSON) @@ -165,7 +160,6 @@ public class AccountController { }); } - @Timed @DELETE @Path("/apn/") @ChangesDeviceEnabledState @@ -184,7 +178,6 @@ public class AccountController { }); } - @Timed @PUT @Produces(MediaType.APPLICATION_JSON) @Path("/registration_lock") @@ -195,14 +188,12 @@ public class AccountController { a -> a.setRegistrationLock(credentials.hash(), credentials.salt())); } - @Timed @DELETE @Path("/registration_lock") public void removeRegistrationLock(@Auth AuthenticatedAccount auth) { accounts.update(auth.getAccount(), a -> a.setRegistrationLock(null, null)); } - @Timed @PUT @Path("/name/") public void setName(@Auth DisabledPermittedAuthenticatedAccount disabledPermittedAuth, @NotNull @Valid DeviceName deviceName) { @@ -211,7 +202,6 @@ public class AccountController { accounts.updateDevice(account, device.getId(), d -> d.setName(deviceName.getDeviceName())); } - @Timed @PUT @Path("/attributes/") @Consumes(MediaType.APPLICATION_JSON) @@ -268,7 +258,6 @@ public class AccountController { auth.getAccount().isStorageSupported()); } - @Timed @DELETE @Path("/username_hash") @Produces(MediaType.APPLICATION_JSON) @@ -285,7 +274,6 @@ public class AccountController { accounts.clearUsernameHash(auth.getAccount()); } - @Timed @PUT @Path("/username_hash/reserve") @Produces(MediaType.APPLICATION_JSON) @@ -325,7 +313,6 @@ public class AccountController { } } - @Timed @PUT @Path("/username_hash/confirm") @Produces(MediaType.APPLICATION_JSON) @@ -370,7 +357,6 @@ public class AccountController { } } - @Timed @GET @Path("/username_hash/{usernameHash}") @Produces(MediaType.APPLICATION_JSON) @@ -408,7 +394,6 @@ public class AccountController { .orElseThrow(() -> new WebApplicationException(Status.NOT_FOUND)); } - @Timed @PUT @Path("/username_link") @Produces(MediaType.APPLICATION_JSON) @@ -443,7 +428,6 @@ public class AccountController { return new UsernameLinkHandle(usernameLinkHandle); } - @Timed @DELETE @Path("/username_link") @Operation( @@ -462,7 +446,6 @@ public class AccountController { clearUsernameLink(auth.getAccount()); } - @Timed @GET @Path("/username_link/{uuid}") @Produces(MediaType.APPLICATION_JSON) @@ -518,7 +501,6 @@ public class AccountController { return Response.status(maybeAccount.map(ignored -> Status.OK).orElse(Status.NOT_FOUND)).build(); } - @Timed @DELETE @Path("/me") public void deleteAccount(@Auth DisabledPermittedAuthenticatedAccount auth) throws InterruptedException { diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java index bc273fd67..6051f81ce 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; -import com.codahale.metrics.annotation.Timed; import com.google.common.net.HttpHeaders; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; @@ -76,7 +75,6 @@ public class AccountControllerV2 { this.rateLimiters = rateLimiters; } - @Timed @PUT @Path("/number") @Consumes(MediaType.APPLICATION_JSON) @@ -155,7 +153,6 @@ public class AccountControllerV2 { } } - @Timed @PUT @Path("/phone_number_identity_key_distribution") @Consumes(MediaType.APPLICATION_JSON) @@ -208,7 +205,6 @@ public class AccountControllerV2 { } } - @Timed @PUT @Path("/phone_number_discoverability") @Consumes(MediaType.APPLICATION_JSON) @@ -221,7 +217,6 @@ public class AccountControllerV2 { phoneNumberDiscoverability.discoverableByPhoneNumber())); } - @Timed @GET @Path("/data_report") @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ArtController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ArtController.java index 86f99d079..a9393b5b3 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ArtController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ArtController.java @@ -5,7 +5,6 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.UUID; @@ -40,7 +39,6 @@ public class ArtController { this.rateLimiters = rateLimiters; } - @Timed @GET @Path("/auth") @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java index 3a3177b0f..e15befe4b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV2.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; -import com.codahale.metrics.annotation.Timed; import com.google.common.net.HttpHeaders; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; @@ -48,7 +47,6 @@ public class AttachmentControllerV2 { this.policySigner = new PolicySigner(accessSecret, region); } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/form/upload") diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV3.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV3.java index 8aa3cba69..2d2c03c5c 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV3.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV3.java @@ -5,17 +5,13 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; import java.security.InvalidKeyException; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; import java.util.Base64; -import java.util.Map; import javax.annotation.Nonnull; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -25,9 +21,6 @@ import org.whispersystems.textsecuregcm.attachments.AttachmentGenerator; import org.whispersystems.textsecuregcm.attachments.GcsAttachmentGenerator; import org.whispersystems.textsecuregcm.auth.AuthenticatedAccount; import org.whispersystems.textsecuregcm.entities.AttachmentDescriptorV3; -import org.whispersystems.textsecuregcm.gcp.CanonicalRequest; -import org.whispersystems.textsecuregcm.gcp.CanonicalRequestGenerator; -import org.whispersystems.textsecuregcm.gcp.CanonicalRequestSigner; import org.whispersystems.textsecuregcm.limits.RateLimiter; import org.whispersystems.textsecuregcm.limits.RateLimiters; @@ -51,7 +44,6 @@ public class AttachmentControllerV3 { this.secureRandom = new SecureRandom(); } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/form/upload") diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV4.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV4.java index 06028d146..4ec3f2ca9 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV4.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AttachmentControllerV4.java @@ -5,13 +5,11 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; - import java.security.SecureRandom; import java.util.Base64; import java.util.Map; @@ -20,7 +18,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; - import org.whispersystems.textsecuregcm.attachments.AttachmentGenerator; import org.whispersystems.textsecuregcm.attachments.GcsAttachmentGenerator; import org.whispersystems.textsecuregcm.attachments.TusAttachmentGenerator; @@ -62,7 +59,6 @@ public class AttachmentControllerV4 { ); } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/form/upload") diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CallLinkController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CallLinkController.java index 22bcabb97..0c55bcd05 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CallLinkController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CallLinkController.java @@ -1,9 +1,17 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.ws.rs.BadRequestException; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; import org.signal.libsignal.protocol.ServiceId; import org.signal.libsignal.zkgroup.GenericServerSecretParams; import org.signal.libsignal.zkgroup.InvalidInputException; @@ -12,15 +20,6 @@ import org.whispersystems.textsecuregcm.auth.AuthenticatedAccount; import org.whispersystems.textsecuregcm.entities.CreateCallLinkCredential; import org.whispersystems.textsecuregcm.entities.GetCreateCallLinkCredentialsRequest; import org.whispersystems.textsecuregcm.limits.RateLimiters; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.ws.rs.BadRequestException; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import java.time.Instant; -import java.time.temporal.ChronoUnit; @Path("/v1/call-link") @io.swagger.v3.oas.annotations.tags.Tag(name = "CallLink") @@ -36,7 +35,6 @@ public class CallLinkController { this.genericServerSecretParams = genericServerSecretParams; } - @Timed @POST @Path("/create-auth") @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java index f716fd628..bd849abb8 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static com.codahale.metrics.MetricRegistry.name; -import com.codahale.metrics.annotation.Timed; import com.google.common.annotations.VisibleForTesting; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; @@ -20,7 +19,6 @@ import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import java.util.Objects; -import java.util.UUID; import javax.annotation.Nonnull; import javax.ws.rs.BadRequestException; import javax.ws.rs.DefaultValue; @@ -31,12 +29,11 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - import org.signal.libsignal.protocol.ServiceId; +import org.signal.libsignal.zkgroup.GenericServerSecretParams; import org.signal.libsignal.zkgroup.auth.AuthCredentialWithPniResponse; import org.signal.libsignal.zkgroup.auth.ServerZkAuthOperations; import org.signal.libsignal.zkgroup.calllinks.CallLinkAuthCredentialResponse; -import org.signal.libsignal.zkgroup.GenericServerSecretParams; import org.whispersystems.textsecuregcm.auth.AuthenticatedAccount; import org.whispersystems.textsecuregcm.auth.CertificateGenerator; import org.whispersystems.textsecuregcm.entities.DeliveryCertificate; @@ -68,7 +65,6 @@ public class CertificateController { this.clock = Objects.requireNonNull(clock); } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/delivery") @@ -87,7 +83,6 @@ public class CertificateController { certificateGenerator.createFor(auth.getAccount(), auth.getAuthenticatedDevice(), includeE164)); } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/auth/group") diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ChallengeController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ChallengeController.java index 907b24620..c71933db6 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ChallengeController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ChallengeController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; -import com.codahale.metrics.annotation.Timed; import com.google.common.net.HttpHeaders; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; @@ -20,7 +19,6 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import java.io.IOException; -import java.util.Optional; import javax.validation.Valid; import javax.ws.rs.BadRequestException; import javax.ws.rs.Consumes; @@ -53,7 +51,6 @@ public class ChallengeController { this.rateLimitChallengeManager = rateLimitChallengeManager; } - @Timed @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -110,7 +107,6 @@ public class ChallengeController { return Response.status(200).build(); } - @Timed @POST @Path("/push") @Operation( diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java index d13055040..c907f2783 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java @@ -4,7 +4,6 @@ */ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import com.google.common.annotations.VisibleForTesting; import com.google.common.net.HttpHeaders; import io.dropwizard.auth.Auth; @@ -118,7 +117,6 @@ public class DeviceController { } } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) public DeviceInfoList getDevices(@Auth AuthenticatedAccount auth) { @@ -132,7 +130,6 @@ public class DeviceController { return new DeviceInfoList(devices); } - @Timed @DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{device_id}") @@ -153,7 +150,6 @@ public class DeviceController { deleteKeysFuture.join(); } - @Timed @GET @Path("/provisioning/code") @Produces(MediaType.APPLICATION_JSON) @@ -185,7 +181,6 @@ public class DeviceController { * @deprecated callers should use {@link #linkDevice(BasicAuthorizationHeader, LinkDeviceRequest, ContainerRequest)} * instead */ - @Timed @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -210,7 +205,6 @@ public class DeviceController { return new DeviceResponse(account.getUuid(), account.getPhoneNumberIdentifier(), device.getId()); } - @Timed @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -244,7 +238,6 @@ public class DeviceController { return new DeviceResponse(account.getUuid(), account.getPhoneNumberIdentifier(), device.getId()); } - @Timed @PUT @Produces(MediaType.APPLICATION_JSON) @Path("/unauthenticated_delivery") @@ -253,7 +246,6 @@ public class DeviceController { // Deprecated } - @Timed @PUT @Produces(MediaType.APPLICATION_JSON) @Path("/capabilities") diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DirectoryV2Controller.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DirectoryV2Controller.java index 537e74500..5bd862cda 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DirectoryV2Controller.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DirectoryV2Controller.java @@ -4,7 +4,6 @@ */ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import com.google.common.annotations.VisibleForTesting; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.tags.Tag; @@ -45,7 +44,6 @@ public class DirectoryV2Controller { this.directoryServiceTokenGenerator = userTokenGenerator; } - @Timed @GET @Path("/auth") @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DonationController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DonationController.java index 959bca465..a4282c6e8 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DonationController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DonationController.java @@ -5,7 +5,6 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.tags.Tag; import java.time.Clock; @@ -74,7 +73,6 @@ public class DonationController { this.receiptCredentialPresentationFactory = Objects.requireNonNull(receiptCredentialPresentationFactory); } - @Timed @POST @Path("/redeem-receipt") @Consumes(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeepAliveController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeepAliveController.java index fd5f12ceb..96849ab62 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeepAliveController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeepAliveController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static com.codahale.metrics.MetricRegistry.name; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.Tags; @@ -40,7 +39,6 @@ public class KeepAliveController { this.clientPresenceManager = clientPresenceManager; } - @Timed @GET public Response getKeepAlive(@Auth Optional maybeAuth, @WebSocketSession WebSocketSessionContext context) { @@ -63,7 +61,6 @@ public class KeepAliveController { return Response.ok().build(); } - @Timed @GET @Path("/provisioning") public Response getProvisioningKeepAlive() { diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java index 5f326610d..6206fd059 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java @@ -6,7 +6,6 @@ package org.whispersystems.textsecuregcm.controllers; import static com.codahale.metrics.MetricRegistry.name; -import com.codahale.metrics.annotation.Timed; import com.google.common.net.HttpHeaders; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; @@ -107,7 +106,6 @@ public class KeysController { return new PreKeyCount(ecCountFuture.join(), pqCountFuture.join()); } - @Timed @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @@ -192,7 +190,6 @@ public class KeysController { .join(); } - @Timed @GET @Path("/{identifier}/{device_id}") @Produces(MediaType.APPLICATION_JSON) @@ -277,7 +274,6 @@ public class KeysController { return new PreKeyResponse(identityKey, responseItems); } - @Timed @PUT @Path("/signed") @Consumes(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/PaymentsController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/PaymentsController.java index 7fb9a2b8c..bd9946d1d 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/PaymentsController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/PaymentsController.java @@ -5,7 +5,6 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.GET; @@ -40,7 +39,6 @@ public class PaymentsController { this.paymentsServiceCredentialsGenerator = paymentsServiceCredentialsGenerator; } - @Timed @GET @Path("/auth") @Produces(MediaType.APPLICATION_JSON) @@ -48,7 +46,6 @@ public class PaymentsController { return paymentsServiceCredentialsGenerator.generateForUuid(auth.getAccount().getUuid()); } - @Timed @GET @Path("/conversions") @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java index 0c5b1a334..b4a5ccd8b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProfileController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; -import com.codahale.metrics.annotation.Timed; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import io.dropwizard.auth.Auth; @@ -18,24 +17,18 @@ import io.swagger.v3.oas.annotations.tags.Tag; import io.vavr.Tuple; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; import java.time.Clock; import java.time.Duration; import java.time.Instant; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Arrays; -import java.util.Base64; import java.util.Collection; import java.util.Collections; import java.util.HexFormat; -import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Map.Entry; import java.util.Objects; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -88,7 +81,6 @@ import org.whispersystems.textsecuregcm.entities.BatchIdentityCheckResponse; import org.whispersystems.textsecuregcm.entities.CreateProfileRequest; import org.whispersystems.textsecuregcm.entities.CredentialProfileResponse; import org.whispersystems.textsecuregcm.entities.ExpiringProfileKeyCredentialProfileResponse; -import org.whispersystems.textsecuregcm.entities.ProfileAvatarUploadAttributes; import org.whispersystems.textsecuregcm.entities.UserCapabilities; import org.whispersystems.textsecuregcm.entities.VersionedProfileResponse; import org.whispersystems.textsecuregcm.grpc.ProfileHelper; @@ -105,7 +97,6 @@ import org.whispersystems.textsecuregcm.storage.AccountsManager; import org.whispersystems.textsecuregcm.storage.DynamicConfigurationManager; import org.whispersystems.textsecuregcm.storage.ProfilesManager; import org.whispersystems.textsecuregcm.storage.VersionedProfile; -import org.whispersystems.textsecuregcm.util.Pair; import org.whispersystems.textsecuregcm.util.Util; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; @@ -172,7 +163,6 @@ public class ProfileController { this.batchIdentityCheckExecutor = Preconditions.checkNotNull(batchIdentityCheckExecutor); } - @Timed @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -236,7 +226,6 @@ public class ProfileController { } } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{identifier}/{version}") @@ -257,7 +246,6 @@ public class ProfileController { containerRequestContext); } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{identifier}/{version}/{credentialRequest}") @@ -289,7 +277,6 @@ public class ProfileController { // Although clients should generally be using versioned profiles wherever possible, there are still a few lingering // use cases for getting profiles without a version (e.g. getting a contact's unidentified access key checksum). - @Timed @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{identifier}") @@ -332,7 +319,6 @@ public class ProfileController { }; } - @Timed @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProvisioningController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProvisioningController.java index af0ac58af..e29e89c4e 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProvisioningController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/ProvisioningController.java @@ -5,7 +5,6 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Base64; @@ -37,7 +36,6 @@ public class ProvisioningController { this.provisioningManager = provisioningManager; } - @Timed @Path("/{destination}") @PUT @Consumes(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java index 4d600d02f..7336200bb 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; -import com.codahale.metrics.annotation.Timed; import com.google.common.net.HttpHeaders; import io.micrometer.core.instrument.DistributionSummary; import io.micrometer.core.instrument.Metrics; @@ -34,8 +33,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.whispersystems.textsecuregcm.auth.BasicAuthorizationHeader; import org.whispersystems.textsecuregcm.auth.PhoneVerificationTokenManager; import org.whispersystems.textsecuregcm.auth.RegistrationLockVerificationManager; @@ -57,8 +54,6 @@ import org.whispersystems.textsecuregcm.util.Util; @io.swagger.v3.oas.annotations.tags.Tag(name = "Registration") public class RegistrationController { - private static final Logger logger = LoggerFactory.getLogger(RegistrationController.class); - private static final DistributionSummary REREGISTRATION_IDLE_DAYS_DISTRIBUTION = DistributionSummary .builder(name(RegistrationController.class, "reregistrationIdleDays")) .publishPercentiles(0.75, 0.95, 0.99, 0.999) @@ -90,7 +85,6 @@ public class RegistrationController { this.rateLimiters = rateLimiters; } - @Timed @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java index d6738e631..899b1b57f 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java @@ -5,7 +5,6 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken; import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; import com.google.common.annotations.VisibleForTesting; @@ -76,7 +75,6 @@ public class RemoteConfigController { this.googleIdTokenVerifier = googleIdTokenVerifierBuilder.setAudience(audience).build(); } - @Timed @GET @Produces(MediaType.APPLICATION_JSON) public UserRemoteConfigList getAll(@Auth AuthenticatedAccount auth) { @@ -98,7 +96,6 @@ public class RemoteConfigController { } } - @Timed @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @@ -123,7 +120,6 @@ public class RemoteConfigController { remoteConfigsManager.set(config); } - @Timed @DELETE @Path("/{name}") public void delete(@HeaderParam("Config-Token") String configToken, @PathParam("name") String name) { diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureBackupController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureBackupController.java index 5ada330bb..a285308fc 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureBackupController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureBackupController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static java.util.Objects.requireNonNull; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -69,7 +68,6 @@ public class SecureBackupController { this.accountsManager = requireNonNull(accountsManager); } - @Timed @GET @Path("/auth") @Produces(MediaType.APPLICATION_JSON) @@ -86,7 +84,6 @@ public class SecureBackupController { return credentialsGenerator.generateForUuid(auth.getAccount().getUuid()); } - @Timed @POST @Path("/auth/check") @Consumes(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureStorageController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureStorageController.java index 6f0d75bad..a65f0aeb8 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureStorageController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureStorageController.java @@ -5,7 +5,6 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.tags.Tag; import javax.ws.rs.GET; @@ -34,7 +33,6 @@ public class SecureStorageController { this.storageServiceCredentialsGenerator = storageServiceCredentialsGenerator; } - @Timed @GET @Path("/auth") @Produces(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureValueRecovery2Controller.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureValueRecovery2Controller.java index d17a2e8f4..7e1fb6409 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureValueRecovery2Controller.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SecureValueRecovery2Controller.java @@ -5,7 +5,6 @@ package org.whispersystems.textsecuregcm.controllers; -import com.codahale.metrics.annotation.Timed; import io.dropwizard.auth.Auth; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -66,7 +65,6 @@ public class SecureValueRecovery2Controller { this.accountsManager = accountsManager; } - @Timed @GET @Path("/auth") @Produces(MediaType.APPLICATION_JSON) @@ -84,7 +82,6 @@ public class SecureValueRecovery2Controller { } - @Timed @POST @Path("/auth/check") @Consumes(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java index 343d45058..0e3488c44 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/SubscriptionController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; -import com.codahale.metrics.annotation.Timed; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -220,7 +219,6 @@ public class SubscriptionController { return new GetSubscriptionConfigurationResponse(currencyConfiguration, levels); } - @Timed @DELETE @Path("/{subscriberId}") @Produces(MediaType.APPLICATION_JSON) @@ -242,7 +240,6 @@ public class SubscriptionController { .thenApply(unused -> Response.ok().build()); } - @Timed @PUT @Path("/{subscriberId}") @Consumes(MediaType.APPLICATION_JSON) @@ -277,7 +274,6 @@ public class SubscriptionController { } - @Timed @POST @Path("/{subscriberId}/create_payment_method") @Consumes(MediaType.APPLICATION_JSON) @@ -332,7 +328,6 @@ public class SubscriptionController { } - @Timed @POST @Path("/{subscriberId}/create_payment_method/paypal") @Consumes(MediaType.APPLICATION_JSON) @@ -396,7 +391,6 @@ public class SubscriptionController { }; } - @Timed @POST @Path("/{subscriberId}/default_payment_method/{paymentMethodId}") @Consumes(MediaType.APPLICATION_JSON) @@ -414,7 +408,6 @@ public class SubscriptionController { .thenApply(customer -> Response.ok().build()); } - @Timed @POST @Path("/{subscriberId}/default_payment_method/{processor}/{paymentMethodToken}") @Consumes(MediaType.APPLICATION_JSON) @@ -497,7 +490,6 @@ public class SubscriptionController { } } - @Timed @PUT @Path("/{subscriberId}/level/{level}/{currency}/{idempotencyKey}") @Consumes(MediaType.APPLICATION_JSON) @@ -655,7 +647,6 @@ public class SubscriptionController { } - @Timed @GET @Path("/configuration") @Produces(MediaType.APPLICATION_JSON) @@ -666,7 +657,6 @@ public class SubscriptionController { }); } - @Timed @GET @Path("/levels") @Produces(MediaType.APPLICATION_JSON) @@ -714,7 +704,6 @@ public class SubscriptionController { } } - @Timed @GET @Path("/boost/badges") @Produces(MediaType.APPLICATION_JSON) @@ -737,7 +726,6 @@ public class SubscriptionController { }); } - @Timed @GET @Path("/boost/amounts") @Produces(MediaType.APPLICATION_JSON) @@ -749,7 +737,6 @@ public class SubscriptionController { .build()); } - @Timed @GET @Path("/boost/amounts/gift") @Produces(MediaType.APPLICATION_JSON) @@ -801,7 +788,6 @@ public class SubscriptionController { /** * Creates a Stripe PaymentIntent with the requested amount and currency */ - @Timed @POST @Path("/boost/create") @Consumes(MediaType.APPLICATION_JSON) @@ -855,7 +841,6 @@ public class SubscriptionController { } } - @Timed @POST @Path("/boost/paypal/create") @Consumes(MediaType.APPLICATION_JSON) @@ -898,7 +883,6 @@ public class SubscriptionController { } - @Timed @POST @Path("/boost/paypal/confirm") @Consumes(MediaType.APPLICATION_JSON) @@ -945,7 +929,6 @@ public class SubscriptionController { } } - @Timed @POST @Path("/boost/receipt_credentials") @Consumes(MediaType.APPLICATION_JSON) @@ -1158,7 +1141,6 @@ public class SubscriptionController { } } - @Timed @GET @Path("/{subscriberId}") @Produces(MediaType.APPLICATION_JSON) @@ -1236,7 +1218,6 @@ public class SubscriptionController { } } - @Timed @POST @Path("/{subscriberId}/receipt_credentials") @Consumes(MediaType.APPLICATION_JSON) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/VerificationController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/VerificationController.java index fb9572075..8b1771695 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/VerificationController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/VerificationController.java @@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers; import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name; -import com.codahale.metrics.annotation.Timed; import com.google.i18n.phonenumbers.NumberParseException; import com.google.i18n.phonenumbers.PhoneNumberUtil; import com.google.i18n.phonenumbers.Phonenumber; @@ -78,8 +77,8 @@ import org.whispersystems.textsecuregcm.registration.TransportNotAllowedExceptio import org.whispersystems.textsecuregcm.registration.VerificationSession; import org.whispersystems.textsecuregcm.spam.Extract; import org.whispersystems.textsecuregcm.spam.FilterSpam; -import org.whispersystems.textsecuregcm.storage.AccountsManager; import org.whispersystems.textsecuregcm.spam.ScoreThreshold; +import org.whispersystems.textsecuregcm.storage.AccountsManager; import org.whispersystems.textsecuregcm.storage.RegistrationRecoveryPasswordsManager; import org.whispersystems.textsecuregcm.storage.VerificationSessionManager; import org.whispersystems.textsecuregcm.util.ExceptionUtils; @@ -137,7 +136,6 @@ public class VerificationController { this.clock = clock; } - @Timed @POST @Path("/session") @Consumes(MediaType.APPLICATION_JSON) @@ -188,7 +186,6 @@ public class VerificationController { return buildResponse(registrationServiceSession, verificationSession); } - @Timed @FilterSpam @PATCH @Path("/session/{sessionId}") @@ -411,7 +408,6 @@ public class VerificationController { return verificationSession; } - @Timed @GET @Path("/session/{sessionId}") @Produces(MediaType.APPLICATION_JSON) @@ -423,7 +419,6 @@ public class VerificationController { return buildResponse(registrationServiceSession, verificationSession); } - @Timed @POST @Path("/session/{sessionId}/code") @Consumes(MediaType.APPLICATION_JSON) @@ -518,7 +513,6 @@ public class VerificationController { return buildResponse(resultSession, verificationSession); } - @Timed @PUT @Path("/session/{sessionId}/code") @Consumes(MediaType.APPLICATION_JSON)