mirror of
				https://github.com/mozilla/gecko-dev.git
				synced 2025-10-31 08:18:54 +02:00 
			
		
		
		
	Bug 1960567 - Migrate histograms to use Glean APIs in toolkit/components/reputationservice/, r=chutten.
Differential Revision: https://phabricator.services.mozilla.com/D255545
This commit is contained in:
		
							parent
							
								
									88cd22ecaf
								
							
						
					
					
						commit
						b3c6b1d068
					
				
					 4 changed files with 43 additions and 14 deletions
				
			
		|  | @ -1882,8 +1882,9 @@ nsresult PendingLookup::OnStopRequestInternal(nsIRequest* aRequest, | |||
|   mozilla::glean::application_reputation::server_verdict.AccumulateSingleSample( | ||||
|       std::min<uint32_t>(response.verdict(), 7)); | ||||
|   const char* ext = GetFileExt(mFileName); | ||||
|   AccumulateCategoricalKeyed(nsCString(ext), VerdictToLabel(std::min<uint32_t>( | ||||
|                                                  response.verdict(), 7))); | ||||
|   mozilla::glean::application_reputation::server_verdict_2.Get( | ||||
|       nsCString(ext), | ||||
|       VerdictToLabel(std::min<uint32_t>(response.verdict(), 7))); | ||||
|   switch (response.verdict()) { | ||||
|     case safe_browsing::ClientDownloadResponse::DANGEROUS: | ||||
|       aVerdict = nsIApplicationReputationService::VERDICT_DANGEROUS; | ||||
|  |  | |||
|  | @ -7,8 +7,6 @@ | |||
| #include "chrome/common/safe_browsing/csd.pb.h" | ||||
| 
 | ||||
| using ServerLabel = mozilla::glean::application_reputation::Server2Label; | ||||
| using ServerVerdictLabel = | ||||
|     mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_VERDICT_2; | ||||
| 
 | ||||
| struct NSErrorTelemetryResult { | ||||
|   nsresult mValue; | ||||
|  | @ -174,20 +172,19 @@ ServerLabel HTTPStatusToLabel(uint32_t aStatus) { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_VERDICT_2 | ||||
| VerdictToLabel(uint32_t aVerdict) { | ||||
| nsLiteralCString VerdictToLabel(uint32_t aVerdict) { | ||||
|   switch (aVerdict) { | ||||
|     case safe_browsing::ClientDownloadResponse::DANGEROUS: | ||||
|       return ServerVerdictLabel::Dangerous; | ||||
|       return "Dangerous"_ns; | ||||
|     case safe_browsing::ClientDownloadResponse::DANGEROUS_HOST: | ||||
|       return ServerVerdictLabel::DangerousHost; | ||||
|       return "DangerousHost"_ns; | ||||
|     case safe_browsing::ClientDownloadResponse::POTENTIALLY_UNWANTED: | ||||
|       return ServerVerdictLabel::PotentiallyUnwanted; | ||||
|       return "PotentiallyUnwanted"_ns; | ||||
|     case safe_browsing::ClientDownloadResponse::UNCOMMON: | ||||
|       return ServerVerdictLabel::Uncommon; | ||||
|       return "Uncommon"_ns; | ||||
|     case safe_browsing::ClientDownloadResponse::UNKNOWN: | ||||
|       return ServerVerdictLabel::Unknown; | ||||
|       return "Unknown"_ns; | ||||
|     default: | ||||
|       return ServerVerdictLabel::Safe; | ||||
|       return "Safe"_ns; | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -40,7 +40,6 @@ mozilla::glean::application_reputation::Server2Label HTTPStatusToLabel( | |||
| /**
 | ||||
|  * Convert verdict type to telemetry labels | ||||
|  */ | ||||
| mozilla::Telemetry::LABELS_APPLICATION_REPUTATION_SERVER_VERDICT_2 | ||||
| VerdictToLabel(uint32_t aVerdict); | ||||
| nsLiteralCString VerdictToLabel(uint32_t aVerdict); | ||||
| 
 | ||||
| #endif  // ApplicationReputationTelemetryUtils_h__
 | ||||
|  |  | |||
|  | @ -199,6 +199,38 @@ application_reputation: | |||
|     expires: never | ||||
|     telemetry_mirror: APPLICATION_REPUTATION_SERVER_VERDICT | ||||
| 
 | ||||
|   server_verdict_2: | ||||
|     type: dual_labeled_counter | ||||
|     description: > | ||||
|       Application reputation remote verdict, keyed by file extension | ||||
| 
 | ||||
|       This metric was generated to correspond to the Legacy Telemetry | ||||
|       categorical histogram APPLICATION_REPUTATION_SERVER_VERDICT_2. | ||||
|     dual_labels: | ||||
|       key: | ||||
|         description: File extension. | ||||
|       category: | ||||
|         labels: | ||||
|           - Safe | ||||
|           - Dangerous | ||||
|           - Uncommon | ||||
|           - PotentiallyUnwanted | ||||
|           - DangerousHost | ||||
|           - Unknown | ||||
|         description: Labels of the keyed categorical legacy telemetry histogram | ||||
|           APPLICATION_REPUTATION_SERVER_VERDICT_2. | ||||
|     bugs: | ||||
|       - https://bugzilla.mozilla.org/show_bug.cgi?id=1501974 | ||||
|       - https://bugzilla.mozilla.org/show_bug.cgi?id=1589042 | ||||
|     data_reviews: | ||||
|       - https://bugzilla.mozilla.org/show_bug.cgi?id=1501974 | ||||
|       - https://bugzilla.mozilla.org/show_bug.cgi?id=1589042 | ||||
|     notification_emails: | ||||
|       - dlee@mozilla.com | ||||
|       - safebrowsing-telemetry@mozilla.org | ||||
|     expires: never | ||||
|     telemetry_mirror: APPLICATION_REPUTATION_SERVER_VERDICT_2 | ||||
| 
 | ||||
|   remote_lookup_response_time: | ||||
|     type: timing_distribution | ||||
|     description: > | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Florian Quèze
						Florian Quèze