mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-19 20:28:05 +01:00
Introduce a distinct UA for server-generated messages
This commit is contained in:
committed by
Jon Chambers
parent
c03d63acb8
commit
6013d00654
@@ -8,6 +8,8 @@ package org.whispersystems.textsecuregcm.metrics;
|
||||
import io.micrometer.core.instrument.Tag;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import org.whispersystems.textsecuregcm.WhisperServerVersion;
|
||||
import org.whispersystems.textsecuregcm.storage.ClientReleaseManager;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UnrecognizedUserAgentException;
|
||||
import org.whispersystems.textsecuregcm.util.ua.UserAgent;
|
||||
@@ -23,11 +25,18 @@ public class UserAgentTagUtil {
|
||||
public static final String VERSION_TAG = "clientVersion";
|
||||
public static final String LIBSIGNAL_TAG = "libsignal";
|
||||
|
||||
public static final String SERVER_UA =
|
||||
String.format("Signal-Server/%s (%s)", WhisperServerVersion.getServerVersion(), UUID.randomUUID());
|
||||
|
||||
private UserAgentTagUtil() {
|
||||
}
|
||||
|
||||
public static Tag getPlatformTag(final String userAgentString) {
|
||||
|
||||
if (SERVER_UA.equals(userAgentString)) {
|
||||
return Tag.of(PLATFORM_TAG, "server");
|
||||
}
|
||||
|
||||
UserAgent userAgent = null;
|
||||
|
||||
try {
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
|
||||
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
|
||||
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
|
||||
import org.whispersystems.textsecuregcm.storage.AccountsManager;
|
||||
import org.whispersystems.textsecuregcm.storage.Device;
|
||||
|
||||
@@ -68,7 +69,8 @@ public class ReceiptSender {
|
||||
messageSender.sendMessages(destinationAccount,
|
||||
destinationIdentifier,
|
||||
messagesByDeviceId,
|
||||
registrationIdsByDeviceId, null);
|
||||
registrationIdsByDeviceId,
|
||||
UserAgentTagUtil.SERVER_UA);
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Could not send delivery receipt", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user