@@ -1177,8 +1177,6 @@ - (void)_handleSubscriptionEstablished
1177
1177
{
1178
1178
os_unfair_lock_lock(&self->_lock);
1179
1179
1180
- MATTER_LOG_METRIC_END(kMetricMTRDeviceSubscriptionSetup, CHIP_NO_ERROR);
1181
-
1182
1180
// We have completed the subscription work - remove from the subscription pool.
1183
1181
[self _clearSubscriptionPoolWork];
1184
1182
@@ -1187,6 +1185,7 @@ - (void)_handleSubscriptionEstablished
1187
1185
if (HadSubscriptionEstablishedOnce(_internalDeviceState)) {
1188
1186
[self _changeInternalState:MTRInternalDeviceStateLaterSubscriptionEstablished];
1189
1187
} else {
1188
+ MATTER_LOG_METRIC_END(kMetricMTRDeviceInitialSubscriptionSetup, CHIP_NO_ERROR);
1190
1189
[self _changeInternalState:MTRInternalDeviceStateInitialSubscriptionEstablished];
1191
1190
}
1192
1191
@@ -1227,8 +1226,6 @@ - (void)_handleSubscriptionError:(NSError *)error
1227
1226
{
1228
1227
std::lock_guard lock(_lock);
1229
1228
1230
- MATTER_LOG_METRIC_END(kMetricMTRDeviceSubscriptionSetup, [MTRError errorToCHIPErrorCode:error]);
1231
-
1232
1229
[self _changeInternalState:MTRInternalDeviceStateUnsubscribed];
1233
1230
_unreportedEvents = nil;
1234
1231
@@ -2345,7 +2342,9 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason
2345
2342
});
2346
2343
}
2347
2344
2348
- MATTER_LOG_METRIC_BEGIN(kMetricMTRDeviceSubscriptionSetup);
2345
+ // This marks begin of initial subscription to the device (before CASE is established). The end is only marked after successfully setting
2346
+ // up the subscription since it is always retried as long as the MTRDevice is kept running.
2347
+ MATTER_LOG_METRIC_BEGIN(kMetricMTRDeviceInitialSubscriptionSetup);
2349
2348
2350
2349
// Call directlyGetSessionForNode because the subscription setup already goes through the subscription pool queue
2351
2350
[_deviceController
0 commit comments