Skip to content

Conversation

@anuunchin
Copy link
Contributor

This PR adds the following three custom metrics to the incremental transform:

  • unfiltered_items_count
  • unfiltered_batches_count
  • unique_hashes_count

Specifically, in the call dunder of the Incremental class.

Since it is the incremental wrapper is the step that is used when metrics are computed the custom_metrics property of the wrapper just returns the custom metrics from the incremental itself.

An appropriate test was added.

@anuunchin anuunchin self-assigned this Sep 23, 2025
@netlify
Copy link

netlify bot commented Sep 23, 2025

Deploy Preview for dlt-hub-docs canceled.

Name Link
🔨 Latest commit c55ce51
🔍 Latest deploy log https://app.netlify.com/projects/dlt-hub-docs/deploys/68d296ca3dd6840008500a3e

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 23, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
docs 7e6d35a Commit Preview URL

Branch Preview URL
Oct 02 2025, 08:04 AM

@anuunchin anuunchin requested a review from rudolfix September 23, 2025 12:40
@anuunchin anuunchin force-pushed the feat/3072-incremental-custom-metrics branch 2 times, most recently from a5ba867 to c55ce51 Compare September 23, 2025 12:47
Copy link
Collaborator

@rudolfix rudolfix left a comment

Choose a reason for hiding this comment

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

some changes needed

@anuunchin anuunchin force-pushed the feat/3072-incremental-custom-metrics branch 5 times, most recently from 080c70d to 3c12fe9 Compare September 25, 2025 17:10
@anuunchin anuunchin requested a review from rudolfix September 25, 2025 17:14

# 6. run with two new items as a single batch
load_id = _run_with_items([{"id": 6, "value": "6.1"}, {"id": 6, "value": "6.2"}], True)
_assert_custom_metrics(load_id, 5, 2, 3, 0, 2)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rudolfix my intuition here was to get 0 as the initial_unique_hashes_count, but since it's retrieved from the state it makes sense. However, if the boundary deduplication is off and unique hashes becomes 0, shouldn't this also reset the hash count in state ? 👀

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, it should see my comment above

Copy link
Collaborator

@rudolfix rudolfix left a comment

Choose a reason for hiding this comment

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

I changed the TypeVar for the metrics:

  • added default type so we are backward compatible if any user derives from ItemTransform
  • added type bound to Mapping

pls take a look at review comments. also two last test cases are suspicious or I do not understand input arguments


# 6. run with two new items as a single batch
load_id = _run_with_items([{"id": 6, "value": "6.1"}, {"id": 6, "value": "6.2"}], True)
_assert_custom_metrics(load_id, 5, 2, 3, 0, 2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, it should see my comment above

@anuunchin anuunchin requested a review from rudolfix October 2, 2025 07:42
@anuunchin anuunchin force-pushed the feat/3072-incremental-custom-metrics branch from 128009c to 7e6d35a Compare October 2, 2025 07:56
Copy link
Collaborator

@rudolfix rudolfix left a comment

Choose a reason for hiding this comment

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

LGTM!

@anuunchin anuunchin merged commit 3b5a024 into devel Oct 2, 2025
131 of 135 checks passed
@anuunchin anuunchin deleted the feat/3072-incremental-custom-metrics branch October 2, 2025 11:06
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.

3 participants