Skip to content

Commit

Permalink
Always report the first 5 flags
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyBitz committed May 22, 2024
1 parent 469a282 commit ee15276
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/web/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ interface RequestContext {
};
}

const MAX_FLAG_KEYS = 5;

const symbol = Symbol.for('@vercel/request-context');
const logPrefix = '[Vercel Web Analytics]';

Expand Down Expand Up @@ -115,6 +113,14 @@ export async function track(
});

// Only report the first MAX_FLAG_KEYS flags
keys.forEach((key) => {
flagValuesToReport[key] = allFlagValues[key];
});
} else {
// If no `options.flags` was provided, we'll take the first 5 flags
// from the `allFlagValues` list and report them.
const MAX_FLAG_KEYS = 5;
const keys = Object.keys(allFlagValues);
keys.slice(0, MAX_FLAG_KEYS).forEach((key) => {
flagValuesToReport[key] = allFlagValues[key];
});
Expand Down

0 comments on commit ee15276

Please sign in to comment.