@@ -25,6 +25,7 @@ pub enum DaemonInitStatus {
25
25
pub struct GenericEventBuilder {
26
26
id : String ,
27
27
parent_id : Option < String > ,
28
+ is_ci : bool ,
28
29
}
29
30
30
31
impl Identifiable for GenericEventBuilder {
@@ -40,6 +41,10 @@ impl EventBuilder for GenericEventBuilder {
40
41
}
41
42
42
43
fn track ( & self , event : Event ) {
44
+ if self . is_ci && !event. send_in_ci {
45
+ return ;
46
+ }
47
+
43
48
let val = match event. is_sensitive {
44
49
EventType :: Sensitive => TelemetryConfig :: one_way_hash ( & event. value ) ,
45
50
EventType :: NonSensitive => event. value . to_string ( ) ,
@@ -63,6 +68,7 @@ impl Default for GenericEventBuilder {
63
68
Self {
64
69
id : Uuid :: new_v4 ( ) . to_string ( ) ,
65
70
parent_id : None ,
71
+ is_ci : turborepo_ci:: is_ci ( ) ,
66
72
}
67
73
}
68
74
}
@@ -78,6 +84,7 @@ impl GenericEventBuilder {
78
84
key : "execution" . to_string ( ) ,
79
85
value : "started" . to_string ( ) ,
80
86
is_sensitive : EventType :: NonSensitive ,
87
+ send_in_ci : false ,
81
88
} ) ;
82
89
self
83
90
}
@@ -87,24 +94,7 @@ impl GenericEventBuilder {
87
94
key : "execution" . to_string ( ) ,
88
95
value : "ended" . to_string ( ) ,
89
96
is_sensitive : EventType :: NonSensitive ,
90
- } ) ;
91
- self
92
- }
93
-
94
- pub fn track_success ( & self ) -> & Self {
95
- self . track ( Event {
96
- key : "execution" . to_string ( ) ,
97
- value : "succeeded" . to_string ( ) ,
98
- is_sensitive : EventType :: NonSensitive ,
99
- } ) ;
100
- self
101
- }
102
-
103
- pub fn track_failure ( & self ) -> & Self {
104
- self . track ( Event {
105
- key : "execution" . to_string ( ) ,
106
- value : "failed" . to_string ( ) ,
107
- is_sensitive : EventType :: NonSensitive ,
97
+ send_in_ci : false ,
108
98
} ) ;
109
99
self
110
100
}
@@ -114,6 +104,7 @@ impl GenericEventBuilder {
114
104
key : "platform" . to_string ( ) ,
115
105
value : platform. to_string ( ) ,
116
106
is_sensitive : EventType :: NonSensitive ,
107
+ send_in_ci : true ,
117
108
} ) ;
118
109
self
119
110
}
@@ -123,6 +114,7 @@ impl GenericEventBuilder {
123
114
key : "cpu_count" . to_string ( ) ,
124
115
value : cpus. to_string ( ) ,
125
116
is_sensitive : EventType :: NonSensitive ,
117
+ send_in_ci : true ,
126
118
} ) ;
127
119
self
128
120
}
@@ -132,6 +124,7 @@ impl GenericEventBuilder {
132
124
key : "turbo_version" . to_string ( ) ,
133
125
value : version. to_string ( ) ,
134
126
is_sensitive : EventType :: NonSensitive ,
127
+ send_in_ci : true ,
135
128
} ) ;
136
129
self
137
130
}
@@ -142,6 +135,7 @@ impl GenericEventBuilder {
142
135
key : format ! ( "arg:{}" , arg) ,
143
136
value : if is_set { "set" } else { "default" } . to_string ( ) ,
144
137
is_sensitive : EventType :: NonSensitive ,
138
+ send_in_ci : true ,
145
139
} ) ;
146
140
self
147
141
}
@@ -151,6 +145,7 @@ impl GenericEventBuilder {
151
145
key : format ! ( "arg:{}" , arg) ,
152
146
value : val. to_string ( ) ,
153
147
is_sensitive,
148
+ send_in_ci : true ,
154
149
} ) ;
155
150
self
156
151
}
@@ -161,6 +156,7 @@ impl GenericEventBuilder {
161
156
key : "is_linked" . to_string ( ) ,
162
157
value : if is_linked { "true" } else { "false" } . to_string ( ) ,
163
158
is_sensitive : EventType :: NonSensitive ,
159
+ send_in_ci : true ,
164
160
} ) ;
165
161
self
166
162
}
@@ -174,6 +170,7 @@ impl GenericEventBuilder {
174
170
} else {
175
171
EventType :: Sensitive
176
172
} ,
173
+ send_in_ci : true ,
177
174
} ) ;
178
175
self
179
176
}
@@ -184,6 +181,8 @@ impl GenericEventBuilder {
184
181
key : "ci" . to_string ( ) ,
185
182
value : ci. to_string ( ) ,
186
183
is_sensitive : EventType :: NonSensitive ,
184
+ // yo dawg
185
+ send_in_ci : true ,
187
186
} ) ;
188
187
}
189
188
self
@@ -194,6 +193,7 @@ impl GenericEventBuilder {
194
193
key : "run_type" . to_string ( ) ,
195
194
value : if is_dry { "dry" } else { "full" } . to_string ( ) ,
196
195
is_sensitive : EventType :: NonSensitive ,
196
+ send_in_ci : true ,
197
197
} ) ;
198
198
self
199
199
}
@@ -208,6 +208,7 @@ impl GenericEventBuilder {
208
208
DaemonInitStatus :: Disabled => "disabled" . to_string ( ) ,
209
209
} ,
210
210
is_sensitive : EventType :: NonSensitive ,
211
+ send_in_ci : false ,
211
212
} ) ;
212
213
self
213
214
}
@@ -218,6 +219,7 @@ impl GenericEventBuilder {
218
219
key : "error" . to_string ( ) ,
219
220
value : error. to_string ( ) ,
220
221
is_sensitive : EventType :: NonSensitive ,
222
+ send_in_ci : true ,
221
223
} ) ;
222
224
self
223
225
}
0 commit comments