@@ -96,12 +96,6 @@ export function sendMetricsEvent(
9696 event : EventNames ,
9797 options : MetricsConfigOptions
9898) : Promise < void > ;
99- /**
100- * Send a metrics event to Cloudflare, if usage tracking is enabled.
101- *
102- * Generally you should pass the `send_metrics` property from the wrangler.toml config here,
103- * which would override any user permissions.
104- */
10599export function sendMetricsEvent (
106100 event : EventNames ,
107101 properties : Properties ,
@@ -122,30 +116,47 @@ export async function sendMetricsEvent(
122116}
123117
124118export type CommonEventProperties = {
125- /** The version of the wrangler client that is sending the event. */
119+ /** The version of the Wrangler client that is sending the event. */
126120 wranglerVersion : string ;
127121 /**
128- * The platform that the wrangler client is running on.
122+ * The platform that the Wrangler client is running on.
129123 */
130124 osPlatform : string ;
125+ /**
126+ * The platform version that the Wrangler client is running on.
127+ */
131128 osVersion : string ;
132129 /**
133- * The package manager that the wrangler client is using.
130+ * The package manager that the Wrangler client is using.
134131 */
135132 packageManager : string | undefined ;
133+ /**
134+ * The version of node that the Wrangler client is running on.
135+ */
136136 nodeVersion : string ;
137137 /**
138138 * Whether this is the first time the user has used the wrangler client.
139139 */
140140 isFirstUsage : boolean ;
141141 /**
142- * What format is the configuration file?
142+ * What format is the configuration file? No content from the actual configuration file is sent.
143143 */
144144 configFileType : "toml" | "json" | "jsonc" | "none" | "invalid" ;
145-
145+ /**
146+ * Randomly generated id to tie together started, completed or errored events from one command run
147+ */
146148 amplitude_session_id : number ;
149+ /**
150+ * Tracks the order of events in a session (one command run = one session)
151+ */
147152 amplitude_event_id : number ;
153+ /**
154+ * Whether the Wrangler client is running in CI
155+ */
148156 isCI : boolean ;
157+ /**
158+ * Whether the Wrangler client is running in an interactive instance
159+ */
149160 isInteractive : boolean ;
150161 /**
151162 * A list of normalised argument names/flags that were passed in or are set by default.
@@ -158,19 +169,37 @@ export type CommonEventProperties = {
158169 argsCombination : string ;
159170} ;
160171
172+ /** We send a metrics event at the start and end of a command run */
161173export type Events =
162174 | {
163175 name : "wrangler command started" ;
164176 properties : CommonEventProperties & {
177+ /**
178+ * The command that was used, e.g. `wrangler dev`
179+ */
165180 command : string ;
181+ /**
182+ * The args and flags that were passed in when running the command.
183+ * All user-inputted string values are redacted, except for some cases where there are set options.
184+ */
166185 args : Record < string , unknown > ;
167186 } ;
168187 }
169188 | {
170189 name : "wrangler command completed" ;
171190 properties : CommonEventProperties & {
191+ /**
192+ * The command that was used, e.g. `wrangler dev`
193+ */
172194 command : string | undefined ;
195+ /**
196+ * The args and flags that were passed in when running the command.
197+ * All user-inputted string values are redacted, except for some cases where there are set options.
198+ */
173199 args : Record < string , unknown > | undefined ;
200+ /**
201+ * The time elapsed between the "wrangler command started" and "wrangler command completed" events
202+ */
174203 durationMs : number ;
175204 durationMinutes : number ;
176205 durationSeconds : number ;
@@ -179,11 +208,24 @@ export type Events =
179208 | {
180209 name : "wrangler command errored" ;
181210 properties : CommonEventProperties & {
211+ /**
212+ * The command that was used, e.g. `wrangler dev`
213+ */
182214 command : string | undefined ;
215+ /**
216+ * The args and flags that were passed in when running the command.
217+ * All user-inputted string values are redacted, except for some cases where there are set options.
218+ */
183219 args : Record < string , unknown > | undefined ;
220+ /**
221+ * The time elapsed between the "wrangler command started" and "wrangler command errored" events
222+ */
184223 durationMs : number ;
185224 durationMinutes : number ;
186225 durationSeconds : number ;
226+ /**
227+ * Type of error, e.g. UserError, APIError. Does not include stack trace or error message.
228+ */
187229 errorType : string | undefined ;
188230 } ;
189231 } ;
0 commit comments