-
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 (#1…
…2521) Co-authored-by: Jim Blanchard <[email protected]>
- Loading branch information
Showing
14 changed files
with
137 additions
and
65 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
Oops, something went wrong.