Hide telemetry metadata params from Airflow trigger UI#2247
Conversation
Wrap the __cosmos_telemetry_metadata__ param in Param(default=metadata, const=metadata) to hide it from the manual trigger UI. The const attribute marks the param as constant and unchangeable, which tells Airflow UI to not display an input field for it.
There was a problem hiding this comment.
Pull request overview
This PR enhances the user experience by hiding the internal __cosmos_telemetry_metadata__ parameter from Airflow's manual trigger UI. The change wraps the metadata value in an Airflow Param object with the const attribute, which signals to the UI that this is an unchangeable constant that should not be displayed to users.
Key Changes
- Import
Paramfromairflow.models.param - Wrap the telemetry metadata in
Param(default=metadata, const=metadata)to mark it as constant
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Deploy Preview for astronomer-cosmos canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2247 +/- ##
=======================================
Coverage 97.99% 97.99%
=======================================
Files 96 96
Lines 6245 6246 +1
=======================================
+ Hits 6120 6121 +1
Misses 125 125 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tatiana
left a comment
There was a problem hiding this comment.
Much better user experience, thanks a lot, @pankajkoti !
Features * Support cross-referencing models across dbt projects using dbt-loom by @pankajkoti in #2271 * Support use of YAML selectors when using ``LoadMode.DBT_MANIFEST`` by @YourRoyalLinus in #2261 * Introduce ``ExecutionMode.WATCHER_KUBERNETES`` to use the watcher with ``KubernetesPodOperator`` by @tatiana in #2207 * Add support for StarRocks profile mapping by @kurkim0661 in #2256 * Allow pushing URIs as XComs for Cosmos tasks by @corsettigyg in #2275 * Support defining custom callbacks alongside the ``WATCHER_KUBERNETES`` callback by @johnhoran in #2307 Enhancements * Refactor: remove duplicate ``_construct_dest_file_path`` by @jx2lee in #2077 * Leverage Airflow ``::group::`` to group logs associated with DAG parsing by @tatiana in #2235 * Refactor ``DbtConsumerWatcherSensor`` for reusability by @tatiana in #2245 * Restore plain text output when using ``ExecutionMode.WATCHER`` by @tiovader in #2241 Bug Fixes * Fix running empty models or ephemeral nodes in ``ExecutionMode.WATCHER`` by @tatiana in #2279 * Improve watcher producer task priority in scheduling and the UI by @tatiana in #2237 * Fix typos and formatting issues in documentation by @pankajkoti in #2259 * Allow watcher producer retries without erroring by @tatiana in #2283 * Fix ``TestBehavior.AFTER_ALL`` is missing project_name information when loading project using manifest file by @tuantran0910 in #2242 * Fix duplicate log lines in watcher subprocess execution and format timestamps by @pankajkoti in #2301 Docs * Add Watcher Kubernetes documentation by @tatiana in #2303 * Document newly added telemetry metrics in the privacy notice by @pankajkoti in #2249 * Add compatibility policy document by @pankajastro in #2251 * Improve watcher documentation related to dbt threads by @tatiana in #2273 * Fix link in watcher execution mode documentation by @jedcunningham in #2277 * Update Apache Airflow minimum compatibility policy by @tatiana in #2285 * Clarify Cosmos runtime support until "End of Basic Support" by @jedcunningham in #2286 * Update watcher docs by @tatiana in #2298 * Update watcher kubernetes documentation by @tatiana in #2306 Others * Add Airflow 3 DAG versioning tests for Cosmos by @michal-mrazek in #2177 * Add dbt Core 1.11 to the test matrix by @tatiana in #2230 * Add integration tests using InvocationMode.SUBPROCESS and validate output by @tatiana in #2287 * Fix main branch failing tests by @tatiana in #2296 * Update pre-commit hooks to the latest versions by @jedcunningham in #2289 * Pre-commit autoupdates by @pre-commit in #2222, #2264, #2274 and #2290 * Dependabot updates by @dependabot in #2218, #2219, #2220, #2280 and #2284 * Add Scarf metrics to understand Cosmos feature usage patterns - Add telemetry tracking for dbt docs plugin usage by @pankajkoti in #2240 - Add DAG run telemetry metrics for load mode, invocation, and render_config parameters by @pankajkoti in #2223 - Collect profile metrics for DAG runs by @pankajastro in #2228 - Compress telemetry metadata to reduce serialized DAG size by @pankajkoti in #2252 - Skip storing telemetry metadata when emission is disabled by @pankajkoti in #2278 - Hide telemetry metadata parameters from the Airflow trigger UI by @pankajkoti in #2247 closes: astronomer/oss-integrations-private#317 --------- Co-authored-by: Tatiana Al-Chueyr <tatiana.alchueyr@gmail.com>
…2466) It's observed that when something changes in the DAG or the dbt project, the value that we set for the `__cosmos_telemetry_metadata__` changes, and Airflow complains with ParamValidationError when the value is updated for a Param with `const` attribute. We're therefore removing the const attribute from the param to avoid such an error, which is fatal, and when it occurs does not allow dags/task runs to progress. By removing the `const` attribute, the earlier intended internal param now appears in the DAG trigger form. We have added a helper text suggesting users not to edit the value since Airflow does not allow us to set read-only params from the Cosmos code. <img width="992" height="520" alt="Screenshot 2026-03-16 at 7 17 14 PM" src="https://github.com/user-attachments/assets/ff4b7e5a-d67e-4a66-8811-141474302b64" /> In case users edit these values, we have a fail-safe handler in place already that takes care when decompressing fails for the param: https://github.com/astronomer/astronomer-cosmos/blob/61ff9d17015ba7d9d0eee9578682fb8a582d88ba/cosmos/listeners/dag_run_listener.py#L78 closes: #2421 related: #2223 related: #2247
Wrap the
__cosmos_telemetry_metadata__param inParam(default=metadata, const=metadata)to hide it from the manual trigger UI. The const attribute marks the param as constant and unchangeable, which tells Airflow UI to not display an input field for it.closes: https://github.com/astronomer/oss-integrations-private/issues/299