Profiler Module: Execution & Extension
This page covers the execution internals and extension points. For the architecture overview and metrics system, see Profiler Module | Architecture & Metrics System.Profiler Execution Call Chain
Threading Model
The profiler uses a thread pool to parallelize metric computation across columns:QueryRunner instance (_create_thread_safe_runner()) with a dedicated database session. Thread count scales dynamically based on the number of tasks (min 5, max 20).
Metric Filtering
Not all metrics apply to all columns.MetricFilter (processor/metric_filter.py) selects metrics based on:
- Column data type — numeric metrics skip string columns (uses
orm/registry.pyclassifiers likeis_quantifiable(),is_concatenable()) - Global profiler config — admin can enable/disable specific metrics
- Table-level config — per-table metric overrides
- Database service type — some metrics only work on specific databases
ORM Layer
Theorm/ directory bridges SQLAlchemy types with OpenMetadata’s type system:
registry.py—PythonDialectsmaps service types to SQLAlchemy dialects;CustomTypeshandles special types (UUID, BYTES, ARRAY)converter/— database-specific converters (BigQuery, Snowflake, etc.) that map SQLAlchemy column types to OpenMetadata column typesfunctions/— custom SQL functions used by metrics (e.g.,SumFn,LenFn) that handle dialect differences
Database Backend Pluggability
Each database can override the default profiler behavior:Profiler Configuration
The profiler is configured viaProfilerProcessorConfig (api/models.py):
Adding a New Metric
1
Choose the metric type
Decide which base class fits your metric:
2
Implement the metric class
Create a file in the appropriate For a
metrics/ subdirectory.For a StaticMetric, implement fn() returning a SQLAlchemy expression:ComposedMetric, implement fn() using prior results:3
Register in the Metrics enum
Add your metric to the
Metrics enum in metrics/registry.py:4
Add type filtering (if needed)
If your metric only applies to certain column types, update
MetricFilter in processor/metric_filter.py to filter appropriately.Pandas / DataFrame Support
For non-SQL sources (datalakes, files), the profiler uses a Pandas-based interface with an accumulator pattern (metrics/pandas_metric_protocol.py):