Skip to content

[GOBBLIN-2271] Add retention (deletion) counts to DatasetMetric in GaaSJobObservabilityEvent - #4209

Merged
Blazer-007 merged 1 commit into
apache:masterfrom
agam-99:GOBBLIN-retention-dataset-metrics
Oct 15, 2026
Merged

Blazer-007 merged 1 commit into
apache:masterfrom
agam-99:GOBBLIN-retention-dataset-metrics

Conversation

@agam-99

@agam-99 agam-99 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Dear Gobblin maintainers,

Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!

JIRA

Description

  • Here are some details about my PR, including screenshots (if applicable):

GaaSJobObservabilityEvent.datasetsMetrics[] (DatasetMetric) only models writes: bytesWritten, entitiesWritten, successfullyCommitted, dataQualityStatus, and, since GOBBLIN-2269, snapshotsCommitted / partitionsCommitted. Data-retention (deletion) jobs have no way to report per-dataset work through this channel. A job that removes aged-out dataset versions can already emit one datasetTaskSummaries entry per dataset root, but the deletion counts are dropped when GaaS parses them into DatasetTaskSummary.

This PR adds three optional, retention-only counts and threads them through. It follows the same pattern as GOBBLIN-2269 (#4206).

  • GaaSJobObservabilityEvent.avsc: DatasetMetric gains three fields, each ["null","long"] with default: null:

    • versionsTotal: versions considered under the dataset root (deletable + retained);
    • versionsDeleted: versions deleted, or on a dry run, those that would be;
    • directoriesPruned: now-empty parent directories pruned after the deletes.

    Because they are nullable with null defaults, the schema change is backward compatible, and every existing producer and consumer is unaffected.

  • DatasetTaskSummary: adds the three fields as nullable Long, intentionally not @NonNull. That keeps the 5-arg @RequiredArgsConstructor used by AbstractJobLauncher and CommitActivityImpl intact. The fields are populated by Gson during deserialization of events that carry them. toDatasetMetric maps them through, and they stay null for write jobs.

The first producer is the ddm-executor retention run (linkedin-multiproduct/ddm-executor#507). It emits one row per dataset root in a single JobSummaryTimer event, rather than one event per dataset, which would collide on the job-execution identity. Each row carries recordsWritten = bytesWritten = 0 plus these counts.

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

New DatasetTaskSummaryTest:

  • testToDatasetMetricMapsRetentionCountsFromJson: parses the exact JSON a retention run emits, via GsonUtils.GSON_WITH_DATE_HANDLING (the path GaaSJobObservabilityEventProducer uses), and asserts the counts reach DatasetMetric.

The existing GaaSJobObservabilityProducerTest still passes, so write-job datasetsMetrics are unchanged.

End-to-end check, done locally and not committed:

  • A real ddm-executor retention run (ddm-executor PRs Fixed build #506 + Unit tests for Gobblin Yarn part II #507) produced datasetTaskSummaries=[{"datasetUrn":"abfss://…","recordsWritten":0,"bytesWritten":0,"successfullyCommitted":true,"versionsTotal":3,"versionsDeleted":1,"directoriesPruned":1}].
  • That captured JSON, fed through GaaSJobObservabilityEventProducer on this branch, yields datasetsMetrics=[{…, versionsTotal:3, versionsDeleted:1, directoriesPruned:1}], and the values survive the AvroBinarySerializer round-trip.
  • On master, the same input is accepted and the three fields are dropped, which confirms that this change is what carries them.

Commits

  • My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

@agam-99 agam-99 changed the title [GOBBLIN-XXXX] Add retention (deletion) counts to DatasetMetric in GaaSJobObservabilityEvent [GOBBLIN-2271] Add retention (deletion) counts to DatasetMetric in GaaSJobObservabilityEvent Oct 13, 2026
@Blazer-007
Blazer-007 requested a balanced review from Copilot October 13, 2026 13:33

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open findings
What changed in this PR

Adds retention (deletion) counters to per-dataset observability metrics so data-retention jobs can report work (versions considered/deleted and directories pruned) through GaaSJobObservabilityEvent.datasetsMetrics[].

Changes:

  • Extend DatasetMetric Avro schema with nullable retention-only fields: versionsTotal, versionsDeleted, directoriesPruned
  • Thread the new fields through DatasetTaskSummary.toDatasetMetric(...)
  • Add unit tests validating JSON deserialization + mapping behavior for retention vs write jobs
File Description
gobblin-runtime/​src/​main/​java/​org/​apache/​gobblin/​runtime/​DatasetTaskSummary.java Maps new retention counters from DatasetTaskSummary into DatasetMetric
gobblin-runtime/​src/​test/​java/​org/​apache/​gobblin/​runtime/​DatasetTaskSummaryTest.java Adds tests for JSON->DatasetTaskSummary->DatasetMetric mapping and null behavior for write jobs
gobblin-metrics-libs/​gobblin-metrics-base/​src/​main/​avro/​GaaSJobObservabilityEvent.avsc Adds three backward-compatible nullable fields to DatasetMetric schema

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread gobblin-runtime/src/main/java/org/apache/gobblin/runtime/DatasetTaskSummary.java Outdated
@agam-99
agam-99 force-pushed the GOBBLIN-retention-dataset-metrics branch from 656c7b7 to 7d49191 Compare October 13, 2026 13:51
@agam-99
agam-99 force-pushed the GOBBLIN-retention-dataset-metrics branch from 7d49191 to d6cd8d9 Compare October 14, 2026 09:17
DatasetMetric (GaaSJobObservabilityEvent.datasetsMetrics) models only
writes, so a data-retention job cannot report per-dataset deletions:
the counts it puts in datasetTaskSummaries are dropped when GaaS parses
them into DatasetTaskSummary.

Add optional versionsTotal, versionsDeleted and directoriesPruned
(nullable long, default null) to DatasetMetric and DatasetTaskSummary,
and map them in toDatasetMetric. Existing producers and consumers are
unaffected; the 5-arg DatasetTaskSummary constructor is unchanged.
@agam-99
agam-99 force-pushed the GOBBLIN-retention-dataset-metrics branch from d6cd8d9 to 8af1788 Compare October 14, 2026 09:24
@Blazer-007
Blazer-007 merged commit 4e4ee82 into apache:master Oct 15, 2026
6 checks passed
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