Skip to content

Commit

Permalink
Addressed code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anush-apple committed Jun 17, 2024
1 parent 69e63dd commit 0627386
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,6 @@ - (void)_handleSubscriptionEstablished
{
os_unfair_lock_lock(&self->_lock);

MATTER_LOG_METRIC_END(kMetricMTRDeviceSubscriptionSetup, CHIP_NO_ERROR);

// We have completed the subscription work - remove from the subscription pool.
[self _clearSubscriptionPoolWork];

Expand All @@ -1187,6 +1185,7 @@ - (void)_handleSubscriptionEstablished
if (HadSubscriptionEstablishedOnce(_internalDeviceState)) {
[self _changeInternalState:MTRInternalDeviceStateLaterSubscriptionEstablished];
} else {
MATTER_LOG_METRIC_END(kMetricMTRDeviceInitialSubscriptionSetup, CHIP_NO_ERROR);
[self _changeInternalState:MTRInternalDeviceStateInitialSubscriptionEstablished];
}

Expand Down Expand Up @@ -1227,8 +1226,6 @@ - (void)_handleSubscriptionError:(NSError *)error
{
std::lock_guard lock(_lock);

MATTER_LOG_METRIC_END(kMetricMTRDeviceSubscriptionSetup, [MTRError errorToCHIPErrorCode:error]);

[self _changeInternalState:MTRInternalDeviceStateUnsubscribed];
_unreportedEvents = nil;

Expand Down Expand Up @@ -2345,7 +2342,9 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason
});
}

MATTER_LOG_METRIC_BEGIN(kMetricMTRDeviceSubscriptionSetup);
// This marks begin of initial subscription to the device (before CASE is established). The end is only marked after successfully setting
// up the subscription since it is always retried as long as the MTRDevice is kept running.
MATTER_LOG_METRIC_BEGIN(kMetricMTRDeviceInitialSubscriptionSetup);

// Call directlyGetSessionForNode because the subscription setup already goes through the subscription pool queue
[_deviceController
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRMetricKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ constexpr Tracing::MetricKey kMetricBLEDevicesRemoved = "dwnfw_ble_devices_remov
// Unexpected C quality attribute update outside of priming
constexpr Tracing::MetricKey kMetricUnexpectedCQualityUpdate = "dwnpm_bad_c_attr_update";

// Subscription setup from darwin MTRDevice
constexpr Tracing::MetricKey kMetricMTRDeviceSubscriptionSetup = "dwnpm_dev_subscription_setup";
// Setup from darwin MTRDevice for initial subscrption to a device
constexpr Tracing::MetricKey kMetricMTRDeviceInitialSubscriptionSetup = "dwnpm_dev_initial_subscription_setup";

} // namespace DarwinFramework
} // namespace Tracing
Expand Down

0 comments on commit 0627386

Please sign in to comment.