Skip to main content

Data Retention Application

The Data Retention application in Collate automates the cleanup of the internal database to maintain long-term performance and prevent data bloat. It provides administrators with an efficient mechanism to define retention policies for event-related records, ensuring scalability and compliance with data management practices.

Overview

As Collate processes events related to metadata changes and pipeline executions, it stores these events in internal tables. Over time, these tables can grow significantly and affect system performance. The Data Retention application enables automated and scheduled cleanup of outdated records. Beyond routine housekeeping, the app also repairs data integrity issues that build up over time. When a parent entity (for example, a database or a test suite) is deleted, some child records can be left behind without a valid reference back to a live entity. This includes relationships, tags, and test cases. The Data Retention application finds and removes this orphaned, stale data so it doesn’t accumulate or surface in search and lineage.

Key Features

  • Automated cleanup of outdated internal records.
  • Removes orphaned relationships, tags, and test cases left behind when a parent entity is deleted.
  • Configurable retention periods for different data categories.
  • Helps maintain system performance and database efficiency.
  • Supports compliance with organizational data retention policies.

Cleanup Targets

The app deletes old or orphaned records from these key internal tables:
  • change_event: Stores metadata change event logs, cleaned up based on retention period.
  • entity_relationship: Stores relationships between entities (containment, ownership, lineage, tests). Orphaned rows removed when a parent entity is deleted.
  • tag_usage: Tag assignments on entities. Orphaned entries removed when the tagged entity no longer exists.
  • test_case: Data quality test cases. Orphaned entries removed when their parent test suite or linked entity is deleted.
  • data_quality_data_time_series: Historical test case results, cleaned up based on retention period.
  • audit_log_event: System audit log entries, cleaned up based on retention period.
  • ai_agent_trace_run / ai_agent_trace_event: Stores AI agent debug traces (prompts, tool calls, and results) captured for troubleshooting, cleaned up based on retention period.
The app does not remove soft-deleted assets. For more information, see Soft-Deleted Assets.

Implementation Details

  • Schedule: Runs weekly by default.
  • Cron: 0 0 * * 0 (every Sunday at midnight).
  • Batch Processing: Cleans up records in batches of 10,000.
  • Triggering: Can be executed manually or allowed to run on schedule.
  • Application Class: org.openmetadata.service.apps.bundles.dataRetention.DataRetention
  • Permission Requirement: Requires admin privileges to configure or trigger.

Install Data Retention Application

Data Retention is installed by default and runs weekly on Sundays at midnight. Follow these steps only if the application was uninstalled.
  1. Click the Profile icon and navigate to Settings > Applications.
  2. Click Browse Apps.
  3. Select the Data Retention application and install it.
  4. Configure the following retention periods in days:
    • Change Event Retention Period: The number of days to retain change event records. Default value is 7.
    • Activity Threads Retention Period: The number of days to retain activity feed records. Default value is 60.
    • Activity Comments Retention Period: The number of days to retain comments on activity events. Default value is 0, which retains them forever.
    • Test Case Results Retention Period: The number of days to retain test case results. Default value is 1440.
    • Profile Data Retention Period: The number of days to retain column and table profiling data. Default value is 1440.
    • Audit Log Retention Period: The number of days to retain audit log entries. Default value is 90.
    • Governance Workflow Run History Retention Period (days): The number of days to retain the run history of governance workflows. Default value is 30. Enter 0 to retain the history forever.
    Tip: The retention period is applied to each cleanup target based on its timestamp.
    Data Retention configuration showing the Change Event, Activity Threads, Activity Comments, Test Case Results, and Profile Data retention periods Data Retention configuration showing the Audit Log, Automation Workflow, and Governance Workflow Run History retention periods and the Extension Retention Periods section
  5. Schedule or select On Demand to run the application manually. Data Retention schedule set to run weekly on Sunday at 12:00 AM

Governance Workflow Run History Retention

