Skip to content

Fixes #37526: Share the web analytic event type hashes - #37563

Merged
manerow merged 1 commit into
mainfrom
chore/web-analytic-event-type-hashes
Nov 11, 2026
Merged

manerow merged 1 commit into
mainfrom
chore/web-analytic-event-type-hashes

Conversation

@manerow

@manerow manerow commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #37526

Follow-up to #37527. Web analytic event rows in entity_extension_time_series are keyed by the hash of their event type (PageView, CustomEvent). WebAnalyticEventRepository computed that hash inline in three places, and code that reads these rows with SQL had to compute it again on its own.

This PR adds two public helpers to WebAnalyticEventRepository:

  • eventTypeHash(String eventType): the hash a row of that event type is stored under.
  • eventTypeHashes(): the hashes of every event type.

The repository's three listing methods now use eventTypeHash, so readers inside and outside the repository share one definition instead of copying it.

Nothing changes in what is stored or read: the helper calls the same FullyQualifiedName.buildHash the @BindFQN binder uses when the rows are written.

Type of change:

  • Improvement

High-level design:

N/A, small change.

Tests:

Use cases covered

  • The hash of each event type matches the value existing rows are stored under.
  • eventTypeHashes() covers every event type.

Unit tests

  • New WebAnalyticEventRepositoryTest pins the stored hashes of PageView and CustomEvent. If the hashing ever changes, this test fails, because existing rows would no longer be found.

Backend integration tests

  • Not applicable (no backend API changes).

Ran WebAnalyticEventRepositoryTest (2 passed) and PaginatedWebAnalyticEventDataSourceReadFailureTest (2 passed) locally. WebAnalyticEventResourceIT runs in the merge queue.

Manual testing performed

  • Built openmetadata-service with this change and ran the downstream telemetry reader's tests against it, including its MySQL and Postgres Testcontainers test.

UI screen recording:

Not applicable: backend-only change.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    Self-review at be3d178: two static helpers and three call sites switched to them, no findings.
  • Decision check: no durable decision; the stored hash is unchanged.

@manerow
manerow requested a review from a team as a code owner November 11, 2026 11:02
@manerow
manerow requested a review from harshach November 11, 2026 11:02
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

Comment on lines +29 to +38
// Event data rows are stored with the event type as their FQN, hashed the way @BindFQN hashes it.
public static String eventTypeHash(String eventType) {
return FullyQualifiedName.buildHash(eventType);
}

public static List<String> eventTypeHashes() {
return Arrays.stream(WebAnalyticEventType.values())
.map(eventType -> eventTypeHash(eventType.value()))
.toList();
}

@gitar-bot gitar-bot Bot Nov 11, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Quality: Event-type hash is now a cross-repo contract with no decision record

This PR turns the storage key of web analytic event rows into a public contract. eventTypeHash/eventTypeHashes are public static, and the description says they exist so that code reading entity_extension_time_series with SQL, including the downstream telemetry reader tested in another repo, uses the same value instead of computing it again ("readers inside and outside the repository share one definition"). That is a derived hash format another component has to agree with. No record in docs/decisions/ covers it. The checklist's "no durable decision; the stored hash is unchanged" is true about storage, but the change is that the hash is now promised to outside readers, and that promise only lives in the PR body, which a squash merge drops.

The record would say: Web analytic event data rows in entity_extension_time_series are keyed by FullyQualifiedName.buildHash(eventType), the MD5 of the quoted event-type value (e.g. PageView → 36c3c341bdf7ed4b36652d62d5cb14d7). Readers outside WebAnalyticEventRepository get it from eventTypeHash/eventTypeHashes, and changing it requires a data migration plus a coordinated change in downstream readers. WebAnalyticEventRepositoryTest can be named as its Guard. Cite it as ADR:<date>-<slug> in the comment above eventTypeHash.

Add docs/decisions/2026-11-11-web-analytic-event-rows-are-keyed-by-the-event-type-hash.md and cite it from the helper.:

// ADR:2026-11-11-web-analytic-event-rows-are-keyed-by-the-event-type-hash
// Event data rows are stored with the event type as their FQN, hashed the way @BindFQN hashes it.
public static String eventTypeHash(String eventType) {
  return FullyQualifiedName.buildHash(eventType);
}

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 🟢 Low risk 0 closed / 1 findings

The shared helpers reuse the existing hash calculation in three queries, preserving event-row keys and limiting impact to a narrow refactor.

