Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1851698 - Update default maxEvents to 1 #1766

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[Full changelog](https://github.com/mozilla/glean.js/compare/v2.0.1...main)

* [#1755](https://github.com/mozilla/glean.js/pull/1755): Add sync check to `set` function for the URL metric.
* [#1766](https://github.com/mozilla/glean.js/pull/1766): Update default `maxEvents` count to 1. This means an events ping will be sent after each recorded event unless the `maxEvents` count is explicitly set to a larger number.

# v2.0.1 (2023-08-11)

Expand Down
6 changes: 3 additions & 3 deletions glean/src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { Context } from "./context.js";

const LOG_TAG = "core.Config";

// The default maximum number of events Glean will store before submitting the events ping.
// If the maximum is hit, the events ping is sent immediately.
const DEFAULT_MAX_EVENTS = 500;
// By default we want to send the events ping after every event is recorded. Unless the user
// explicitly sets a higher value, we will send the events ping after every event.
const DEFAULT_MAX_EVENTS = 1;

/**
* Lists Glean's debug options.
Expand Down
4 changes: 2 additions & 2 deletions glean/src/pings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ events:
from the previous application run in storage.
It is also sent when maximum capacity is hit
i.e. when a given number of events is in storage.
Maximum capacity defaults to 500,
Maximum capacity defaults to 1,
but may be changed through the `maxEvents` configuration option.
include_client_id: true
bugs:
Expand All @@ -56,7 +56,7 @@ events:
The events ping is always sent if there are any pending events at startup,
because event timestamps are not as reliable across application runs.
max_capacity: |
The maximum number of events was reached (default 500 events).
The maximum number of events was reached (default 1 event).
inactive: |
The ping was submitted when becoming inactive. In earlier versions, this
was called `background`.
Expand Down
6 changes: 5 additions & 1 deletion glean/tests/unit/core/metrics/events_database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ describe("EventsDatabase", function() {
// Restore timer APIs for WaitableUploader to work
clock.restore();

await testResetGlean(testAppId, true, { maxEvents: 500 });

const event = new EventMetricType({
category: "test",
name: "event",
Expand All @@ -780,6 +782,8 @@ describe("EventsDatabase", function() {
// Restore timer APIs for WaitableUploader to work
clock.restore();

await testResetGlean(testAppId, true, { maxEvents: 500 });

const previousRunEvent = new EventMetricType({
category: "test",
name: "previousRun",
Expand Down Expand Up @@ -809,7 +813,7 @@ describe("EventsDatabase", function() {
const httpClient = new WaitableUploader();
const waitForEventsPings = httpClient.waitForBatchPingSubmission(EVENTS_PING_NAME, 2);
// Initialization should trigger a startup ping
await testInitializeGlean(testAppId, true, { httpClient });
await testInitializeGlean(testAppId, true, { httpClient, maxEvents: 500 });
// Send another 'events' ping after init, it should contain the preInit events
await Context.corePings.events.submitUndispatched();

Expand Down