File: metrics.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (158 lines) | stat: -rw-r--r-- 5,740 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_COLLABORATION_INTERNAL_METRICS_H_
#define COMPONENTS_COLLABORATION_INTERNAL_METRICS_H_

#include "base/time/time.h"
#include "components/collaboration/public/collaboration_flow_entry_point.h"
#include "components/collaboration/public/collaboration_flow_type.h"

namespace data_sharing {
class Logger;
}  // namespace data_sharing

namespace collaboration::metrics {

// Types of join events that occur in the collaboration service.
// These values are persisted to logs. Entries should not be renumbered and
// number values should never be reused.
// LINT.IfChange(CollaborationServiceJoinEvent)
enum class CollaborationServiceJoinEvent {
  kUnknown = 0,
  kStarted = 1,
  kCanceled = 2,
  kCanceledNotSignedIn = 3,
  kNotSignedIn = 4,
  kAccepted = 5,
  kOpenedNewGroup = 6,
  kOpenedExistingGroup = 7,
  kFlowRequirementsMet = 8,
  kParsingFailure = 9,
  kSigninVerificationFailed = 10,
  kSigninVerified = 11,
  kSigninVerifiedInObserver = 12,
  kFoundCollaborationWithoutTabGroup = 13,
  kReadNewGroupFailed = 14,
  kReadNewGroupSuccess = 15,
  kAddedUserToGroup = 16,
  kPreviewGroupFullError = 17,
  kPreviewFailure = 18,
  kPreviewSuccess = 19,
  kGroupExistsWhenJoined = 20,
  kTabGroupFetched = 21,
  kPeopleGroupFetched = 22,
  kPromoteTabGroup = 23,
  kDataSharingReadyWhenStarted = 24,
  kDataSharingServiceReadyObserved = 25,
  kTabGroupServiceReady = 26,
  kAllServicesReadyForFlow = 27,
  kTimeoutWaitingForServicesReady = 28,
  kTimeoutWaitingForSyncAndDataSharingGroup = 29,
  kDevicePolicyDisableSignin = 30,
  kManagedAccountSignin = 31,
  kAccountInfoNotReadyOnSignin = 32,
  kReadNewGroupUserIsAlreadyMember = 33,
  kFailedAddingUserToGroup = 34,
  kMaxValue = kFailedAddingUserToGroup,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/collaboration_service/enums.xml:CollaborationServiceJoinEvent)

// Types of share or manage events that occur in the collaboration service.
// These values are persisted to logs. Entries should not be renumbered and
// number values should never be reused.
// LINT.IfChange(CollaborationServiceShareOrManageEvent)
enum class CollaborationServiceShareOrManageEvent {
  kUnknown = 0,
  kStarted = 1,
  kNotSignedIn = 2,
  kCanceledNotSignedIn = 3,
  kShareDialogShown = 4,
  kManageDialogShown = 5,
  kCollaborationGroupCreated = 6,
  kUrlReadyToShare = 7,
  kFlowRequirementsMet = 8,
  kSigninVerificationFailed = 9,
  kSigninVerified = 10,
  kSigninVerifiedInObserver = 11,
  kSyncedTabGroupNotFound = 12,
  kCollaborationIdMissing = 13,
  kCollaborationIdInvalid = 14,
  kTabGroupMissingBeforeMigration = 15,
  kMigrationFailure = 16,
  kReadGroupFailed = 17,
  kUrlCreationFailed = 18,
  kDataSharingReadyWhenStarted = 19,
  kDataSharingServiceReadyObserved = 20,
  kTabGroupServiceReady = 21,
  kAllServicesReadyForFlow = 22,
  kDevicePolicyDisableSignin = 23,
  kManagedAccountSignin = 24,
  kAccountInfoNotReadyOnSignin = 25,
  kCollaborationIdEmptyGroupToken = 26,
  kCollaborationIdShareCanceled = 27,
  kTabGroupShared = 28,
  kMaxValue = kTabGroupShared,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/collaboration_service/enums.xml:CollaborationServiceShareOrManageEvent)

// Types of collaboration flow events that occur in the collaboration service.
// These values are persisted to logs. Entries should not be renumbered and
// number values should never be reused.
// LINT.IfChange(CollaborationServiceFlowEvent)
enum class CollaborationServiceFlowEvent {
  kUnknown = 0,
  kStarted = 1,
  kNotSignedIn = 2,
  kCanceledNotSignedIn = 3,
  kFlowRequirementsMet = 4,
  kSigninVerificationFailed = 5,
  kSigninVerified = 6,
  kSigninVerifiedInObserver = 7,
  kDataSharingReadyWhenStarted = 8,
  kDataSharingServiceReadyObserved = 9,
  kTabGroupServiceReady = 10,
  kAllServicesReadyForFlow = 11,
  kDevicePolicyDisableSignin = 12,
  kManagedAccountSignin = 13,
  kAccountInfoNotReadyOnSignin = 14,
  kMaxValue = kAccountInfoNotReadyOnSignin,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/collaboration_service/enums.xml:CollaborationServiceFlowEvent)

enum class CollaborationServiceStep {
  kUnknown = 0,
  kAuthenticationInitToSuccess = 1,
  kWaitingForServicesInitialization = 2,
  kLinkReadyAfterGroupCreation = 3,
  kTabGroupFetchedAfterPeopleGroupJoined = 4,
  kMaxValue = kTabGroupFetchedAfterPeopleGroupJoined,
};

void RecordJoinEvent(data_sharing::Logger* logger,
                     CollaborationServiceJoinEvent event);
void RecordShareOrManageEvent(data_sharing::Logger* logger,
                              CollaborationServiceShareOrManageEvent event);
void RecordJoinOrShareOrManageEvent(
    data_sharing::Logger* logger,
    FlowType type,
    CollaborationServiceJoinEvent join_event,
    CollaborationServiceShareOrManageEvent share_or_manage_event);
void RecordLeaveOrDeleteEntryPoint(
    data_sharing::Logger* logger,
    CollaborationServiceLeaveOrDeleteEntryPoint event);
void RecordJoinEntryPoint(data_sharing::Logger* logger,
                          CollaborationServiceJoinEntryPoint entry);
void RecordShareOrManageEntryPoint(
    data_sharing::Logger* logger,
    CollaborationServiceShareOrManageEntryPoint entry);
void RecordLatency(data_sharing::Logger* logger,
                   CollaborationServiceStep step,
                   base::TimeDelta duration);
void RecordCollaborationFlowEvent(data_sharing::Logger* logger,
                                  FlowType type,
                                  CollaborationServiceFlowEvent event);
}  // namespace collaboration::metrics

#endif  // COMPONENTS_COLLABORATION_INTERNAL_METRICS_H_