Skip to content

Added log statement for number of successful ingestions#15

Open
choukit wants to merge 1 commit intoaws:mainfrom
choukit:main
Open

Added log statement for number of successful ingestions#15
choukit wants to merge 1 commit intoaws:mainfrom
choukit:main

Conversation

@choukit
Copy link
Copy Markdown
Contributor

@choukit choukit commented Apr 3, 2023

This change adds a counter and log statement for the number of records successfully ingested through online streaming ingestion

Description of changes:
Introduced a long accumulator for counting the total number of rows in the spark dataframe and subtracted the number of failed rows to log the successfully ingested rows

Testing done:
Verified through unit tests that the number of successful records are correctly logged

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the CONTRIBUTING doc
  • I certify that the changes I am introducing will be backword compatible
  • I used the commit message format described in CONTRIBUTING doc

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • I have verified all code in this commit are well formatted

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Added log statement for number of successful ingestions

This change adds a counter and log statement for the number of records successfully ingested through online streaming ingestion
): Iterator[Row] = {
val newPartition = partition.map(row => {
// Increment the row counter value
dataFrameSizeCounter.add(1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accumulator is not reliable if it is not inside of an action. For our use case, the counter is added to map.

https://stackoverflow.com/questions/29494452/when-are-accumulators-truly-reliable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it viable to seek more reliable way instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants