xref: /aosp_15_r20/external/webrtc/api/uma_metrics.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2014 The WebRTC project authors. All Rights Reserved.
3  *
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.
9  */
10 
11 // This file contains enums related to Chrome UMA histograms. See
12 // https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#requirements
13 // for requirements when adding or changing metrics.
14 
15 #ifndef API_UMA_METRICS_H_
16 #define API_UMA_METRICS_H_
17 
18 namespace webrtc {
19 
20 // These values are persisted to logs. Entries should not be renumbered and
21 // numeric values should never be reused.
22 enum PeerConnectionAddressFamilyCounter {
23   kPeerConnection_IPv4 = 0,
24   kPeerConnection_IPv6 = 1,
25   kBestConnections_IPv4 = 2,
26   kBestConnections_IPv6 = 3,
27   kPeerConnectionAddressFamilyCounter_Max
28 };
29 
30 // This enum defines types for UMA samples, which will have a range.
31 // These values are persisted to logs. Entries should not be renumbered and
32 // numeric values should never be reused.
33 enum PeerConnectionMetricsName {
34   kNetworkInterfaces_IPv4 = 0,  // Number of IPv4 interfaces.
35   kNetworkInterfaces_IPv6 = 1,  // Number of IPv6 interfaces.
36   kTimeToConnect = 2,           // In milliseconds.
37   kLocalCandidates_IPv4 = 3,    // Number of IPv4 local candidates.
38   kLocalCandidates_IPv6 = 4,    // Number of IPv6 local candidates.
39   kPeerConnectionMetricsName_Max
40 };
41 
42 // The IceCandidatePairType has the format of
43 // <local_candidate_type>_<remote_candidate_type>. It is recorded based on the
44 // type of candidate pair used when the PeerConnection first goes to a completed
45 // state. When BUNDLE is enabled, only the first transport gets recorded.
46 // These values are persisted to logs. Entries should not be renumbered and
47 // numeric values should never be reused.
48 enum IceCandidatePairType {
49   // HostHost is deprecated. It was replaced with the set of types at the bottom
50   // to report private or public host IP address.
51   kIceCandidatePairHostHost = 0,
52   kIceCandidatePairHostSrflx = 1,
53   kIceCandidatePairHostRelay = 2,
54   kIceCandidatePairHostPrflx = 3,
55   kIceCandidatePairSrflxHost = 4,
56   kIceCandidatePairSrflxSrflx = 5,
57   kIceCandidatePairSrflxRelay = 6,
58   kIceCandidatePairSrflxPrflx = 7,
59   kIceCandidatePairRelayHost = 8,
60   kIceCandidatePairRelaySrflx = 9,
61   kIceCandidatePairRelayRelay = 10,
62   kIceCandidatePairRelayPrflx = 11,
63   kIceCandidatePairPrflxHost = 12,
64   kIceCandidatePairPrflxSrflx = 13,
65   kIceCandidatePairPrflxRelay = 14,
66 
67   // The following 9 types tell whether local and remote hosts have hostname,
68   // private or public IP addresses.
69   kIceCandidatePairHostPrivateHostPrivate = 15,
70   kIceCandidatePairHostPrivateHostPublic = 16,
71   kIceCandidatePairHostPublicHostPrivate = 17,
72   kIceCandidatePairHostPublicHostPublic = 18,
73   kIceCandidatePairHostNameHostName = 19,
74   kIceCandidatePairHostNameHostPrivate = 20,
75   kIceCandidatePairHostNameHostPublic = 21,
76   kIceCandidatePairHostPrivateHostName = 22,
77   kIceCandidatePairHostPublicHostName = 23,
78   kIceCandidatePairMax
79 };
80 
81 // The difference between PeerConnectionEnumCounter and
82 // PeerConnectionMetricsName is that the "EnumCounter" is only counting the
83 // occurrences of events, while "Name" has a value associated with it which is
84 // used to form a histogram.
85 
86 // These values are persisted to logs. Entries should not be renumbered and
87 // numeric values should never be reused.
88 enum KeyExchangeProtocolMedia {
89   kEnumCounterKeyProtocolMediaTypeDtlsAudio = 0,
90   kEnumCounterKeyProtocolMediaTypeDtlsVideo = 1,
91   kEnumCounterKeyProtocolMediaTypeDtlsData = 2,
92   kEnumCounterKeyProtocolMediaTypeSdesAudio = 3,
93   kEnumCounterKeyProtocolMediaTypeSdesVideo = 4,
94   kEnumCounterKeyProtocolMediaTypeSdesData = 5,
95   kEnumCounterKeyProtocolMediaTypeMax
96 };
97 
98 // These values are persisted to logs. Entries should not be renumbered and
99 // numeric values should never be reused.
100 enum SdpSemanticRequested {
101   kSdpSemanticRequestDefault = 0,
102   kSdpSemanticRequestPlanB = 1,
103   kSdpSemanticRequestUnifiedPlan = 2,
104   kSdpSemanticRequestMax
105 };
106 
107 // Metric for counting the outcome of adding an ICE candidate
108 // These values are persisted to logs. Entries should not be renumbered and
109 // numeric values should never be reused.
110 enum AddIceCandidateResult {
111   kAddIceCandidateSuccess = 0,
112   kAddIceCandidateFailClosed = 1,
113   kAddIceCandidateFailNoRemoteDescription = 2,
114   kAddIceCandidateFailNullCandidate = 3,
115   kAddIceCandidateFailNotValid = 4,
116   kAddIceCandidateFailNotReady = 5,
117   kAddIceCandidateFailInAddition = 6,
118   kAddIceCandidateFailNotUsable = 7,
119   kAddIceCandidateMax
120 };
121 
122 // Metric for recording which api surface was used to enable simulcast.
123 // These values are persisted to logs. Entries should not be renumbered and
124 // numeric values should never be reused.
125 enum SimulcastApiVersion {
126   kSimulcastApiVersionNone = 0,
127   kSimulcastApiVersionLegacy = 1,
128   kSimulcastApiVersionSpecCompliant = 2,
129   kSimulcastApiVersionMax
130 };
131 
132 // Metrics for reporting usage of BUNDLE.
133 // These values are persisted to logs. Entries should not be renumbered and
134 // numeric values should never be reused.
135 enum BundleUsage {
136   // There are no m-lines in the SDP, only a session description.
137   kBundleUsageEmpty = 0,
138   // Only a data channel is negotiated but BUNDLE is not negotiated.
139   kBundleUsageNoBundleDatachannelOnly = 1,
140   // BUNDLE is not negotiated and there is at most one m-line per media type,
141   kBundleUsageNoBundleSimple = 2,
142   // BUNDLE is not negotiated and there are multiple m-lines per media type,
143   kBundleUsageNoBundleComplex = 3,
144   // Only a data channel is negotiated and BUNDLE is negotiated.
145   kBundleUsageBundleDatachannelOnly = 4,
146   // BUNDLE is negotiated but there is at most one m-line per media type,
147   kBundleUsageBundleSimple = 5,
148   // BUNDLE is negotiated and there are multiple m-lines per media type,
149   kBundleUsageBundleComplex = 6,
150   // Legacy plan-b metrics.
151   kBundleUsageNoBundlePlanB = 7,
152   kBundleUsageBundlePlanB = 8,
153   kBundleUsageMax
154 };
155 
156 // Metrics for reporting configured BUNDLE policy, mapping directly to
157 // https://w3c.github.io/webrtc-pc/#rtcbundlepolicy-enum
158 // These values are persisted to logs. Entries should not be renumbered and
159 // numeric values should never be reused.
160 enum BundlePolicyUsage {
161   kBundlePolicyUsageBalanced = 0,
162   kBundlePolicyUsageMaxBundle = 1,
163   kBundlePolicyUsageMaxCompat = 2,
164   kBundlePolicyUsageMax
165 };
166 
167 // Metrics for provisional answers as described in
168 // https://datatracker.ietf.org/doc/html/rfc8829#section-4.1.10.1
169 // These values are persisted to logs. Entries should not be renumbered and
170 // numeric values should never be reused.
171 enum ProvisionalAnswerUsage {
172   kProvisionalAnswerNotUsed = 0,
173   kProvisionalAnswerLocal = 1,
174   kProvisionalAnswerRemote = 2,
175   kProvisionalAnswerMax
176 };
177 
178 // When adding new metrics please consider using the style described in
179 // https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md#usage
180 // instead of the legacy enums used above.
181 
182 }  // namespace webrtc
183 
184 #endif  // API_UMA_METRICS_H_
185