Skip to content

feat: output write statistics per transaction - #4620

Open
fbiville wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/emit_write_stats
Open

fbiville wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/emit_write_stats

Conversation

@fbiville

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Neo4j write pipeline by enabling the tracking and reporting of detailed write statistics per transaction. By capturing counters from the Neo4j driver's result summary, the pipeline now provides visibility into operations like nodes created, relationships modified, and properties set, which are emitted as structured data for downstream consumption.

Highlights

  • Write Statistics Tracking: Introduced a new WriteStats utility to capture and format Neo4j transaction result summaries into Beam Rows.
  • Transaction Output: Updated Neo4jBlockingUnwindFn to emit these write statistics as output for each processed transaction.
  • Schema Integration: Configured Neo4jRowWriterTransform to use the new WriteStats schema for its output PCollection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@fbiville fbiville added addition New feature or request and removed size/L labels Nov 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces write statistics reporting for Neo4j write transactions by returning an Optional containing metrics from the ResultSummary and emitting it to the pipeline. A new helper class WriteStats is added to define the schema and map the summary counters to Beam rows, and corresponding unit tests are updated. The review feedback highlights a critical Apache Beam anti-pattern: maintaining the mutable parameters list as an instance variable in DoFn. It is highly recommended to refactor this list into a local variable within processElement and pass it as a parameter to prevent potential data corruption or memory leaks during runner retries.

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.77%. Comparing base (2a90bcc) to head (7fe317e).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ort/v2/neo4j/transforms/Neo4jBlockingUnwindFn.java 87.50% 1 Missing ⚠️
...ogle/cloud/teleport/v2/neo4j/utils/WriteStats.java 97.50% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4620      +/-   ##
============================================
+ Coverage     59.75%   59.77%   +0.01%     
- Complexity     7926     7929       +3     
============================================
  Files          1123     1124       +1     
  Lines         72705    72746      +41     
  Branches       8842     8842              
============================================
+ Hits          43447    43485      +38     
- Misses        26362    26364       +2     
- Partials       2896     2897       +1     
Components Coverage Δ
spanner-templates 84.03% <ø> (ø)
spanner-import-export 72.73% <ø> (-0.02%) ⬇️
spanner-live-forward-migration 87.65% <ø> (ø)
spanner-live-reverse-replication 79.94% <ø> (ø)
spanner-bulk-migration 88.29% <ø> (ø)
gcs-spanner-dv 86.58% <ø> (ø)
Files with missing lines Coverage Δ
...t/v2/neo4j/transforms/Neo4jRowWriterTransform.java 84.12% <100.00%> (ø)
...ort/v2/neo4j/transforms/Neo4jBlockingUnwindFn.java 58.57% <87.50%> (+3.49%) ⬆️
...ogle/cloud/teleport/v2/neo4j/utils/WriteStats.java 97.50% <97.50%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nord-erik nord-erik left a comment

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.

lgtm

@fbiville

fbiville commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

CI failure is unrelated: BigtableToVectorEmbeddingsIT

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

Labels

addition New feature or request

2 participants