blob: a2d055da7f707bcbf764a133d0d01e15daaefb42 [file] [log] [blame]
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2014 The WebRTC project authors. All Rights Reserved.
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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.org1567b8c2014-05-08 19:54:16 +00009 */
10
11// This file contains enums related to IPv4/IPv6 metrics.
12
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#ifndef API_UMAMETRICS_H_
14#define API_UMAMETRICS_H_
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000015
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "rtc_base/refcount.h"
skvlad1d3c7e02017-01-11 17:50:30 -080017
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000018namespace webrtc {
19
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070020// Used to specify which enum counter type we're incrementing in
21// MetricsObserverInterface::IncrementEnumCounter.
22enum 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 Shieh456696a2015-09-30 21:48:54 -070030
31 kEnumCounterAudioSrtpCipher,
32 kEnumCounterAudioSslCipher,
33 kEnumCounterVideoSrtpCipher,
34 kEnumCounterVideoSslCipher,
35 kEnumCounterDataSrtpCipher,
36 kEnumCounterDataSslCipher,
zhihuangd82eee02016-08-26 11:25:05 -070037 kEnumCounterDtlsHandshakeError,
Honghai Zhangd93f50c2016-10-05 11:47:22 -070038 kEnumCounterIceRegathering,
39 kEnumCounterIceRestart,
Harald Alvestrand194939b2018-01-24 16:04:13 +010040 kEnumCounterKeyProtocol,
Harald Alvestrand5dbb5862018-02-13 23:48:00 +010041 kEnumCounterSdpSemanticRequested,
42 kEnumCounterSdpSemanticNegotiated,
Harald Alvestrandf9d0f1d2018-03-02 14:15:26 +010043 kEnumCounterKeyProtocolMediaType,
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070044 kPeerConnectionEnumCounterMax
45};
46
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000047// Currently this contains information related to WebRTC network/transport
48// information.
49
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070050// The difference between PeerConnectionEnumCounter and
51// PeerConnectionMetricsName is that the "EnumCounter" is only counting the
guoweis@webrtc.org7169afd2014-12-04 17:59:29 +000052// occurrences of events, while "Name" has a value associated with it which is
53// used to form a histogram.
54
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000055// This enum is backed by Chromium's histograms.xml,
56// chromium/src/tools/metrics/histograms/histograms.xml
57// Existing values cannot be re-ordered and new enums must be added
58// before kBoundary.
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070059enum PeerConnectionAddressFamilyCounter {
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000060 kPeerConnection_IPv4,
61 kPeerConnection_IPv6,
62 kBestConnections_IPv4,
63 kBestConnections_IPv6,
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070064 kPeerConnectionAddressFamilyCounter_Max,
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000065};
66
guoweis@webrtc.org7169afd2014-12-04 17:59:29 +000067// TODO(guoweis): Keep previous name here until all references are renamed.
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070068#define kBoundary kPeerConnectionAddressFamilyCounter_Max
guoweis@webrtc.org7169afd2014-12-04 17:59:29 +000069
70// TODO(guoweis): Keep previous name here until all references are renamed.
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070071typedef PeerConnectionAddressFamilyCounter PeerConnectionUMAMetricsCounter;
guoweis@webrtc.org7169afd2014-12-04 17:59:29 +000072
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000073// This enum defines types for UMA samples, which will have a range.
guoweis@webrtc.org7169afd2014-12-04 17:59:29 +000074enum PeerConnectionMetricsName {
75 kNetworkInterfaces_IPv4, // Number of IPv4 interfaces.
76 kNetworkInterfaces_IPv6, // Number of IPv6 interfaces.
77 kTimeToConnect, // In milliseconds.
78 kLocalCandidates_IPv4, // Number of IPv4 local candidates.
79 kLocalCandidates_IPv6, // Number of IPv6 local candidates.
80 kPeerConnectionMetricsName_Max
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +000081};
82
guoweis@webrtc.org7169afd2014-12-04 17:59:29 +000083// TODO(guoweis): Keep previous name here until all references are renamed.
84typedef PeerConnectionMetricsName PeerConnectionUMAMetricsName;
85
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070086// The IceCandidatePairType has the format of
87// <local_candidate_type>_<remote_candidate_type>. It is recorded based on the
88// type of candidate pair used when the PeerConnection first goes to a completed
89// state. When BUNDLE is enabled, only the first transport gets recorded.
90enum IceCandidatePairType {
Guo-wei Shieh3cc834a2015-09-04 15:52:14 -070091 // HostHost is deprecated. It was replaced with the set of types at the bottom
92 // to report private or public host IP address.
Guo-wei Shieh3d564c12015-08-19 16:51:15 -070093 kIceCandidatePairHostHost,
94 kIceCandidatePairHostSrflx,
95 kIceCandidatePairHostRelay,
96 kIceCandidatePairHostPrflx,
97 kIceCandidatePairSrflxHost,
98 kIceCandidatePairSrflxSrflx,
99 kIceCandidatePairSrflxRelay,
100 kIceCandidatePairSrflxPrflx,
101 kIceCandidatePairRelayHost,
102 kIceCandidatePairRelaySrflx,
103 kIceCandidatePairRelayRelay,
104 kIceCandidatePairRelayPrflx,
105 kIceCandidatePairPrflxHost,
106 kIceCandidatePairPrflxSrflx,
107 kIceCandidatePairPrflxRelay,
Guo-wei Shieh3cc834a2015-09-04 15:52:14 -0700108
109 // The following 4 types tell whether local and remote hosts have private or
110 // public IP addresses.
111 kIceCandidatePairHostPrivateHostPrivate,
112 kIceCandidatePairHostPrivateHostPublic,
113 kIceCandidatePairHostPublicHostPrivate,
114 kIceCandidatePairHostPublicHostPublic,
Guo-wei Shieh3d564c12015-08-19 16:51:15 -0700115 kIceCandidatePairMax
116};
117
Harald Alvestrand194939b2018-01-24 16:04:13 +0100118enum KeyExchangeProtocolType {
119 kEnumCounterKeyProtocolDtls,
120 kEnumCounterKeyProtocolSdes,
121 kEnumCounterKeyProtocolMax
122};
123
Harald Alvestrandf9d0f1d2018-03-02 14:15:26 +0100124enum KeyExchangeProtocolMedia {
125 kEnumCounterKeyProtocolMediaTypeDtlsAudio,
126 kEnumCounterKeyProtocolMediaTypeDtlsVideo,
127 kEnumCounterKeyProtocolMediaTypeDtlsData,
128 kEnumCounterKeyProtocolMediaTypeSdesAudio,
129 kEnumCounterKeyProtocolMediaTypeSdesVideo,
130 kEnumCounterKeyProtocolMediaTypeSdesData,
131 kEnumCounterKeyProtocolMediaTypeMax
132};
133
Harald Alvestrand5dbb5862018-02-13 23:48:00 +0100134enum SdpSemanticRequested {
135 kSdpSemanticRequestDefault,
136 kSdpSemanticRequestPlanB,
137 kSdpSemanticRequestUnifiedPlan,
138 kSdpSemanticRequestMax
139};
140
141enum SdpSemanticNegotiated {
142 kSdpSemanticNegotiatedNone,
143 kSdpSemanticNegotiatedPlanB,
144 kSdpSemanticNegotiatedUnifiedPlan,
145 kSdpSemanticNegotiatedMixed,
146 kSdpSemanticNegotiatedMax
147};
148
skvlad1d3c7e02017-01-11 17:50:30 -0800149class MetricsObserverInterface : public rtc::RefCountInterface {
150 public:
skvlad1d3c7e02017-01-11 17:50:30 -0800151 // |type| is the type of the enum counter to be incremented. |counter|
152 // is the particular counter in that type. |counter_max| is the next sequence
153 // number after the highest counter.
154 virtual void IncrementEnumCounter(PeerConnectionEnumCounterType type,
155 int counter,
156 int counter_max) {}
157
158 // This is used to handle sparse counters like SSL cipher suites.
159 // TODO(guoweis): Remove the implementation once the dependency's interface
160 // definition is updated.
161 virtual void IncrementSparseEnumCounter(PeerConnectionEnumCounterType type,
Steve Antonf2737d22017-10-31 16:27:34 -0700162 int counter);
skvlad1d3c7e02017-01-11 17:50:30 -0800163
164 virtual void AddHistogramSample(PeerConnectionMetricsName type,
165 int value) = 0;
skvlad1d3c7e02017-01-11 17:50:30 -0800166};
167
168typedef MetricsObserverInterface UMAObserver;
169
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +0000170} // namespace webrtc
171
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200172#endif // API_UMAMETRICS_H_