Bug 1848331 - Add ability to configure precise event timestamps through Nimbus r=TravisLong

Differential Revision: https://phabricator.services.mozilla.com/D188325
This commit is contained in:
Jan-Erik Rediger 2023-09-20 09:21:07 +00:00
Родитель f4607b8cab
Коммит a34f27f365
3 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -155,12 +155,16 @@ fn build_configuration(
extern "C" {
fn FOG_MaxPingLimit() -> u32;
fn FOG_EventTimestampsEnabled() -> bool;
}
// SAFETY NOTE: Safe because it returns a primitive by value.
let pings_per_interval = unsafe { FOG_MaxPingLimit() };
metrics::fog::max_pings_per_minute.set(pings_per_interval.into());
// SAFETY NOTE: Safe because it returns a primitive by value.
let enable_event_timestamps = unsafe { FOG_EventTimestampsEnabled() };
let rate_limit = Some(glean::PingRateLimit {
seconds_per_interval: 60,
pings_per_interval,
@ -178,7 +182,7 @@ fn build_configuration(
trim_data_to_registered_pings: true,
log_level: None,
rate_limit,
enable_event_timestamps: false,
enable_event_timestamps,
};
Ok((configuration, client_info))

Просмотреть файл

@ -122,6 +122,13 @@ extern "C" uint32_t FOG_MaxPingLimit(void) {
"gleanMaxPingsPerMinute"_ns, 15);
}
// This allows us to pass whether to enable precise event timestamps to Rust.
// Default is false.
extern "C" bool FOG_EventTimestampsEnabled(void) {
return NimbusFeatures::GetBool("gleanInternalSdk"_ns,
"enableEventTimestamps"_ns, false);
}
NS_IMETHODIMP
FOG::InitializeFOG(const nsACString& aDataPathOverride,
const nsACString& aAppIdOverride) {

Просмотреть файл

@ -1161,6 +1161,9 @@ glean:
gleanInternalSdk:
description: "The Glean internal SDK feature intended only for internal Glean Team use"
hasExposure: false
# Some variables are used through the C++ API and thus require pref-storage.
# We rely on those values at Glean.init time, which happens at startup.
isEarlyStartup: true
variables:
finalInactive:
type: "boolean"
@ -1175,6 +1178,9 @@ gleanInternalSdk:
type: int
description: >-
Maximum number of pings that can be sent in a 60 second interval
enableEventTimestamps:
type: "boolean"
description: "Enables precise event timestamps for Glean events"
majorRelease2022:
description: Major Release 2022