Skip to content

Commit

Permalink
[Metrics] Fixed incorrect key values for metrics in darwin
Browse files Browse the repository at this point in the history
open pairing window metrics was not capturing the metric inside the block
  • Loading branch information
anush-apple committed Jul 10, 2024
1 parent 0104797 commit 1abefea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ - (NSData * _Nullable)attestationChallengeForDeviceID:(NSNumber *)deviceID
chip::CommissioneeDeviceProxy * deviceProxy;

auto errorCode = CHIP_NO_ERROR;
MATTER_LOG_METRIC_SCOPE(kMetricPASEVerifierForSetupCode, errorCode);
MATTER_LOG_METRIC_SCOPE(kMetricAttestationChallengeForDevice, errorCode);

errorCode = self->_cppCommissioner->GetDeviceBeingCommissioned([deviceID unsignedLongLongValue], &deviceProxy);
VerifyOrReturnValue(![MTRDeviceController checkForError:errorCode logMsg:kErrorGetCommissionee error:nil], nil);
Expand Down Expand Up @@ -1876,10 +1876,10 @@ - (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error
return NO;
}

__block CHIP_ERROR errorCode = CHIP_NO_ERROR;
MATTER_LOG_METRIC_SCOPE(kMetricOpenPairingWindow, errorCode);

auto block = ^BOOL {
CHIP_ERROR errorCode = CHIP_NO_ERROR;
MATTER_LOG_METRIC_SCOPE(kMetricOpenPairingWindow, errorCode);

errorCode = chip::Controller::AutoCommissioningWindowOpener::OpenBasicCommissioningWindow(
self->_cppCommissioner, deviceID, chip::System::Clock::Seconds16(static_cast<uint16_t>(duration)));
return ![MTRDeviceController checkForError:errorCode logMsg:kErrorOpenPairingWindow error:error];
Expand Down
5 changes: 4 additions & 1 deletion src/darwin/Framework/CHIP/MTRMetricKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ constexpr Tracing::MetricKey kMetricDeviceBeingCommissioned = "dwnfw_dev_being_c
// Tracks the request to generate PASE verifier for a given setup code
constexpr Tracing::MetricKey kMetricPASEVerifierForSetupCode = "dwnfw_pase_verifier_for_code";

// Tracks the request to get attestation challenge for a device
constexpr Tracing::MetricKey kMetricAttestationChallengeForDevice = "dwnfw_attestation_challenge_for_device";

// Marks the request to open pairing window
constexpr Tracing::MetricKey kMetricOpenPairingWindow = "dwnfw_pase_verifier_for_code";
constexpr Tracing::MetricKey kMetricOpenPairingWindow = "dwnfw_open_pairing_window";

// Device Vendor ID
constexpr Tracing::MetricKey kMetricDeviceVendorID = "dwnfw_device_vendor_id";
Expand Down

0 comments on commit 1abefea

Please sign in to comment.