Skip to content

Commit d307f57

Browse files
committed
More changes
1 parent 45f6252 commit d307f57

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

firebase-perf/src/main/java/com/google/firebase/perf/session/PerfSession.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public String sessionId() {
7070

7171
/** Returns the AQS sessionId for the given session. */
7272
public String aqsSessionId() {
73+
// This is a fallback for if/when the AQS ID is undefined.
74+
if (aqsSessionId.equals(Constants.UNDEFINED_AQS_ID)) {
75+
// TODO(b/394127311): Explore returning a valid - but different ID.
76+
return Constants.UNDEFINED_AQS_ID;
77+
}
7378
return aqsSessionId;
7479
}
7580

firebase-perf/src/main/java/com/google/firebase/perf/session/gauges/GaugeManager.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ public void updateGaugeCollection(ApplicationProcessState applicationProcessStat
111111
gaugeManagerDataCollectionJob.cancel(false);
112112
}
113113

114-
if (session == null
115-
|| !session.isGaugeAndEventCollectionEnabled()
116-
|| session.aqsSessionId().equals(Constants.UNDEFINED_AQS_ID)) {
114+
if (shouldStopCollectingGauges()) {
117115
logger.warn("Not starting gauge collection.");
118116
stopCollectingGauges();
119117
return;
@@ -433,6 +431,12 @@ private long getMemoryGaugeCollectionFrequencyMs(
433431
}
434432
}
435433

434+
private boolean shouldStopCollectingGauges() {
435+
return session == null
436+
|| !session.isGaugeAndEventCollectionEnabled()
437+
|| session.aqsSessionId().equals(Constants.UNDEFINED_AQS_ID);
438+
}
439+
436440
@VisibleForTesting
437441
void setApplicationProcessState(ApplicationProcessState applicationProcessState) {
438442
this.applicationProcessState = applicationProcessState;

0 commit comments

Comments
 (0)