File tree Expand file tree Collapse file tree 4 files changed +57
-10
lines changed Expand file tree Collapse file tree 4 files changed +57
-10
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,6 @@ npm run build:qt
1919pip install -r requirements.txt
2020```
2121
22- 3 . Generate metrics and pings files.
23-
24- ``` bash
25- glean_parser translate metrics.yaml pings.yaml -f javascript -o generated
26- ```
27-
28224 . Run the application.
2923
3024``` bash
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ import QtGraphicalEffects 1.15
88
99import "../../glean/dist/glean.js" as Glean ;
1010// These must be imported after Glean because they rely on Glean being in the environment.
11- import "./generated/ pings.js" as Pings ;
12- import "./generated/ sample.js" as Metrics ;
11+ import "./pings.js" as Pings ;
12+ import "./sample.js" as Metrics ;
1313
1414Rectangle {
1515 id: screen
@@ -42,7 +42,7 @@ Rectangle {
4242 font .bold : true
4343 onClicked : () => {
4444 screen .displayText = 1 ;
45- Pings .pings . custom .submit ();
45+ Pings .custom .submit ();
4646 }
4747 }
4848
@@ -67,7 +67,7 @@ Rectangle {
6767 Component .onCompleted : {
6868 // Initialize Glean.
6969 Glean .Glean .default .initialize (" qt-qml-app" , true , { debug: { logPings: true }});
70- Metrics .sample . appStarted .set ();
70+ Metrics .appStarted .set ();
7171 // !IMPORTANT!
7272 // If this message is changed the check in bin/qt-js-check **must** be updated.
7373 console .log (" Initialized Glean succesfully." );
Original file line number Diff line number Diff line change 1+ /* eslint-disable */
2+
3+ /* This Source Code Form is subject to the terms of the Mozilla Public
4+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6+
7+ "use strict" ;
8+
9+ /**
10+ * A custom ping to help showcase Glean.js.
11+ * It is sent everytime the user clicks the "Submit ping" button
12+ * on this sample app.
13+ *
14+ * Generated from `custom`.
15+ */
16+ const custom = new Glean . Glean . default . _private . PingType ( {
17+ includeClientId : true ,
18+ sendIfEmpty : false ,
19+ name : "custom" ,
20+ reasonCodes : [ ] ,
21+ } , ) ;
Original file line number Diff line number Diff line change 1+ /* eslint-disable */
2+
3+ /* This Source Code Form is subject to the terms of the Mozilla Public
4+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6+
7+ "use strict" ;
8+
9+ /**
10+ * The time the sample app was started.
11+ *
12+ * Generated from `sample.app_started`.
13+ */
14+ const appStarted = new Glean . Glean . default . _private . DatetimeMetricType ( {
15+ category : "sample" ,
16+ name : "app_started" ,
17+ sendInPings : [ "custom" ] ,
18+ lifetime : "ping" ,
19+ disabled : false ,
20+ } , "millisecond" ) ;
21+ /**
22+ * The number of time the "Record" button was clicked.
23+ *
24+ * Generated from `sample.button_clicked`.
25+ */
26+ const buttonClicked = new Glean . Glean . default . _private . CounterMetricType ( {
27+ category : "sample" ,
28+ name : "button_clicked" ,
29+ sendInPings : [ "custom" ] ,
30+ lifetime : "ping" ,
31+ disabled : false ,
32+ } , ) ;
You can’t perform that action at this time.
0 commit comments