in glean/src/core/pings/maker.ts [76:106]
function getStartTimeMetricAndData(ping: CommonPingData): StartTimeMetricData {
const startTimeMetric = new DatetimeMetricType(
{
category: "",
name: `${ping.name}#start`,
sendInPings: [PING_INFO_STORAGE],
lifetime: Lifetime.User,
disabled: false
},
TimeUnit.Minute
);
// "startTime" is the time the ping was generated the last time.
// If not available, we use the date the Glean object was initialized.
const startTimeData = Context.metricsDatabase.getMetric(
PING_INFO_STORAGE,
startTimeMetric
);
let startTime: DatetimeMetric;
if (startTimeData) {
startTime = new DatetimeMetric(startTimeData);
} else {
startTime = DatetimeMetric.fromDate(Context.startTime, TimeUnit.Minute);
}
return {
startTimeMetric,
startTime
};
}