Add an "urgent" dimension to the "sent messages" counter

This commit is contained in:
Jon Chambers 2022-08-10 10:34:48 -04:00 committed by Jon Chambers
parent 65da844d70
commit 2bfe2c8ff8
1 changed files with 7 additions and 8 deletions

View File

@ -8,8 +8,6 @@ import static com.codahale.metrics.MetricRegistry.name;
import static org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope; import static org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag;
import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.whispersystems.textsecuregcm.metrics.PushLatencyManager; import org.whispersystems.textsecuregcm.metrics.PushLatencyManager;
import org.whispersystems.textsecuregcm.redis.RedisOperation; import org.whispersystems.textsecuregcm.redis.RedisOperation;
@ -41,6 +39,7 @@ public class MessageSender {
private static final String CHANNEL_TAG_NAME = "channel"; private static final String CHANNEL_TAG_NAME = "channel";
private static final String EPHEMERAL_TAG_NAME = "ephemeral"; private static final String EPHEMERAL_TAG_NAME = "ephemeral";
private static final String CLIENT_ONLINE_TAG_NAME = "clientOnline"; private static final String CLIENT_ONLINE_TAG_NAME = "clientOnline";
private static final String URGENT_TAG_NAME = "urgent";
public MessageSender(ClientPresenceManager clientPresenceManager, public MessageSender(ClientPresenceManager clientPresenceManager,
MessagesManager messagesManager, MessagesManager messagesManager,
@ -97,11 +96,11 @@ public class MessageSender {
} }
} }
final List<Tag> tags = List.of( Metrics.counter(SEND_COUNTER_NAME,
Tag.of(CHANNEL_TAG_NAME, channel), CHANNEL_TAG_NAME, channel,
Tag.of(EPHEMERAL_TAG_NAME, String.valueOf(online)), EPHEMERAL_TAG_NAME, String.valueOf(online),
Tag.of(CLIENT_ONLINE_TAG_NAME, String.valueOf(clientPresent))); CLIENT_ONLINE_TAG_NAME, String.valueOf(clientPresent),
URGENT_TAG_NAME, String.valueOf(message.getUrgent()))
Metrics.counter(SEND_COUNTER_NAME, tags).increment(); .increment();
} }
} }