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 netwerk/protocol/http/, r=chutten,necko-reviewers,jesup.
Differential Revision: https://phabricator.services.mozilla.com/D255547
This commit is contained in:
		
							parent
							
								
									27165f1e2c
								
							
						
					
					
						commit
						00313a80b6
					
				
					 4 changed files with 205 additions and 39 deletions
				
			
		|  | @ -1790,6 +1790,36 @@ networking: | ||||||
|     description: > |     description: > | ||||||
|       Upgrading display content Channel Disposition (key: disabled_wont) |       Upgrading display content Channel Disposition (key: disabled_wont) | ||||||
| 
 | 
 | ||||||
|  |   http_channel_disposition_upgrade: | ||||||
|  |     type: dual_labeled_counter | ||||||
|  |     description: > | ||||||
|  |       Upgrading display content Channel Disposition | ||||||
|  | 
 | ||||||
|  |       This metric was generated to correspond to the Legacy Telemetry | ||||||
|  |       categorical histogram HTTP_CHANNEL_DISPOSITION_UPGRADE. | ||||||
|  |     dual_labels: | ||||||
|  |       key: | ||||||
|  |         description: No static keys unfortunately. | ||||||
|  |       category: | ||||||
|  |         labels: | ||||||
|  |           - cancel | ||||||
|  |           - disk | ||||||
|  |           - netOk | ||||||
|  |           - netEarlyFail | ||||||
|  |           - netLateFail | ||||||
|  |         description: Labels of the keyed categorical legacy telemetry histogram | ||||||
|  |           HTTP_CHANNEL_DISPOSITION_UPGRADE. | ||||||
|  |     bugs: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1440701 | ||||||
|  |     data_reviews: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1440701 | ||||||
|  |     notification_emails: | ||||||
|  |       - necko@mozilla.com | ||||||
|  |       - seceng-telemetry@mozilla.com | ||||||
|  |       - jkt@mozilla.com | ||||||
|  |     expires: never | ||||||
|  |     telemetry_mirror: HTTP_CHANNEL_DISPOSITION_UPGRADE | ||||||
|  | 
 | ||||||
|   http_channel_onstart_status: |   http_channel_onstart_status: | ||||||
|     type: labeled_counter |     type: labeled_counter | ||||||
|     description: > |     description: > | ||||||
|  | @ -1807,6 +1837,33 @@ networking: | ||||||
|       - successful |       - successful | ||||||
|       - fail |       - fail | ||||||
| 
 | 
 | ||||||
|  |   http3_channel_onstart_success: | ||||||
|  |     type: dual_labeled_counter | ||||||
|  |     description: > | ||||||
|  |       Successfully started HTTP channels when HTTP3 is used | ||||||
|  | 
 | ||||||
|  |       This metric was generated to correspond to the Legacy Telemetry boolean | ||||||
|  |       histogram HTTP3_CHANNEL_ONSTART_SUCCESS. | ||||||
|  |     dual_labels: | ||||||
|  |       key: | ||||||
|  |         labels: | ||||||
|  |           - "http3" | ||||||
|  |           - "no_http3" | ||||||
|  |         description: Whether http3 was used. | ||||||
|  |       category: | ||||||
|  |         labels: | ||||||
|  |           - "false" | ||||||
|  |           - "true" | ||||||
|  |         description: Boolean | ||||||
|  |     bugs: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1677987 | ||||||
|  |     data_reviews: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1677987 | ||||||
|  |     notification_emails: | ||||||
|  |       - necko@mozilla.com | ||||||
|  |     expires: never | ||||||
|  |     telemetry_mirror: HTTP3_CHANNEL_ONSTART_SUCCESS | ||||||
|  | 
 | ||||||
|   http_channel_page_open_to_first_sent: |   http_channel_page_open_to_first_sent: | ||||||
|     type: timing_distribution |     type: timing_distribution | ||||||
|     time_unit: millisecond |     time_unit: millisecond | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "mozilla/StaticPrefs_network.h" | #include "mozilla/StaticPrefs_network.h" | ||||||
| #include "mozilla/glean/NetwerkProtocolHttpMetrics.h" | #include "mozilla/glean/NetwerkProtocolHttpMetrics.h" | ||||||
| #include "mozilla/Telemetry.h" |  | ||||||
| #include "mozilla/Unused.h" | #include "mozilla/Unused.h" | ||||||
| #include "nsSocketTransportService2.h" | #include "nsSocketTransportService2.h" | ||||||
| 
 | 
 | ||||||
|  | @ -24,9 +23,8 @@ static constexpr nsLiteralCString gKeyName[] = { | ||||||
| }; | }; | ||||||
| #undef DEFINE_CATEGORY | #undef DEFINE_CATEGORY | ||||||
| 
 | 
 | ||||||
