buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 15:54:43 | [diff] [blame] | 2 | * Copyright 2014 The WebRTC project authors. All Rights Reserved. |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 15:54:43 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | // This file contains enums related to IPv4/IPv6 metrics. |
| 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 13 | #ifndef API_UMAMETRICS_H_ |
| 14 | #define API_UMAMETRICS_H_ |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 16 | #include "rtc_base/refcount.h" |
skvlad | 1d3c7e0 | 2017-01-12 01:50:30 | [diff] [blame] | 17 | |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 18 | namespace webrtc { |
| 19 | |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 20 | // Used to specify which enum counter type we're incrementing in |
| 21 | // MetricsObserverInterface::IncrementEnumCounter. |
| 22 | enum PeerConnectionEnumCounterType { |
| 23 | kEnumCounterAddressFamily, |
| 24 | // For the next 2 counters, we track them separately based on the "first hop" |
| 25 | // protocol used by the local candidate. "First hop" means the local candidate |
| 26 | // type in the case of non-TURN candidates, and the protocol used to connect |
| 27 | // to the TURN server in the case of TURN candidates. |
| 28 | kEnumCounterIceCandidatePairTypeUdp, |
| 29 | kEnumCounterIceCandidatePairTypeTcp, |
Guo-wei Shieh | 456696a | 2015-10-01 04:48:54 | [diff] [blame] | 30 | |
| 31 | kEnumCounterAudioSrtpCipher, |
| 32 | kEnumCounterAudioSslCipher, |
| 33 | kEnumCounterVideoSrtpCipher, |
| 34 | kEnumCounterVideoSslCipher, |
| 35 | kEnumCounterDataSrtpCipher, |
| 36 | kEnumCounterDataSslCipher, |
zhihuang | d82eee0 | 2016-08-26 18:25:05 | [diff] [blame] | 37 | kEnumCounterDtlsHandshakeError, |
Honghai Zhang | d93f50c | 2016-10-05 18:47:22 | [diff] [blame] | 38 | kEnumCounterIceRegathering, |
| 39 | kEnumCounterIceRestart, |
Harald Alvestrand | 194939b | 2018-01-24 15:04:13 | [diff] [blame] | 40 | kEnumCounterKeyProtocol, |
Harald Alvestrand | 5dbb586 | 2018-02-13 22:48:00 | [diff] [blame] | 41 | kEnumCounterSdpSemanticRequested, |
| 42 | kEnumCounterSdpSemanticNegotiated, |
Harald Alvestrand | f9d0f1d | 2018-03-02 13:15:26 | [diff] [blame] | 43 | kEnumCounterKeyProtocolMediaType, |
Steve Anton | 8e20f17 | 2018-03-06 18:55:04 | [diff] [blame^] | 44 | kEnumCounterSdpFormatReceived, |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 45 | kPeerConnectionEnumCounterMax |
| 46 | }; |
| 47 | |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 48 | // Currently this contains information related to WebRTC network/transport |
| 49 | // information. |
| 50 | |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 51 | // The difference between PeerConnectionEnumCounter and |
| 52 | // PeerConnectionMetricsName is that the "EnumCounter" is only counting the |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 | [diff] [blame] | 53 | // occurrences of events, while "Name" has a value associated with it which is |
| 54 | // used to form a histogram. |
| 55 | |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 56 | // This enum is backed by Chromium's histograms.xml, |
| 57 | // chromium/src/tools/metrics/histograms/histograms.xml |
| 58 | // Existing values cannot be re-ordered and new enums must be added |
| 59 | // before kBoundary. |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 60 | enum PeerConnectionAddressFamilyCounter { |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 61 | kPeerConnection_IPv4, |
| 62 | kPeerConnection_IPv6, |
| 63 | kBestConnections_IPv4, |
| 64 | kBestConnections_IPv6, |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 65 | kPeerConnectionAddressFamilyCounter_Max, |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 66 | }; |
| 67 | |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 | [diff] [blame] | 68 | // TODO(guoweis): Keep previous name here until all references are renamed. |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 69 | #define kBoundary kPeerConnectionAddressFamilyCounter_Max |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 | [diff] [blame] | 70 | |
| 71 | // TODO(guoweis): Keep previous name here until all references are renamed. |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 72 | typedef PeerConnectionAddressFamilyCounter PeerConnectionUMAMetricsCounter; |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 | [diff] [blame] | 73 | |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 74 | // This enum defines types for UMA samples, which will have a range. |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 | [diff] [blame] | 75 | enum PeerConnectionMetricsName { |
| 76 | kNetworkInterfaces_IPv4, // Number of IPv4 interfaces. |
| 77 | kNetworkInterfaces_IPv6, // Number of IPv6 interfaces. |
| 78 | kTimeToConnect, // In milliseconds. |
| 79 | kLocalCandidates_IPv4, // Number of IPv4 local candidates. |
| 80 | kLocalCandidates_IPv6, // Number of IPv6 local candidates. |
| 81 | kPeerConnectionMetricsName_Max |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 82 | }; |
| 83 | |
guoweis@webrtc.org | 7169afd | 2014-12-04 17:59:29 | [diff] [blame] | 84 | // TODO(guoweis): Keep previous name here until all references are renamed. |
| 85 | typedef PeerConnectionMetricsName PeerConnectionUMAMetricsName; |
| 86 | |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 87 | // The IceCandidatePairType has the format of |
| 88 | // <local_candidate_type>_<remote_candidate_type>. It is recorded based on the |
| 89 | // type of candidate pair used when the PeerConnection first goes to a completed |
| 90 | // state. When BUNDLE is enabled, only the first transport gets recorded. |
| 91 | enum IceCandidatePairType { |
Guo-wei Shieh | 3cc834a | 2015-09-04 22:52:14 | [diff] [blame] | 92 | // HostHost is deprecated. It was replaced with the set of types at the bottom |
| 93 | // to report private or public host IP address. |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 94 | kIceCandidatePairHostHost, |
| 95 | kIceCandidatePairHostSrflx, |
| 96 | kIceCandidatePairHostRelay, |
| 97 | kIceCandidatePairHostPrflx, |
| 98 | kIceCandidatePairSrflxHost, |
| 99 | kIceCandidatePairSrflxSrflx, |
| 100 | kIceCandidatePairSrflxRelay, |
| 101 | kIceCandidatePairSrflxPrflx, |
| 102 | kIceCandidatePairRelayHost, |
| 103 | kIceCandidatePairRelaySrflx, |
| 104 | kIceCandidatePairRelayRelay, |
| 105 | kIceCandidatePairRelayPrflx, |
| 106 | kIceCandidatePairPrflxHost, |
| 107 | kIceCandidatePairPrflxSrflx, |
| 108 | kIceCandidatePairPrflxRelay, |
Guo-wei Shieh | 3cc834a | 2015-09-04 22:52:14 | [diff] [blame] | 109 | |
| 110 | // The following 4 types tell whether local and remote hosts have private or |
| 111 | // public IP addresses. |
| 112 | kIceCandidatePairHostPrivateHostPrivate, |
| 113 | kIceCandidatePairHostPrivateHostPublic, |
| 114 | kIceCandidatePairHostPublicHostPrivate, |
| 115 | kIceCandidatePairHostPublicHostPublic, |
Guo-wei Shieh | 3d564c1 | 2015-08-19 23:51:15 | [diff] [blame] | 116 | kIceCandidatePairMax |
| 117 | }; |
| 118 | |
Harald Alvestrand | 194939b | 2018-01-24 15:04:13 | [diff] [blame] | 119 | enum KeyExchangeProtocolType { |
| 120 | kEnumCounterKeyProtocolDtls, |
| 121 | kEnumCounterKeyProtocolSdes, |
| 122 | kEnumCounterKeyProtocolMax |
| 123 | }; |
| 124 | |
Harald Alvestrand | f9d0f1d | 2018-03-02 13:15:26 | [diff] [blame] | 125 | enum KeyExchangeProtocolMedia { |
| 126 | kEnumCounterKeyProtocolMediaTypeDtlsAudio, |
| 127 | kEnumCounterKeyProtocolMediaTypeDtlsVideo, |
| 128 | kEnumCounterKeyProtocolMediaTypeDtlsData, |
| 129 | kEnumCounterKeyProtocolMediaTypeSdesAudio, |
| 130 | kEnumCounterKeyProtocolMediaTypeSdesVideo, |
| 131 | kEnumCounterKeyProtocolMediaTypeSdesData, |
| 132 | kEnumCounterKeyProtocolMediaTypeMax |
| 133 | }; |
| 134 | |
Harald Alvestrand | 5dbb586 | 2018-02-13 22:48:00 | [diff] [blame] | 135 | enum SdpSemanticRequested { |
| 136 | kSdpSemanticRequestDefault, |
| 137 | kSdpSemanticRequestPlanB, |
| 138 | kSdpSemanticRequestUnifiedPlan, |
| 139 | kSdpSemanticRequestMax |
| 140 | }; |
| 141 | |
| 142 | enum SdpSemanticNegotiated { |
| 143 | kSdpSemanticNegotiatedNone, |
| 144 | kSdpSemanticNegotiatedPlanB, |
| 145 | kSdpSemanticNegotiatedUnifiedPlan, |
| 146 | kSdpSemanticNegotiatedMixed, |
| 147 | kSdpSemanticNegotiatedMax |
| 148 | }; |
| 149 | |
Steve Anton | 8e20f17 | 2018-03-06 18:55:04 | [diff] [blame^] | 150 | // Metric which records the format of the received SDP for tracking how much the |
| 151 | // difference between Plan B and Unified Plan affect users. |
| 152 | enum SdpFormatReceived { |
| 153 | // No audio or video tracks. This is worth special casing since it seems to be |
| 154 | // the most common scenario (data-channel only). |
| 155 | kSdpFormatReceivedNoTracks, |
| 156 | // No more than one audio and one video track. Should be compatible with both |
| 157 | // Plan B and Unified Plan endpoints. |
| 158 | kSdpFormatReceivedSimple, |
| 159 | // More than one audio track or more than one video track in the Plan B format |
| 160 | // (e.g., one audio media section with multiple streams). |
| 161 | kSdpFormatReceivedComplexPlanB, |
| 162 | // More than one audio track or more than one video track in the Unified Plan |
| 163 | // format (e.g., two audio media sections). |
| 164 | kSdpFormatReceivedComplexUnifiedPlan, |
| 165 | kSdpFormatReceivedMax |
| 166 | }; |
| 167 | |
skvlad | 1d3c7e0 | 2017-01-12 01:50:30 | [diff] [blame] | 168 | class MetricsObserverInterface : public rtc::RefCountInterface { |
| 169 | public: |
skvlad | 1d3c7e0 | 2017-01-12 01:50:30 | [diff] [blame] | 170 | // |type| is the type of the enum counter to be incremented. |counter| |
| 171 | // is the particular counter in that type. |counter_max| is the next sequence |
| 172 | // number after the highest counter. |
| 173 | virtual void IncrementEnumCounter(PeerConnectionEnumCounterType type, |
| 174 | int counter, |
| 175 | int counter_max) {} |
| 176 | |
| 177 | // This is used to handle sparse counters like SSL cipher suites. |
| 178 | // TODO(guoweis): Remove the implementation once the dependency's interface |
| 179 | // definition is updated. |
| 180 | virtual void IncrementSparseEnumCounter(PeerConnectionEnumCounterType type, |
Steve Anton | f2737d2 | 2017-10-31 23:27:34 | [diff] [blame] | 181 | int counter); |
skvlad | 1d3c7e0 | 2017-01-12 01:50:30 | [diff] [blame] | 182 | |
| 183 | virtual void AddHistogramSample(PeerConnectionMetricsName type, |
| 184 | int value) = 0; |
skvlad | 1d3c7e0 | 2017-01-12 01:50:30 | [diff] [blame] | 185 | }; |
| 186 | |
| 187 | typedef MetricsObserverInterface UMAObserver; |
| 188 | |
buildbot@webrtc.org | 1567b8c | 2014-05-08 19:54:16 | [diff] [blame] | 189 | } // namespace webrtc |
| 190 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 191 | #endif // API_UMAMETRICS_H_ |