Skip to content

fix: restore pre-#12543 metric names - #19504

Open
danny0405 wants to merge 1 commit into
apache:masterfrom
danny0405:fix-metrics
Open

fix: restore pre-#12543 metric names#19504
danny0405 wants to merge 1 commit into
apache:masterfrom
danny0405:fix-metrics

Conversation

@danny0405

Copy link
Copy Markdown
Contributor

Describe the issue this Pull Request addresses

PR #12543 reordered the components used to construct several metric names. Although it was marked as a minor change, it changed existing timer and counter names in Hudi 1.x, breaking dashboards and alerts carried forward from 0.x. Compaction counters also gained a duplicated compaction.compaction segment.

This PR restores the pre-#12543 names for metrics that already had a compatibility contract while preserving the naming of metrics added after #12543.

Summary and Changelog

  • Restore type-first timer and counter names in HoodieMetrics, including compaction and conflict-resolution counters.
  • Restore legacy timer and counter names in HoodieMetaSyncMetrics and legacy timer names in HoodieStreamerMetrics.
  • Preserve action-first names for metrics added after [MINOR] Modify constants name and adjust getMetricsName function parameter po… #12543.
  • Add literal regression assertions for prefixed and unprefixed metric names and update the compactor metric assertion.
  • No code was copied.

Impact

Restores 0.x-compatible names such as timer.commit, counter.compaction.requested, and counter.conflict_resolution.success. Dashboards and alerts using the pre-#12543 names work across the 1.x upgrade. Consumers that adopted the post-#12543 names for these existing metrics will need to switch back to the legacy names.

There are no public API, configuration, storage-format, or performance changes. Metrics introduced after #12543 retain their current names.

Risk Level

medium

The change intentionally alters emitted names for the affected pre-existing metrics. The compatibility boundary is covered by literal name assertions with and without prefixes, and by the following focused test suites:

  • TestHoodieMetrics (25 tests)
  • TestHoodieMetaSyncMetrics (3 tests)
  • TestHoodieStreamerMetrics (7 tests)
  • TestHoodieCompactor (11 tests)

Documentation Update

none. This restores the established metric naming contract and does not introduce a feature, configuration, or new metric.

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@hudi-agent hudi-agent 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.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR reverts the metric-name reordering introduced by #12543, restoring the pre-#12543 (type-first) timer and counter names in HoodieMetrics, HoodieMetaSyncMetrics, and HoodieStreamerMetrics while preserving the naming of metrics added afterward. I traced each restored name against the constant values and the original #12543 diff, and the revert is faithful and well-covered by literal-name assertions. One cross-release compatibility note is worth a look in the inline comment. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here. One small naming nit in HoodieMetaSyncMetrics — otherwise the changes look clean and well-commented.

this.conflictResolutionTimerName = getMetricsName(CONFLICT_RESOLUTION_STR, TIMER_METRIC);
this.conflictResolutionSuccessCounterName = getMetricsName(CONFLICT_RESOLUTION_STR, SUCCESS_COUNTER);
this.conflictResolutionFailureCounterName = getMetricsName(CONFLICT_RESOLUTION_STR, FAILURE_COUNTER);
// Keep the names of metrics that predate #12543 stable for dashboard and alert compatibility.

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.

🤖 Since released 1.x versions already shipped the #12543 (action-first) names, this restoration effectively re-changes these metric names a second time, so dashboards built against the interim 1.x names will break. The description lists "Documentation Update: none" — would it be worth a short release/upgrade note so users on those 1.x versions know to switch back to the legacy names?

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.


private static final String TIMER_METRIC_EXTENSION = ".timer";
private static final String COUNTER_METRIC_EXTENSION = ".counter";
private static final String TIMER_ACTION = "timer";

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.

🤖 nit: TIMER_ACTION and COUNTER_ACTION might be slightly confusing here since "action" in Hudi conventionally refers to timeline actions (commit, rollback, …). Could you rename them to something like TIMER_METRIC_TYPE / COUNTER_METRIC_TYPE or TIMER_PREFIX / COUNTER_PREFIX to avoid the vocabulary collision?

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.

@github-actions github-actions Bot added the size:M PR with lines of changes in (100, 300] label Aug 4, 2026
@yihua yihua self-assigned this Aug 4, 2026
@hudi-bot

hudi-bot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

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

Labels

size:M PR with lines of changes in (100, 300]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants