Skip to content

Commit

Permalink
Include message priority when logging to Firelog. (#6227)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsakakihara authored Sep 10, 2024
1 parent 829dab3 commit 8ad9ef5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion firebase-messaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Unreleased

* [changed] Included message priority when logging to Firelog.

# 24.0.1
* [changed] Retry Topic Subscribe/Unsubscribe operations with exponential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,8 @@ static MessagingClientEvent eventToProto(MessagingClientEvent.Event event, Inten
.setInstanceId(getInstanceId(extras))
.setPackageName(getPackageName())
.setSdkPlatform(MessagingClientEvent.SDKPlatform.ANDROID)
.setMessageType(getMessageTypeForFirelog(extras));
.setMessageType(getMessageTypeForFirelog(extras))
.setPriority(getMessagePriorityForFirelog(extras));

// nullable parameters
String messageId = getMessageId(extras);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ public class MessagingAnalyticsRoboTest {
// Copy from FirebaseMessagingService so the tests break if the constants are changed
// TODO(dgiorgini) instead of copy&paste create a test to verify the original constants
static final String ANALYTICS_PREFIX = "google.c.a.";
static final String ANALYTICS_ENABLED = ANALYTICS_PREFIX + "e";
static final String ANALYTICS_COMPOSER_ID = ANALYTICS_PREFIX + "c_id";
static final String ANALYTICS_COMPOSER_LABEL = ANALYTICS_PREFIX + "c_l";
static final String ANALYTICS_MESSAGE_TIMESTAMP = ANALYTICS_PREFIX + "ts";
static final String ANALYTICS_MESSAGE_USE_DEVICE_TIME = ANALYTICS_PREFIX + "udt";
static final String ANALYTICS_TRACK_CONVERSIONS = ANALYTICS_PREFIX + "tc";
static final String ANALYTICS_ABT_EXPERIMENT = ANALYTICS_PREFIX + "abt";
static final String ANALYTICS_MESSAGE_LABEL = ANALYTICS_PREFIX + "m_l";

// Copy from MessagingAnalytics so the tests break if the constants are changed
Expand Down Expand Up @@ -997,7 +994,7 @@ public void testEventToProto_fullSampleTopicMessage() {
b.putString(MessagePayloadKeys.FROM, "/topics/my cool topic");
b.putString(MessageNotificationKeys.ENABLE_NOTIFICATION, "1");
b.putString(MessagePayloadKeys.MSGID, "an id!!!");
b.putString(MessagePayloadKeys.DELIVERED_PRIORITY, "high");
b.putString(MessagePayloadKeys.DELIVERED_PRIORITY, "normal");
b.putString(MessagePayloadKeys.SENDER_ID, "100101010");
b.putString(AnalyticsKeys.COMPOSER_LABEL, "composer label!");
b.putString(AnalyticsKeys.MESSAGE_LABEL, "message label!");
Expand All @@ -1016,6 +1013,7 @@ public void testEventToProto_fullSampleTopicMessage() {
assertThat(ev.getInstanceId()).isEqualTo("some_installation_id");
assertThat(ev.getEvent()).isEqualTo(MessagingClientEvent.Event.MESSAGE_DELIVERED);
assertThat(ev.getTtl()).isEqualTo(22223L);
assertThat(ev.getPriority()).isEqualTo(5);
assertThat(ev.getTopic()).isEqualTo("/topics/my cool topic");
assertThat(ev.getAnalyticsLabel()).isEqualTo("message label!");
assertThat(ev.getComposerLabel()).isEqualTo("composer label!");
Expand Down Expand Up @@ -1049,6 +1047,7 @@ public void testEventToProto_fullSampleDirectedMessage() {
assertThat(ev.getInstanceId()).isEqualTo("some_installation_id");
assertThat(ev.getEvent()).isEqualTo(MessagingClientEvent.Event.MESSAGE_DELIVERED);
assertThat(ev.getTtl()).isEqualTo(22223L);
assertThat(ev.getPriority()).isEqualTo(10);
assertThat(ev.getTopic()).isEmpty();
assertThat(ev.getAnalyticsLabel()).isEqualTo("message label!");
assertThat(ev.getComposerLabel()).isEqualTo("composer label!");
Expand Down

0 comments on commit 8ad9ef5

Please sign in to comment.