Open Bug 1720476 Opened 2 years ago Updated 10 months ago

Document how the Glean.js Store works as well as the platform specific store implementations

Categories

(Data Platform and Tools :: Glean: SDK, task, P4)

task

Tracking

(Not tracked)

People

(Reporter: brizental, Unassigned)

Details

(Whiteboard: [glean-sdk:backlog][glean-js][docdays])

No description provided.

Copying your explanation from the comment:


The + character used in Qt/QML is not to separate type information. It it not tied to any Glean specific context. Glean.js saves data in JSON format and it saves it more or less like it would be in the ping payload. In Qt/QML we use the + character to signal that we are going one step further in a (non-existent) JSON object.

An example will make this clearer I think, so take this hypothetical data stored in JSON format.
(This is exactly how we would store a user lifetime datetime metric in the webext storage.)

{
  "userLifetimeMetrics": {
    "my_ping": {
      "datetime": {
        "glean.start_time": {
          "timeUnit": "minute",
          "timezone": -60,
          "date": "2021-07-14T13:07:10.723Z"
        }
      }
    }
  }
}

In Qt/QML that will be stored its own table, so the userLifetimeMetrics index is ignored. Otherwise, this is how that same data would look on SQLite:

| key                                          | value                      |
| -------------------------------------------- | -------------------------- |
| "my_ping+datetime+glean.start_time+timeUnit" | "minute"                   |
| "my_ping+datetime+glean.start_time+timezone" | -60                        |
| "my_ping+datetime+glean.start_time+date"     | "2021-07-14T13:07:10.723Z" |

The Qt/QML store then transforms this into the same object as the JSON storage would, before returning. To make it opaque.

Whiteboard: [telemetry:glean-js:m?] → [telemetry:glean-js:backlog][docdays]
Component: Glean.js → Glean: SDK
Whiteboard: [telemetry:glean-js:backlog][docdays] → [glean-sdk:backlog][glean-js][docdays]
You need to log in before you can comment on or make changes to this bug.