Skip to content

Commit

Permalink
[Metrics] Fixed incorrect key values for metrics in darwin (project-c…
Browse files Browse the repository at this point in the history
…hip#34271)

open pairing window metrics was not capturing the metric inside the block
  • Loading branch information
anush-apple authored and j-ororke committed Jul 18, 2024
1 parent 576dd4f commit 2064c3e
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 @@ -1113,7 +1113,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 @@ -1885,10 +1885,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 2064c3e

Please sign in to comment.