Adds public static helpers eventTypeHash and eventTypeHashes to WebAnalyticEventRepository so the stored event-type hash is defined in one place and shared with outside readers, with no change to what is stored. Changes are requested because the hash is now a cross-repo contract with no decision record. Add an ADR in docs/decisions/ documenting the FullyQualifiedName.buildHash key format and its guard test, and cite it in the comment above eventTypeHash.

⚠️ Quality: Event-type hash is now a cross-repo contract with no decision record

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepository.java:29-38 📄 openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepositoryTest.java:10-12

This PR turns the storage key of web analytic event rows into a public contract. eventTypeHash/eventTypeHashes are public static, and the description says they exist so that code reading entity_extension_time_series with SQL, including the downstream telemetry reader tested in another repo, uses the same value instead of computing it again ("readers inside and outside the repository share one definition"). That is a derived hash format another component has to agree with. No record in docs/decisions/ covers it. The checklist's "no durable decision; the stored hash is unchanged" is true about storage, but the change is that the hash is now promised to outside readers, and that promise only lives in the PR body, which a squash merge drops.

The record would say: Web analytic event data rows in entity_extension_time_series are keyed by FullyQualifiedName.buildHash(eventType), the MD5 of the quoted event-type value (e.g. PageView → 36c3c341bdf7ed4b36652d62d5cb14d7). Readers outside WebAnalyticEventRepository get it from eventTypeHash/eventTypeHashes, and changing it requires a data migration plus a coordinated change in downstream readers. WebAnalyticEventRepositoryTest can be named as its Guard. Cite it as ADR:<date>-<slug> in the comment above eventTypeHash.

Add docs/decisions/2026-11-11-web-analytic-event-rows-are-keyed-by-the-event-type-hash.md and cite it from the helper.
// ADR:2026-11-11-web-analytic-event-rows-are-keyed-by-the-event-type-hash
// Event data rows are stored with the event type as their FQN, hashed the way @BindFQN hashes it.
public static String eventTypeHash(String eventType) {
  return FullyQualifiedName.buildHash(eventType);
}
🤖 Prompt for agents
Code Review: Adds public static helpers `eventTypeHash` and `eventTypeHashes` to `WebAnalyticEventRepository` so the stored event-type hash is defined in one place and shared with outside readers, with no change to what is stored. Changes are requested because the hash is now a cross-repo contract with no decision record. Add an ADR in `docs/decisions/` documenting the `FullyQualifiedName.buildHash` key format and its guard test, and cite it in the comment above `eventTypeHash`.

1. ⚠️ Quality: Event-type hash is now a cross-repo contract with no decision record
   Files: openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepository.java:29-38, openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/WebAnalyticEventRepositoryTest.java:10-12

   This PR turns the storage key of web analytic event rows into a public contract. `eventTypeHash`/`eventTypeHashes` are `public static`, and the description says they exist so that code reading `entity_extension_time_series` with SQL, including the downstream telemetry reader tested in another repo, uses the same value instead of computing it again ("readers inside and outside the repository share one definition"). That is a derived hash format another component has to agree with. No record in `docs/decisions/` covers it. The checklist's "no durable decision; the stored hash is unchanged" is true about storage, but the change is that the hash is now promised to outside readers, and that promise only lives in the PR body, which a squash merge drops.
   
   The record would say: *Web analytic event data rows in `entity_extension_time_series` are keyed by `FullyQualifiedName.buildHash(eventType)`, the MD5 of the quoted event-type value (e.g. `PageView` → `36c3c341bdf7ed4b36652d62d5cb14d7`). Readers outside `WebAnalyticEventRepository` get it from `eventTypeHash`/`eventTypeHashes`, and changing it requires a data migration plus a coordinated change in downstream readers.* `WebAnalyticEventRepositoryTest` can be named as its Guard. Cite it as `ADR:<date>-<slug>` in the comment above `eventTypeHash`.

   Fix (Add docs/decisions/2026-11-11-web-analytic-event-rows-are-keyed-by-the-event-type-hash.md and cite it from the helper.):
   // ADR:2026-11-11-web-analytic-event-rows-are-keyed-by-the-event-type-hash
   // Event data rows are stored with the event type as their FQN, hashed the way @BindFQN hashes it.
   public static String eventTypeHash(String eventType) {
     return FullyQualifiedName.buildHash(eventType);
   }

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@manerow
manerow merged commit 4b056a6 into main Nov 11, 2026
63 of 64 checks passed
@manerow
manerow deleted the chore/web-analytic-event-type-hashes branch November 11, 2026 11:42
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.

Expose the storage key of web analytic event data

1 participant