| #define DEFINE_CATEGORY(_name, _idx) \ | #define DEFINE_CATEGORY(_name, _idx) "Y##_idx##_##_name"_ns, | ||||||
|   Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS_3::Y##_idx##_##_name, | static const nsLiteralCString gTelemetryLabel[] = { | ||||||
| static const Telemetry::LABELS_HTTP_TRAFFIC_ANALYSIS_3 gTelemetryLabel[] = { |  | ||||||
| #include "HttpTrafficAnalyzer.inc" | #include "HttpTrafficAnalyzer.inc" | ||||||
| }; | }; | ||||||
| #undef DEFINE_CATEGORY | #undef DEFINE_CATEGORY | ||||||
|  | @ -187,8 +185,9 @@ void HttpTrafficAnalyzer::IncrementHttpTransaction( | ||||||
|   LOG(("HttpTrafficAnalyzer::IncrementHttpTransaction [%s] [this=%p]\n", |   LOG(("HttpTrafficAnalyzer::IncrementHttpTransaction [%s] [this=%p]\n", | ||||||
|        gKeyName[aCategory].get(), this)); |        gKeyName[aCategory].get(), this)); | ||||||
| 
 | 
 | ||||||
|   Telemetry::AccumulateCategoricalKeyed("Transaction"_ns, |   glean::http::traffic_analysis | ||||||
|                                         gTelemetryLabel[aCategory]); |       .Get("Transaction"_ns, gTelemetryLabel[aCategory]) | ||||||
|  |       .Add(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HttpTrafficAnalyzer::IncrementHttpConnection( | void HttpTrafficAnalyzer::IncrementHttpConnection( | ||||||
|  | @ -200,8 +199,8 @@ void HttpTrafficAnalyzer::IncrementHttpConnection( | ||||||
|   LOG(("HttpTrafficAnalyzer::IncrementHttpConnection [%s] [this=%p]\n", |   LOG(("HttpTrafficAnalyzer::IncrementHttpConnection [%s] [this=%p]\n", | ||||||
|        gKeyName[aCategory].get(), this)); |        gKeyName[aCategory].get(), this)); | ||||||
| 
 | 
 | ||||||
|   Telemetry::AccumulateCategoricalKeyed("Connection"_ns, |   glean::http::traffic_analysis.Get("Connection"_ns, gTelemetryLabel[aCategory]) | ||||||
|                                         gTelemetryLabel[aCategory]); |       .Add(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HttpTrafficAnalyzer::IncrementHttpConnection( | void HttpTrafficAnalyzer::IncrementHttpConnection( | ||||||
|  |  | ||||||
|  | @ -1383,7 +1383,6 @@ networking: | ||||||
|       - https://bugzil.la/1706842 |       - https://bugzil.la/1706842 | ||||||
|     notification_emails: |     notification_emails: | ||||||
|       - arthur@mozilla.com |       - arthur@mozilla.com | ||||||
|       - tanvi@mozilla.com |  | ||||||
|       - tihuang@mozilla.com |       - tihuang@mozilla.com | ||||||
|     expires: never |     expires: never | ||||||
|     telemetry_mirror: NETWORKING_DATA_TRANSFERRED_V3_KB |     telemetry_mirror: NETWORKING_DATA_TRANSFERRED_V3_KB | ||||||
|  | @ -2894,6 +2893,118 @@ http: | ||||||
|     expires: never |     expires: never | ||||||
|     telemetry_mirror: h#ECHCONFIG_SUCCESS_RATE |     telemetry_mirror: h#ECHCONFIG_SUCCESS_RATE | ||||||
| 
 | 
 | ||||||
|  |   cache_disposition: | ||||||
|  |     type: dual_labeled_counter | ||||||
|  |     description: > | ||||||
|  |       HTTP Cache v2 hit/miss stats keyed by content type. | ||||||
|  | 
 | ||||||
|  |       This metric was generated to correspond to the Legacy Telemetry | ||||||
|  |       categorical histogram HTTP_CACHE_DISPOSITION_3. | ||||||
|  |     dual_labels: | ||||||
|  |       key: | ||||||
|  |         description: Keys of the keyed categorical legacy telemetry histogram | ||||||
|  |           HTTP_CACHE_DISPOSITION_3. | ||||||
|  |         labels: | ||||||
|  |           - ALL | ||||||
|  |           - UNKNOWN | ||||||
|  |           - OTHER | ||||||
|  |           - JAVASCRIPT | ||||||
|  |           - IMAGE | ||||||
|  |           - MEDIA | ||||||
|  |           - STYLESHEET | ||||||
|  |           - WASM | ||||||
|  |       category: | ||||||
|  |         labels: | ||||||
|  |           - Unresolved | ||||||
|  |           - Hit | ||||||
|  |           - HitViaReval | ||||||
|  |           - MissedViaReval | ||||||
|  |           - Missed | ||||||
|  |           - Unknown | ||||||
|  |         description: Labels of the keyed categorical legacy telemetry histogram | ||||||
|  |           HTTP_CACHE_DISPOSITION_3. | ||||||
|  |     bugs: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1611185 | ||||||
|  |     data_reviews: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1611185 | ||||||
|  |     notification_emails: | ||||||
|  |       - necko@mozilla.com | ||||||
|  |     expires: never | ||||||
|  |     telemetry_mirror: HTTP_CACHE_DISPOSITION_3 | ||||||
|  | 
 | ||||||
|  |   traffic_analysis: | ||||||
|  |     type: dual_labeled_counter | ||||||
|  |     description: > | ||||||
|  |       Numbers of HTTP transactions and connections by type. There are some | ||||||
|  |       categories separated by labels based on 5 parameters: 1. normal browsing | ||||||
|  |       or private browsing 2. system principal or not 3. first party or third | ||||||
|  |       party 4. class of service (Leader/Background/Others) 5. tracking | ||||||
|  |       classification (Basic/Content/FingerprintingContent). | ||||||
|  | 
 | ||||||
|  |       This metric was generated to correspond to the Legacy Telemetry | ||||||
|  |       categorical histogram HTTP_TRAFFIC_ANALYSIS_3. | ||||||
|  |     dual_labels: | ||||||
|  |       key: | ||||||
|  |         description: Keys of the keyed categorical legacy telemetry histogram | ||||||
|  |           HTTP_TRAFFIC_ANALYSIS_3. | ||||||
|  |         labels: | ||||||
|  |           - Connection | ||||||
|  |           - Transaction | ||||||
|  |       category: | ||||||
|  |         labels: | ||||||
|  |           - Y0_N1Sys | ||||||
|  |           - Y1_N1 | ||||||
|  |           - Y2_N3Oth | ||||||
|  |           - Y3_N3BasicLead | ||||||
|  |           - Y4_N3BasicBg | ||||||
|  |           - Y5_N3BasicOth | ||||||
|  |           - Y6_N3ContentLead | ||||||
|  |           - Y7_N3ContentBg | ||||||
|  |           - Y8_N3ContentOth | ||||||
|  |           - Y9_N3FpLead | ||||||
|  |           - Y10_N3FpBg | ||||||
|  |           - Y11_N3FpOth | ||||||
|  |           - Y12_P1Sys | ||||||
|  |           - Y13_P1 | ||||||
|  |           - Y14_P3Oth | ||||||
|  |           - Y15_P3BasicLead | ||||||
|  |           - Y16_P3BasicBg | ||||||
|  |           - Y17_P3BasicOth | ||||||
|  |           - Y18_P3ContentLead | ||||||
|  |           - Y19_P3ContentBg | ||||||
|  |           - Y20_P3ContentOth | ||||||
|  |           - Y21_P3FpLead | ||||||
|  |           - Y22_P3FpBg | ||||||
|  |           - Y23_P3FpOth | ||||||
|  |         description: Labels of the keyed categorical legacy telemetry histogram | ||||||
|  |           HTTP_TRAFFIC_ANALYSIS_3. | ||||||
|  |     bugs: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1533363 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1546796 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1546906 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1550756 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1572666 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1590124 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1621800 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1668604 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1706842 | ||||||
|  |     data_reviews: | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1533363 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1546796 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1546906 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1550756 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1572666 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1590124 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1621800 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1668604 | ||||||
|  |       - https://bugzilla.mozilla.org/show_bug.cgi?id=1706842 | ||||||
|  |     notification_emails: | ||||||
|  |       - arthur@mozilla.com | ||||||
|  |       - tanvi@mozilla.com | ||||||
|  |       - tihuang@mozilla.com | ||||||
|  |     expires: never | ||||||
|  |     telemetry_mirror: HTTP_TRAFFIC_ANALYSIS_3 | ||||||
|  | 
 | ||||||
| http3: | http3: | ||||||
|   ech_outcome: |   ech_outcome: | ||||||
|     type: labeled_custom_distribution |     type: labeled_custom_distribution | ||||||
|  |  | ||||||
|  | @ -185,6 +185,25 @@ enum ChannelDisposition { | ||||||
|   kHttpsNetLateFail = 12 |   kHttpsNetLateFail = 12 | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | static nsLiteralCString CacheDispositionToTelemetryLabel( | ||||||
|  |     CacheDisposition hitOrMiss) { | ||||||
|  |   switch (hitOrMiss) { | ||||||
|  |     case kCacheUnresolved: | ||||||
|  |       return "Unresolved"_ns; | ||||||
|  |     case kCacheHit: | ||||||
|  |       return "Hit"_ns; | ||||||
|  |     case kCacheHitViaReval: | ||||||
|  |       return "HitViaReval"_ns; | ||||||
|  |     case kCacheMissedViaReval: | ||||||
|  |       return "MissedViaReval"_ns; | ||||||
|  |     case kCacheMissed: | ||||||
|  |       return "Missed"_ns; | ||||||
|  |     case kCacheUnknown: | ||||||
|  |       return "Unknown"_ns; | ||||||
|  |   } | ||||||
|  |   return "Unresolved"_ns; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void AccumulateCacheHitTelemetry(CacheDisposition hitOrMiss, | void AccumulateCacheHitTelemetry(CacheDisposition hitOrMiss, | ||||||
|                                  nsIChannel* aChannel) { |                                  nsIChannel* aChannel) { | ||||||
|   nsCString key("UNKNOWN"); |   nsCString key("UNKNOWN"); | ||||||
|  | @ -214,31 +233,9 @@ void AccumulateCacheHitTelemetry(CacheDisposition hitOrMiss, | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3 label = |   nsLiteralCString label = CacheDispositionToTelemetryLabel(hitOrMiss); | ||||||
|       Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3::Unresolved; |   glean::http::cache_disposition.Get(key, label).Add(); | ||||||
|   switch (hitOrMiss) { |   glean::http::cache_disposition.Get("ALL"_ns, label).Add(); | ||||||
|     case kCacheUnresolved: |  | ||||||
|       label = Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3::Unresolved; |  | ||||||
|       break; |  | ||||||
|     case kCacheHit: |  | ||||||
|       label = Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3::Hit; |  | ||||||
|       break; |  | ||||||
|     case kCacheHitViaReval: |  | ||||||
|       label = Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3::HitViaReval; |  | ||||||
|       break; |  | ||||||
|     case kCacheMissedViaReval: |  | ||||||
|       label = Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3::MissedViaReval; |  | ||||||
|       break; |  | ||||||
|     case kCacheMissed: |  | ||||||
|       label = Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3::Missed; |  | ||||||
|       break; |  | ||||||
|     case kCacheUnknown: |  | ||||||
|       label = Telemetry::LABELS_HTTP_CACHE_DISPOSITION_3::Unknown; |  | ||||||
|       break; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   Telemetry::AccumulateCategoricalKeyed(key, label); |  | ||||||
|   Telemetry::AccumulateCategoricalKeyed("ALL"_ns, label); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Computes and returns a SHA1 hash of the input buffer. The input buffer
 | // Computes and returns a SHA1 hash of the input buffer. The input buffer
 | ||||||
|  | @ -7862,10 +7859,10 @@ void nsHttpChannel::RecordOnStartTelemetry(nsresult aStatus, | ||||||
|       .Add(1); |       .Add(1); | ||||||
| 
 | 
 | ||||||
|   if (mTransaction) { |   if (mTransaction) { | ||||||
|     Telemetry::Accumulate( |     glean::networking::http3_channel_onstart_success | ||||||
|         Telemetry::HTTP3_CHANNEL_ONSTART_SUCCESS, |         .Get((mTransaction->IsHttp3Used()) ? "http3"_ns : "no_http3"_ns, | ||||||
|         (mTransaction->IsHttp3Used()) ? "http3"_ns : "no_http3"_ns, |              NS_SUCCEEDED(aStatus) ? "true"_ns : "false"_ns) | ||||||
|         NS_SUCCEEDED(aStatus)); |         .Add(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   enum class HttpOnStartState : uint32_t { |   enum class HttpOnStartState : uint32_t { | ||||||
|  | @ -9084,7 +9081,9 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet, | ||||||
|     upgradeKey = "disabledWont"_ns; |     upgradeKey = "disabledWont"_ns; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Telemetry::AccumulateCategoricalKeyed(upgradeKey, upgradeChanDisposition); |   glean::networking::http_channel_disposition_upgrade | ||||||
|  |       .Get(upgradeKey, upgradeChanDispositionLabel) | ||||||
|  |       .Add(); | ||||||
| 
 | 
 | ||||||
|   LOG(("  nsHttpChannel::OnStopRequest ChannelDisposition %d\n", |   LOG(("  nsHttpChannel::OnStopRequest ChannelDisposition %d\n", | ||||||
|        chanDisposition)); |        chanDisposition)); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Florian Quèze
						Florian Quèze