Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

add task-runs to usage analytics (#68288)

Nicola Mometto2ac5ed4fb025
diff --git a/enterprise/backend/src/metabase_enterprise/audit_app/analytics_dev.clj b/enterprise/backend/src/metabase_enterprise/audit_app/analytics_dev.clj
index 91b9b6044c7..f89f09ab1db 100644
--- a/enterprise/backend/src/metabase_enterprise/audit_app/analytics_dev.clj
+++ b/enterprise/backend/src/metabase_enterprise/audit_app/analytics_dev.clj
@@ -211,6 +211,8 @@
(doseq [^File file (file-seq (io/file export-dir))
:when (and (.isFile file)
(.endsWith (.getName file) ".yaml")
+ (not (.endsWith (.getName file) "___fieldusersettings.yaml"))
+ (not (.contains (.getPath file) "/channels/"))
(or (not (.contains (.getPath file) "/databases/"))
(and (.contains (.getPath file) (str "/databases/" canonical-db-id))
(or (= (.getName file) (str canonical-db-id ".yaml"))
diff --git a/enterprise/backend/src/metabase_enterprise/audit_app/permissions.clj b/enterprise/backend/src/metabase_enterprise/audit_app/permissions.clj
index 386740f815c..8a2c2f22ace 100644
--- a/enterprise/backend/src/metabase_enterprise/audit_app/permissions.clj
+++ b/enterprise/backend/src/metabase_enterprise/audit_app/permissions.clj
@@ -27,6 +27,7 @@
"v_query_log"
"v_tables"
"v_tasks"
+ "v_task_runs"
"v_view_log"})
(defenterprise check-audit-db-permissions
diff --git a/enterprise/backend/test/metabase_enterprise/audit_app/analytics_dev_test.clj b/enterprise/backend/test/metabase_enterprise/audit_app/analytics_dev_test.clj
index 9b44387ad8d..0d2ec8948e6 100644
--- a/enterprise/backend/test/metabase_enterprise/audit_app/analytics_dev_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/audit_app/analytics_dev_test.clj
@@ -153,7 +153,11 @@
"estimated_row_count" "view_count" "owner_email" "owner_user_id"}
"v_tasks" #{"id" "task" "status" "database_qualified_id" "started_at"
- "ended_at" "duration_seconds" "details"}
+ "ended_at" "duration_seconds" "details" "run_id" "logs"}
+
+ "v_task_runs" #{"id" "run_type" "entity_type" "entity_id" "entity_qualified_id"
+ "started_at" "ended_at" "duration_seconds" "status"
+ "process_uuid" "updated_at"}
"v_users" #{"user_id" "entity_qualified_id" "type" "email" "first_name"
"last_name" "full_name" "date_joined" "last_login" "updated_at"
diff --git a/resources/instance_analytics/collections/vG58R8k-QddHWA7_47umn_usage_analytics/cards/eiR5q0JEbDRy1-WnYIhm4_task_runs.yaml b/resources/instance_analytics/collections/vG58R8k-QddHWA7_47umn_usage_analytics/cards/eiR5q0JEbDRy1-WnYIhm4_task_runs.yaml
new file mode 100644
index 00000000000..05d1409d976
--- /dev/null
+++ b/resources/instance_analytics/collections/vG58R8k-QddHWA7_47umn_usage_analytics/cards/eiR5q0JEbDRy1-WnYIhm4_task_runs.yaml
@@ -0,0 +1,293 @@
+name: Task Runs
+description: Tracks job executions
+entity_id: eiR5q0JEbDRy1-WnYIhm4
+created_at: '2026-01-16T15:59:16.252913Z'
+creator_id: [email protected]
+display: table
+archived: false
+collection_id: vG58R8k-QddHWA7_47umn
+collection_preview: true
+collection_position: 20
+query_type: query
+database_id: Internal Metabase Database
+table_id: [Internal Metabase Database, public, v_task_runs]
+enable_embedding: false
+embedding_params: null
+made_public_by_id: null
+public_uuid: null
+parameters: []
+parameter_mappings: []
+dataset_query:
+ database: Internal Metabase Database
+ query:
+ order-by:
+ - - desc
+ - - field
+ - [Internal Metabase Database, public, v_task_runs, started_at]
+ - {base-type: type/DateTimeWithLocalTZ}
+ source-table: [Internal Metabase Database, public, v_task_runs]
+ type: query
+result_metadata:
+- active: true
+ base_type: type/Integer
+ database_type: int4
+ display_name: ID
+ effective_type: type/Integer
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, id]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, id]
+ name: id
+ position: 0
+ semantic_type: type/PK
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: id
+ lib/desired-column-alias: id
+ lib/original-display-name: ID
+ lib/original-name: id
+ lib/source: source/table-defaults
+ lib/source-column-alias: id
+ qp/implicit-field?: true
+- active: true
+ base_type: type/Text
+ database_type: varchar
+ display_name: Run Type
+ effective_type: type/Text
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, run_type]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, run_type]
+ name: run_type
+ position: 1
+ semantic_type: type/Category
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: run_type
+ lib/desired-column-alias: run_type
+ lib/original-display-name: Run Type
+ lib/original-name: run_type
+ lib/source: source/table-defaults
+ lib/source-column-alias: run_type
+ qp/implicit-field?: true
+- active: true
+ base_type: type/Text
+ database_type: varchar
+ display_name: Entity Type
+ effective_type: type/Text
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, entity_type]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, entity_type]
+ name: entity_type
+ position: 2
+ semantic_type: type/Category
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: entity_type
+ lib/desired-column-alias: entity_type
+ lib/original-display-name: Entity Type
+ lib/original-name: entity_type
+ lib/source: source/table-defaults
+ lib/source-column-alias: entity_type
+ qp/implicit-field?: true
+- active: true
+ base_type: type/Integer
+ database_type: int4
+ display_name: Entity ID
+ effective_type: type/Integer
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, entity_id]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, entity_id]
+ name: entity_id
+ position: 3
+ semantic_type: null
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: entity_id
+ lib/desired-column-alias: entity_id
+ lib/original-display-name: Entity ID
+ lib/original-name: entity_id
+ lib/source: source/table-defaults
+ lib/source-column-alias: entity_id
+ qp/implicit-field?: true
+- active: true
+ base_type: type/Text
+ database_type: text
+ display_name: Entity Qualified ID
+ effective_type: type/Text
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, entity_qualified_id]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, entity_qualified_id]
+ name: entity_qualified_id
+ position: 4
+ semantic_type: type/Category
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: entity_qualified_id
+ lib/desired-column-alias: entity_qualified_id
+ lib/original-display-name: Entity Qualified ID
+ lib/original-name: entity_qualified_id
+ lib/source: source/table-defaults
+ lib/source-column-alias: entity_qualified_id
+ qp/implicit-field?: true
+- active: true
+ base_type: type/DateTimeWithLocalTZ
+ database_type: timestamptz
+ display_name: Started At
+ effective_type: type/DateTimeWithLocalTZ
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, started_at]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, started_at]
+ name: started_at
+ position: 5
+ semantic_type: type/CreationTimestamp
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: started_at
+ lib/desired-column-alias: started_at
+ lib/original-display-name: Started At
+ lib/original-name: started_at
+ lib/source: source/table-defaults
+ lib/source-column-alias: started_at
+ qp/implicit-field?: true
+- active: true
+ base_type: type/DateTimeWithLocalTZ
+ database_type: timestamptz
+ display_name: Ended At
+ effective_type: type/DateTimeWithLocalTZ
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, ended_at]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, ended_at]
+ name: ended_at
+ position: 6
+ semantic_type: null
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: ended_at
+ lib/desired-column-alias: ended_at
+ lib/original-display-name: Ended At
+ lib/original-name: ended_at
+ lib/source: source/table-defaults
+ lib/source-column-alias: ended_at
+ qp/implicit-field?: true
+- active: true
+ base_type: type/Float
+ database_type: float8
+ display_name: Duration Seconds
+ effective_type: type/Float
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, duration_seconds]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, duration_seconds]
+ name: duration_seconds
+ position: 7
+ semantic_type: type/Duration
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: duration_seconds
+ lib/desired-column-alias: duration_seconds
+ lib/original-display-name: Duration Seconds
+ lib/original-name: duration_seconds
+ lib/source: source/table-defaults
+ lib/source-column-alias: duration_seconds
+ qp/implicit-field?: true
+- active: true
+ base_type: type/Text
+ database_type: varchar
+ display_name: Status
+ effective_type: type/Text
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, status]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, status]
+ name: status
+ position: 8
+ semantic_type: type/Category
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: status
+ lib/desired-column-alias: status
+ lib/original-display-name: Status
+ lib/original-name: status
+ lib/source: source/table-defaults
+ lib/source-column-alias: status
+ qp/implicit-field?: true
+- active: true
+ base_type: type/Text
+ database_type: varchar
+ display_name: Process UUID
+ effective_type: type/Text
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, process_uuid]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, process_uuid]
+ name: process_uuid
+ position: 9
+ semantic_type: type/Category
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: process_uuid
+ lib/desired-column-alias: process_uuid
+ lib/original-display-name: Process UUID
+ lib/original-name: process_uuid
+ lib/source: source/table-defaults
+ lib/source-column-alias: process_uuid
+ qp/implicit-field?: true
+- active: true
+ base_type: type/DateTimeWithLocalTZ
+ database_type: timestamptz
+ display_name: Updated At
+ effective_type: type/DateTimeWithLocalTZ
+ field_ref:
+ - field
+ - [Internal Metabase Database, public, v_task_runs, updated_at]
+ - null
+ id: [Internal Metabase Database, public, v_task_runs, updated_at]
+ name: updated_at
+ position: 10
+ semantic_type: type/UpdatedTimestamp
+ source: fields
+ table_id: [Internal Metabase Database, public, v_task_runs]
+ visibility_type: normal
+ lib/deduplicated-name: updated_at
+ lib/desired-column-alias: updated_at
+ lib/original-display-name: Updated At
+ lib/original-name: updated_at
+ lib/source: source/table-defaults
+ lib/source-column-alias: updated_at
+ qp/implicit-field?: true
+visualization_settings: {column_settings: null, table.cell_column: duration_seconds, table.pivot_column: status}
+card_schema: 23
+serdes/meta:
+- {id: eiR5q0JEbDRy1-WnYIhm4, label: task_runs, model: Card}
+archived_directly: false
+dashboard_id: null
+document_id: null
+embedding_type: null
+source_card_id: null
+type: model
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/duration_seconds.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/duration_seconds.yaml
new file mode 100644
index 00000000000..ba76fd50751
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/duration_seconds.yaml
@@ -0,0 +1,38 @@
+name: duration_seconds
+display_name: Duration Seconds
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: float8
+base_type: type/Float
+effective_type: type/Float
+semantic_type: type/Duration
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 7
+custom_position: 0
+database_position: 7
+has_field_values: null
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: duration_seconds, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/ended_at.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/ended_at.yaml
new file mode 100644
index 00000000000..bc1a2191a91
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/ended_at.yaml
@@ -0,0 +1,38 @@
+name: ended_at
+display_name: Ended At
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: timestamptz
+base_type: type/DateTimeWithLocalTZ
+effective_type: type/DateTimeWithLocalTZ
+semantic_type: null
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 6
+custom_position: 0
+database_position: 6
+has_field_values: null
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: ended_at, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_id.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_id.yaml
new file mode 100644
index 00000000000..5ee5ae6a5e4
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_id.yaml
@@ -0,0 +1,38 @@
+name: entity_id
+display_name: Entity ID
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: int4
+base_type: type/Integer
+effective_type: type/Integer
+semantic_type: null
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 3
+custom_position: 0
+database_position: 3
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: entity_id, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_qualified_id.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_qualified_id.yaml
new file mode 100644
index 00000000000..0cca9669257
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_qualified_id.yaml
@@ -0,0 +1,38 @@
+name: entity_qualified_id
+display_name: Entity Qualified ID
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: text
+base_type: type/Text
+effective_type: type/Text
+semantic_type: type/Category
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 4
+custom_position: 0
+database_position: 4
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: entity_qualified_id, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_type.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_type.yaml
new file mode 100644
index 00000000000..ccd746c0942
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/entity_type.yaml
@@ -0,0 +1,38 @@
+name: entity_type
+display_name: Entity Type
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: varchar
+base_type: type/Text
+effective_type: type/Text
+semantic_type: type/Category
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 2
+custom_position: 0
+database_position: 2
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: entity_type, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/id.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/id.yaml
new file mode 100644
index 00000000000..f4daccc3d03
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/id.yaml
@@ -0,0 +1,38 @@
+name: id
+display_name: ID
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: int4
+base_type: type/Integer
+effective_type: type/Integer
+semantic_type: type/PK
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 0
+custom_position: 0
+database_position: 0
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: id, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/process_uuid.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/process_uuid.yaml
new file mode 100644
index 00000000000..f5d7ac7fa29
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/process_uuid.yaml
@@ -0,0 +1,38 @@
+name: process_uuid
+display_name: Process UUID
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: varchar
+base_type: type/Text
+effective_type: type/Text
+semantic_type: type/Category
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 9
+custom_position: 0
+database_position: 9
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: process_uuid, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/run_type.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/run_type.yaml
new file mode 100644
index 00000000000..e61d61296e3
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/run_type.yaml
@@ -0,0 +1,38 @@
+name: run_type
+display_name: Run Type
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: varchar
+base_type: type/Text
+effective_type: type/Text
+semantic_type: type/Category
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 1
+custom_position: 0
+database_position: 1
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: run_type, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/started_at.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/started_at.yaml
new file mode 100644
index 00000000000..e323248a689
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/started_at.yaml
@@ -0,0 +1,38 @@
+name: started_at
+display_name: Started At
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: timestamptz
+base_type: type/DateTimeWithLocalTZ
+effective_type: type/DateTimeWithLocalTZ
+semantic_type: type/CreationTimestamp
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 5
+custom_position: 0
+database_position: 5
+has_field_values: null
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: started_at, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/status.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/status.yaml
new file mode 100644
index 00000000000..62d316caf2b
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/status.yaml
@@ -0,0 +1,38 @@
+name: status
+display_name: Status
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: varchar
+base_type: type/Text
+effective_type: type/Text
+semantic_type: type/Category
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 8
+custom_position: 0
+database_position: 8
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: status, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/updated_at.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/updated_at.yaml
new file mode 100644
index 00000000000..aa51f88e7e8
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/fields/updated_at.yaml
@@ -0,0 +1,38 @@
+name: updated_at
+display_name: Updated At
+description: null
+created_at: '2026-01-16T15:36:24.124766Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_task_runs]
+database_type: timestamptz
+base_type: type/DateTimeWithLocalTZ
+effective_type: type/DateTimeWithLocalTZ
+semantic_type: type/UpdatedTimestamp
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 10
+custom_position: 0
+database_position: 10
+has_field_values: null
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+- {id: updated_at, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/v_task_runs.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/v_task_runs.yaml
new file mode 100644
index 00000000000..d34843be032
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_task_runs/v_task_runs.yaml
@@ -0,0 +1,29 @@
+name: v_task_runs
+display_name: V Task Runs
+description: null
+created_at: '2026-01-16T15:36:18.733556Z'
+db_id: Internal Metabase Database
+schema: public
+entity_type: entity/GenericTable
+active: true
+is_upload: false
+field_order: database
+visibility_type: null
+show_in_getting_started: false
+initial_sync_status: complete
+points_of_interest: null
+caveats: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_task_runs, model: Table}
+archived_at: null
+collection_id: null
+data_authority: unconfigured
+data_layer: bronze
+data_source: null
+database_require_filter: null
+deactivated_at: null
+is_published: false
+owner_email: null
+owner_user_id: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_tasks/fields/logs.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_tasks/fields/logs.yaml
new file mode 100644
index 00000000000..14a5a7ac8db
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_tasks/fields/logs.yaml
@@ -0,0 +1,38 @@
+name: logs
+display_name: Logs
+description: null
+created_at: '2026-01-16T15:36:24.191357Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_tasks]
+database_type: text
+base_type: type/Text
+effective_type: type/Text
+semantic_type: null
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: null
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: false
+position: 9
+custom_position: 0
+database_position: 9
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_tasks, model: Table}
+- {id: logs, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_tasks/fields/run_id.yaml b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_tasks/fields/run_id.yaml
new file mode 100644
index 00000000000..32df9a23082
--- /dev/null
+++ b/resources/instance_analytics/databases/Internal Metabase Database/schemas/public/tables/v_tasks/fields/run_id.yaml
@@ -0,0 +1,38 @@
+name: run_id
+display_name: Run ID
+description: null
+created_at: '2026-01-16T15:36:24.191357Z'
+active: true
+visibility_type: normal
+table_id: [Internal Metabase Database, public, v_tasks]
+database_type: int4
+base_type: type/Integer
+effective_type: type/Integer
+semantic_type: type/FK
+database_is_auto_increment: false
+database_required: false
+fk_target_field_id: [Internal Metabase Database, public, v_task_runs, id]
+dimensions: []
+json_unfolding: false
+parent_id: null
+coercion_strategy: null
+preview_display: true
+position: 8
+custom_position: 0
+database_position: 8
+has_field_values: auto-list
+settings: null
+caveats: null
+points_of_interest: null
+nfc_path: null
+serdes/meta:
+- {id: Internal Metabase Database, model: Database}
+- {id: public, model: Schema}
+- {id: v_tasks, model: Table}
+- {id: run_id, model: Field}
+database_default: null
+database_indexed: null
+database_is_generated: false
+database_is_nullable: true
+database_is_pk: false
+database_partitioned: null
diff --git a/resources/migrations/059_update_migrations.yaml b/resources/migrations/059_update_migrations.yaml
index d935d2430eb..5219dfffc2d 100644
--- a/resources/migrations/059_update_migrations.yaml
+++ b/resources/migrations/059_update_migrations.yaml
@@ -622,6 +622,59 @@ databaseChangeLog:
tableName: task_run
columnName: updated_at
+ - changeSet:
+ id: v59.2026-01-16T11:00:00
+ author: bronsa
+ comment: Usage analytics; Create v_task_runs view for task run analytics
+ changes:
+ - sqlFile:
+ dbms: postgresql
+ path: instance_analytics_views/task_runs/v1/postgres-task_runs.sql
+ relativeToChangelogFile: true
+ - sqlFile:
+ dbms: mysql,mariadb
+ path: instance_analytics_views/task_runs/v1/mysql-task_runs.sql
+ relativeToChangelogFile: true
+ - sqlFile:
+ dbms: h2
+ path: instance_analytics_views/task_runs/v1/h2-task_runs.sql
+ relativeToChangelogFile: true
+ rollback:
+ - sql:
+ dbms: postgresql,mysql,mariadb,h2
+ sql: drop view if exists v_task_runs;
+
+ - changeSet:
+ id: v59.2026-01-16T11:00:01
+ author: bronsa
+ comment: Usage analytics; Update v_tasks view to include run_id and logs columns
+ changes:
+ - sqlFile:
+ dbms: postgresql
+ path: instance_analytics_views/tasks/v4/postgres-tasks.sql
+ relativeToChangelogFile: true
+ - sqlFile:
+ dbms: mysql,mariadb
+ path: instance_analytics_views/tasks/v4/mysql-tasks.sql
+ relativeToChangelogFile: true
+ - sqlFile:
+ dbms: h2
+ path: instance_analytics_views/tasks/v4/h2-tasks.sql
+ relativeToChangelogFile: true
+ rollback:
+ - sqlFile:
+ dbms: postgresql
+ path: instance_analytics_views/tasks/v2/postgres-tasks.sql
+ relativeToChangelogFile: true
+ - sqlFile:
+ dbms: mysql,mariadb
+ path: instance_analytics_views/tasks/v3/mysql-tasks.sql
+ relativeToChangelogFile: true
+ - sqlFile:
+ dbms: h2
+ path: instance_analytics_views/tasks/v2/h2-tasks.sql
+ relativeToChangelogFile: true
+
# >>>>>>>>>> DO NOT ADD NEW MIGRATIONS BELOW THIS LINE! ADD THEM ABOVE <<<<<<<<<<
########################################################################################################################
diff --git a/resources/migrations/instance_analytics_views/task_runs/v1/h2-task_runs.sql b/resources/migrations/instance_analytics_views/task_runs/v1/h2-task_runs.sql
new file mode 100644
index 00000000000..dc7627153b3
--- /dev/null
+++ b/resources/migrations/instance_analytics_views/task_runs/v1/h2-task_runs.sql
@@ -0,0 +1,25 @@
+drop view if exists v_task_runs;
+
+create or replace view v_task_runs as
+select
+ id,
+ run_type,
+ entity_type,
+ entity_id,
+ case
+ when entity_type = 'database' then 'database_' || entity_id
+ when entity_type = 'card' then 'card_' || entity_id
+ when entity_type = 'dashboard' then 'dashboard_' || entity_id
+ else entity_type || '_' || entity_id
+ end as entity_qualified_id,
+ started_at,
+ ended_at,
+ case
+ when ended_at is not null then
+ cast(DATEDIFF('SECOND', started_at, ended_at) as double)
+ else null
+ end as duration_seconds,
+ status,
+ process_uuid,
+ updated_at
+from task_run;
diff --git a/resources/migrations/instance_analytics_views/task_runs/v1/mysql-task_runs.sql b/resources/migrations/instance_analytics_views/task_runs/v1/mysql-task_runs.sql
new file mode 100644
index 00000000000..e7ab49ee280
--- /dev/null
+++ b/resources/migrations/instance_analytics_views/task_runs/v1/mysql-task_runs.sql
@@ -0,0 +1,27 @@
+drop view if exists v_task_runs;
+
+create or replace
+SQL SECURITY INVOKER
+view v_task_runs as
+select
+ id,
+ run_type,
+ entity_type,
+ entity_id,
+ case
+ when entity_type = 'database' then concat('database_', entity_id)
+ when entity_type = 'card' then concat('card_', entity_id)
+ when entity_type = 'dashboard' then concat('dashboard_', entity_id)
+ else concat(entity_type, '_', entity_id)
+ end as entity_qualified_id,
+ started_at,
+ ended_at,
+ case
+ when ended_at is not null then
+ cast(TIMESTAMPDIFF(SECOND, started_at, ended_at) as double)
+ else null
+ end as duration_seconds,
+ status,
+ process_uuid,
+ updated_at
+from task_run;
diff --git a/resources/migrations/instance_analytics_views/task_runs/v1/postgres-task_runs.sql b/resources/migrations/instance_analytics_views/task_runs/v1/postgres-task_runs.sql
new file mode 100644
index 00000000000..06520936dc6
--- /dev/null
+++ b/resources/migrations/instance_analytics_views/task_runs/v1/postgres-task_runs.sql
@@ -0,0 +1,25 @@
+drop view if exists v_task_runs;
+
+create or replace view v_task_runs as
+select
+ id,
+ run_type,
+ entity_type,
+ entity_id,
+ case
+ when entity_type = 'database' then 'database_' || entity_id
+ when entity_type = 'card' then 'card_' || entity_id
+ when entity_type = 'dashboard' then 'dashboard_' || entity_id
+ else entity_type || '_' || entity_id
+ end as entity_qualified_id,
+ started_at,
+ ended_at,
+ case
+ when ended_at is not null then
+ cast(EXTRACT(EPOCH FROM (ended_at - started_at)) as double precision)
+ else null
+ end as duration_seconds,
+ status,
+ process_uuid,
+ updated_at
+from task_run;
diff --git a/resources/migrations/instance_analytics_views/tasks/v4/h2-tasks.sql b/resources/migrations/instance_analytics_views/tasks/v4/h2-tasks.sql
new file mode 100644
index 00000000000..ed8ce6f5c75
--- /dev/null
+++ b/resources/migrations/instance_analytics_views/tasks/v4/h2-tasks.sql
@@ -0,0 +1,15 @@
+drop view if exists v_tasks;
+
+create or replace view v_tasks as
+select
+ id,
+ task,
+ status,
+ 'database_' || db_id as database_qualified_id,
+ started_at,
+ ended_at,
+ cast(duration as double) / 1000 as duration_seconds,
+ task_details as details,
+ run_id,
+ logs
+from task_history;
diff --git a/resources/migrations/instance_analytics_views/tasks/v4/mysql-tasks.sql b/resources/migrations/instance_analytics_views/tasks/v4/mysql-tasks.sql
new file mode 100644
index 00000000000..6ff4a5792c8
--- /dev/null
+++ b/resources/migrations/instance_analytics_views/tasks/v4/mysql-tasks.sql
@@ -0,0 +1,17 @@
+drop view if exists v_tasks;
+
+CREATE OR REPLACE
+SQL SECURITY INVOKER
+VIEW v_tasks AS
+select
+ id,
+ task,
+ status,
+ concat('database_', db_id) as database_qualified_id,
+ started_at,
+ ended_at,
+ cast(duration as double) / 1000 as duration_seconds,
+ task_details as details,
+ run_id,
+ logs
+from task_history;
diff --git a/resources/migrations/instance_analytics_views/tasks/v4/postgres-tasks.sql b/resources/migrations/instance_analytics_views/tasks/v4/postgres-tasks.sql
new file mode 100644
index 00000000000..e18799ab76b
--- /dev/null
+++ b/resources/migrations/instance_analytics_views/tasks/v4/postgres-tasks.sql
@@ -0,0 +1,15 @@
+drop view if exists v_tasks;
+
+create or replace view v_tasks as
+select
+ id,
+ task,
+ status,
+ 'database_' || db_id as database_qualified_id,
+ started_at,
+ ended_at,
+ cast(duration as double precision) / 1000 as duration_seconds,
+ task_details as details,
+ run_id,
+ logs
+from task_history;