-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(analytics): add options for configuring pinpoint event buffer
- Loading branch information
Di Wu
committed
Nov 6, 2023
1 parent
7b514bb
commit d2b1d90
Showing
14 changed files
with
121 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { AWSCredentials } from '../../../libraryUtils'; | ||
import { getEventBuffer } from '../utils/getEventBuffer'; | ||
import { EventBufferConfig } from '../types/buffer'; | ||
import { AuthSession } from '../../../singleton/Auth/types'; | ||
import { | ||
BUFFER_SIZE, | ||
FLUSH_INTERVAL, | ||
FLUSH_SIZE, | ||
RESEND_LIMIT, | ||
} from '../utils/constants'; | ||
|
||
export const flushEvents = ( | ||
appId: string, | ||
region: string, | ||
credentials: AWSCredentials, | ||
identityId?: string, | ||
userAgentValue?: string | ||
) => { | ||
export type PinpointFlushEventsInput = Partial<EventBufferConfig> & { | ||
appId: string; | ||
region: string; | ||
credentials: Required<AuthSession>['credentials']; | ||
identityId?: AuthSession['identityId']; | ||
userAgentValue?: string; | ||
}; | ||
|
||
export const flushEvents = ({ | ||
appId, | ||
region, | ||
credentials, | ||
bufferSize, | ||
flushInterval, | ||
flushSize, | ||
resendLimit, | ||
identityId, | ||
userAgentValue, | ||
}: PinpointFlushEventsInput) => { | ||
getEventBuffer({ | ||
appId, | ||
bufferSize: BUFFER_SIZE, | ||
region, | ||
credentials, | ||
flushInterval: FLUSH_INTERVAL, | ||
flushSize: FLUSH_SIZE, | ||
bufferSize: bufferSize ?? BUFFER_SIZE, | ||
flushInterval: flushInterval ?? FLUSH_INTERVAL, | ||
flushSize: flushSize ?? FLUSH_SIZE, | ||
resendLimit: resendLimit ?? RESEND_LIMIT, | ||
identityId, | ||
region, | ||
resendLimit: RESEND_LIMIT, | ||
userAgentValue, | ||
}).flushAll(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters