|
35 | 35 | #import "MTRError_Internal.h"
|
36 | 36 | #import "MTREventTLVValueDecoder_Internal.h"
|
37 | 37 | #import "MTRLogging_Internal.h"
|
| 38 | +#import "MTRMetricKeys.h" |
| 39 | +#import "MTRMetricsCollector.h" |
38 | 40 | #import "MTRTimeUtils.h"
|
39 | 41 | #import "MTRUnfairLock.h"
|
40 | 42 | #import "zap-generated/MTRCommandPayloads_Internal.h"
|
@@ -1886,9 +1888,16 @@ - (void)_setCachedAttributeValue:(MTRDeviceDataValueDictionary _Nullable)value f
|
1886 | 1888 | && isFromSubscription
|
1887 | 1889 | && !_receivingPrimingReport
|
1888 | 1890 | && AttributeHasChangesOmittedQuality(path)) {
|
1889 |
| - // Do not persist new values for Changes Omitted Quality attributes unless |
1890 |
| - // they're part of a Priming Report or from a read response. |
| 1891 | + // Do not persist new values for Changes Omitted Quality (aka C Quality) |
| 1892 | + // attributes unless they're part of a Priming Report or from a read response. |
1891 | 1893 | // (removals are OK)
|
| 1894 | + |
| 1895 | + // log when a device violates expectations for Changes Omitted Quality attributes. |
| 1896 | + using namespace chip::Tracing::DarwinFramework; |
| 1897 | + MATTER_LOG_METRIC_BEGIN(kMetricUnexpectedCQualityUpdate); |
| 1898 | + [self _addInformationalAttributesToCurrentMetricScope]; |
| 1899 | + MATTER_LOG_METRIC_END(kMetricUnexpectedCQualityUpdate); |
| 1900 | + |
1892 | 1901 | return;
|
1893 | 1902 | }
|
1894 | 1903 |
|
@@ -3642,6 +3651,48 @@ - (void)removeClientDataForKey:(NSString *)key endpointID:(NSNumber *)endpointID
|
3642 | 3651 | [self.temporaryMetaDataCache removeObjectForKey:[NSString stringWithFormat:@"%@:%@", key, endpointID]];
|
3643 | 3652 | }
|
3644 | 3653 |
|
| 3654 | +#pragma mark Log Help |
| 3655 | + |
| 3656 | +- (nullable NSNumber *)_informationalNumberAtAttributePath:(MTRAttributePath *)attributePath |
| 3657 | +{ |
| 3658 | + auto * cachedData = [self _cachedAttributeValueForPath:attributePath]; |
| 3659 | + |
| 3660 | + auto * attrReport = [[MTRAttributeReport alloc] initWithResponseValue:@{ |
| 3661 | + MTRAttributePathKey : attributePath, |
| 3662 | + MTRDataKey : cachedData, |
| 3663 | + } |
| 3664 | + error:nil]; |
| 3665 | + |
| 3666 | + return attrReport.value; |
| 3667 | +} |
| 3668 | + |
| 3669 | +- (nullable NSNumber *)_informationalVendorID |
| 3670 | +{ |
| 3671 | + auto * vendorIDPath = [MTRAttributePath attributePathWithEndpointID:@(kRootEndpointId) |
| 3672 | + clusterID:@(MTRClusterIDTypeBasicInformationID) |
| 3673 | + attributeID:@(MTRClusterBasicAttributeVendorIDID)]; |
| 3674 | + |
| 3675 | + return [self _informationalNumberAtAttributePath:vendorIDPath]; |
| 3676 | +} |
| 3677 | + |
| 3678 | +- (nullable NSNumber *)_informationalProductID |
| 3679 | +{ |
| 3680 | + auto * productIDPath = [MTRAttributePath attributePathWithEndpointID:@(kRootEndpointId) |
| 3681 | + clusterID:@(MTRClusterIDTypeBasicInformationID) |
| 3682 | + attributeID:@(MTRClusterBasicAttributeProductIDID)]; |
| 3683 | + |
| 3684 | + return [self _informationalNumberAtAttributePath:productIDPath]; |
| 3685 | +} |
| 3686 | + |
| 3687 | +- (void)_addInformationalAttributesToCurrentMetricScope |
| 3688 | +{ |
| 3689 | + using namespace chip::Tracing::DarwinFramework; |
| 3690 | + MATTER_LOG_METRIC(kMetricDeviceVendorID, [self _informationalVendorID].unsignedShortValue); |
| 3691 | + MATTER_LOG_METRIC(kMetricDeviceProductID, [self _informationalProductID].unsignedShortValue); |
| 3692 | + BOOL usesThread = [self _deviceUsesThread]; |
| 3693 | + MATTER_LOG_METRIC(kMetricDeviceUsesThread, usesThread); |
| 3694 | +} |
| 3695 | + |
3645 | 3696 | @end
|
3646 | 3697 |
|
3647 | 3698 | /* BEGIN DRAGONS: Note methods here cannot be renamed, and are used by private callers, do not rename, remove or modify behavior here */
|
|
0 commit comments