The Glean SDK stores all recorded data in a database for persistence. This data is read, written and transformed by the core implementation.
Some internal metrics are stored similar to user-defined metrics, but encode additional implementation-defined information in the key or value of the entry.
We guarantee backwards-compatibility of already stored data. If necessary an old database will be converted to the new format.
The Glean SDK will use one store per metric lifetime:
This allows to separately read and clear metrics based on their respective lifetimes.
The key of a database entry uniquely identifies the stored metric data. It encodes additional information about the stored data in the key name using special characters. The full list of special characters in use is:
. # / +
These characters cannot be used in a user-defined ping name, metric category, metric name or label.
A key will usually look like:
|Field||Description||Allowed characters||Maximum length*||Note|
|The ping name this data is stored for||30|
|The metric's category||40||Empty string possible.|
|The metric's name||30|
|The label (optional)||71|
* The maximum length is not enforced for internal metrics, but is enforced for user metrics as per schema definition.
Glean.js uses a different format to store data. Additional information is encoded into database keys, using the
+(plus) character to separate parts of data. Watch Bug 1720476 for details.
The value is stored in an implementation-defined format to encode the value's data. It can be read, modified and serialized into the Payload format.