Governance workflows record every run and its stages. The Data Retention application deletes old runs based on a retention period that you set.
  1. Open the Configuration tab of the Data Retention application. For the steps, see steps 1 and 2 of Configure Governance Workflow Run History Retention.
  2. Scroll to Governance Workflow Run History Retention Period (days) and set the retention period:
    • Enter a positive integer to delete finished governance workflow runs older than that many days. The default is 30.
    • Enter 0 to retain the run history forever.
    Data Retention configuration showing the Audit Log, Automation Workflow, and Governance Workflow Run History retention periods
  3. Click Save.
Important: Deleting expired run history is irreversible. Enter 0 to retain the history forever.
The application deletes a run, with all its stages, only when all of these are true:
  • The run has ended, with any status other than Running.
  • The run started before the retention cutoff. Collate keeps every run inside the retention period.
  • A newer run of the same workflow exists for the same entity. Each entity keeps its latest run of each workflow, however old it is. Runs that have no entity are grouped per workflow, so the newest of those is kept too.

Configure AI Agent Debug Trace Retention

Collate keeps AI agent debug traces (the prompts, tool calls, and results captured for troubleshooting) for 3 days by default. You need administrator access to change this period. Install the Data Retention application first, as described in Install Data Retention Application.
  1. Click the Profile icon and navigate to Settings > Applications > Data Retention.
  2. Click Configuration.
  3. Under Extension Retention Periods (Days) > Additional Properties, click the Add (+) icon.
  4. Replace newKey with aiAgentTrace and enter the number of days to keep traces. Data Retention configuration showing Extension Retention Periods additional properties
  5. Click Save.
Important: Traces include the prompts and query results of each agent run, so keep this period as short as your troubleshooting needs allow. The next Data Retention run permanently deletes traces older than the period.

Configure Governance Workflow Run History Retention

You need administrator access to configure and run the Data Retention application.
  1. Click the Profile icon and navigate to Settings > Applications > Data Retention. Applications page with the Data Retention application highlighted
  2. Click Configuration. Data Retention application with the Configuration tab highlighted
  3. Scroll to Governance Workflow Run History Retention Period (days).
  4. Set the retention period:
    • Enter a positive integer to delete completed governance workflow runs older than that many days.
    • Enter 0 to retain the full governance workflow run history indefinitely.
    Data Retention configuration showing the Audit Log, Automation Workflow, and Governance Workflow Run History retention periods
  5. Save the configuration.
  6. Return to the Data Retention application details.
  7. Optional: To apply the policy without waiting for the next scheduled run, select Run Now.
The default retention period is 30 days. Cleanup removes completed runs older than the configured period. It preserves active runs and the latest run of each workflow for each asset.
Important: Deleting expired governance workflow run history is irreversible. This setting defaults to 30 days even for an application configuration saved before the field existed. After an upgrade, the next scheduled Data Retention run can therefore remove completed runs older than 30 days. Set the value to 0 before that run if you must retain the full history.
Removing run-history records does not delete the workflow definition or its assets.
Note: One application run deletes at most 100,000 governance workflow run-history records. Run the application again when an older installation has a larger backlog.

Soft-Deleted Assets

When you set up a metadata agent, the Mark Deleted toggles are in the Agent Setup or Scope & Behaviour step, depending on the connector type. For database connectors, Mark Deleted Tables, Mark Deleted Schemas, and Mark Deleted Databases are in Scope & Behaviour. When a toggle is on, the agent soft-deletes that kind of asset if it no longer exists in the source. Related items, such as test suites and lineage, are also deleted. For more information on the metadata agent options, see How to Ingest Metadata. When a toggle is off, the agent does not check for assets of that kind that were removed from the source. An asset that you delete from the source stays active in Collate, and its lineage and test suites stay as they are. To clean it up later, turn the toggle on and run the agent again. A soft-deleted asset is hidden from normal views. You can restore it, and its history is kept. The Data Retention application does not permanently delete soft-deleted assets, and it has no retention period for them. No metadata agent setting turns a soft delete into a permanent delete. To remove a soft-deleted asset for good, delete it permanently yourself. For more information, see Permanently Delete a Soft-Deleted Data Asset. To bring a data asset back, see Restore a Data Asset. For service connections, see Delete and Restore Service Connections.