Overwatch
repository·main·Indexed 42 days ago
https://github.com/databrickslabs/overwatchA deprecated telemetry unification tool for Databricks and Spark deployments designed to provide governance and actionable intelligence. It enables the retrieval of platform data—including jobs, clusters, and SQL history—as Spark DataFrames and provides utilities for persisting this data into Delta tables with support for parallel API calls and automated merge operations.
What's inside Overwatch
- Overwatch is a tool designed to unify Spark and Databricks Platform telemetry. Its purpose is to provide calibrated precision for the Databricks Unified Analytics Platform, enabling governance and actionable intelligence by helping users gain key insights into their Databricks deployments.
Important Deprecation Notice for Overwatch
mainOverwatch is now deprecated and will no longer be maintained. The codebase remains available for users who wish to fork or extend it, but no further updates or official support will be provided.Build Overwatch using SBT
mainUse the following SBT commands to clean and build the project. Use
packagefor standard packaging orassemblyto create a fat JAR.sbt clean package sbt clean assemblyConfigure the environment for Overwatch development
mainTo ensure compatibility with the project, your development environment must match the dependencies used by Databricks runtime 10.4 LTS. Ensure you have the following versions installed:
- Java: Zulu 8.56.0.21
- Scala: 2.12.14
- SBT: 1.2.8
Install and configure SBT
mainSBT (Scala Build Tool) can be installed in two ways:
- System-wide: Install SBT directly on your operating system and use it via the terminal.
- IDE Integration: Install the SBT plugin within an IDE like IntelliJ IDEA.
Critical Requirement: Regardless of the installation method, ensure that your SBT installation is explicitly pointing to the correct Java installation (Zulu 8.56.0.21) to avoid build failures.
Supported configuration formats for Migration
mainThe
Migrationclass supports three distinct types of configuration storage. The logic used to update thestorage_prefixis determined by the format of theconfigPathprovided:Format Detection Logic Update Mechanism CSV File Ends with .csvReads CSV, updates storage_prefixcolumn whereetl_database_namematches, and overwrites the file.Delta Path Contains /(and not.csv)Executes a Spark SQL UPDATEstatement on the Delta location:update delta.$configPathset storage_prefix = '$target_storage_prefix' WHERE etl_database_name = '$sourceETLDB'Delta Table No /detectedExecutes a Spark SQL UPDATEstatement on the table:update$configPathset storage_prefix = '$target_storage_prefix' WHERE etl_database_name = '$sourceETLDB'How PostProcessor handles intermediate targets
mainWhen optimizing certain primary targets,
PostProcessorautomatically includes related intermediate tables to ensure data consistency and prevent orphaned data. This prevents forcing an optimize on every single pipeline run by tying intermediate tables to their leader tables.Specifically:
- If
audit_log_bronzeis marked for optimization, the following are also included:processedEventLogs,clusterEventsErrorsTarget,pipelineStateTarget,cloudMachineDetail, anddbuCostDetail. - If
spark_events_bronzeis marked,processedEventLogsis also included.
Optimization parameters for
spark_events_bronzeare specialized: it uses a smallermaxFileSizeMB = 32, while other tables usemaxFileSizeMB = 128.- If
Support and Issue Reporting for Overwatch
mainOverwatch is provided AS-IS and is not formally supported by Databricks with Service Level Agreements (SLAs).
- Do not submit Databricks support tickets for issues arising from this project.
- Report issues via GitHub Issues on the repository. These will be reviewed as time permits, but there are no formal SLAs for support.
Enable destructive database operations
mainTo protect against accidental data loss, Overwatch requires an explicit Spark configuration to be set before running destructive commands (like
fastDropTargets).You must set the Spark configuration
overwatch.permit.db.destructionto a value exactly matching the name of the target database you intend to modify.If this configuration is missing or incorrect, a
com.databricks.labs.overwatch.utils.BadConfigExceptionwill be thrown.-- Example: If your target database is 'my_prod_db' SET overwatch.permit.db.destruction = my_prod_db;Configure API call behavior via ApiEnv
mainThe
ApiEnvobject (passed toApiCallV2) controls the core authentication and connection settings:workspaceURL: The base URL of the Databricks workspace.rawToken: The PAT token used for Bearer authentication.packageVersion: Used in theUser-Agentheader.successBatchSize: The number of responses to accumulate before writing a micro-batch to thesuccessTempPath(ifbatchPersistis enabled).errorBatchSize: The number of errors to accumulate before writing to the error path.threadPoolSize: The number of threads used during parallel API calls.apiWaitingTime: The timeout threshold for waiting for parallel calls to complete.
Configure Table Lock Timeout
mainIn multi-workspace deployments where
target.requiresLockingis true, Overwatch uses a global table lock to prevent race conditions during parallel writes. If a table is locked, the process will wait until the lock is released or the timeout is reached.You can control this timeout by setting the following Spark configuration on your cluster:
overwatch.tableLockTimeout(milliseconds)- Default:
1200000(20 minutes). - Usage: Increase this value for historical loads or large-scale data migrations to prevent
TABLE LOCK TIMEOUTerrors.
spark.conf.set("overwatch.tableLockTimeout", "3600000") // Set to 1 hour- Default:
Migrate ETL Database to a new target using Migration.process
mainThe
Migration.processmethod automates the migration of an Overwatch ETL database and its associated consumer database to a new target location. It performs a deep snapshot of the source, updates the configuration files (CSV, Delta path, or Delta table) with the new storage prefix, and then drops the original source and consumer databases.Workflow:
- Validation: Checks if the source is a valid Overwatch database and if the configuration path is accessible and consistent.
- Snapshot: Performs a
DEEPclone of the source ETL database to themigrateRootPath. - Config Update: Updates the
storage_prefixin the configuration to match the new target path for the specificsourceETLDB. - Cleanup: Drops both the source ETL database and the consumer database using
CASCADE.
Parameters:
sourceETLDB: The name of the source ETL database.migrateRootPath: The target path where the migration will be performed.configPath: The path to the configuration file (supports.csvfiles, Delta paths, or Delta table names).tablesToExclude: (Optional) A string representing table names to exclude from the migration. Defaults to an empty string.
// Example usage of the Migration process Migration.process( sourceETLDB = "my_source_etl_db", migrateRootPath = "/mnt/target/path/", configPath = "/mnt/configs/overwatch_config.csv", tablesToExclude = "table1,table2" )