-
Notifications
You must be signed in to change notification settings - Fork 204
Feature: make the number of columns that are formatted as a table in Teams alerts a cli flag so that users have more control over the formatting in Teams #1958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
00054dc
f228d5d
48fd32e
03d8d53
4819dc9
7df298d
9a4b058
947f518
404a9a5
e068485
db5b635
94cc7a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -285,6 +285,13 @@ def get_cli_properties() -> dict: | |||||||||||||||||||||||||||||||
| default=None, | ||||||||||||||||||||||||||||||||
| help="A Microsoft Teams webhook URL for sending alerts to a specific channel in Teams.", | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| @click.option( | ||||||||||||||||||||||||||||||||
| "--maximum-columns-in-alert-samples", | ||||||||||||||||||||||||||||||||
| "-mc", | ||||||||||||||||||||||||||||||||
| type=int, | ||||||||||||||||||||||||||||||||
| default=4, | ||||||||||||||||||||||||||||||||
| help="Maximum number of columns to display as a table in alert samples. Above this, the output is shown as raw JSON.", | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
Comment on lines
+288
to
+294
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix precedence bug: CLI default overrides config; validate range. With default=4 here, Click always passes 4, shadowing any value from config.yml despite the intended precedence (CLI explicit > config > default 4). Also, negatives should be rejected. Apply: @click.option(
"--maximum-columns-in-alert-samples",
"-mc",
- type=int,
- default=4,
- help="Maximum number of columns to display as a table in alert samples. Above this, the output is shown as raw JSON.",
+ type=click.IntRange(min=0),
+ default=None,
+ show_default=4,
+ help="Maximum number of columns to display as a table in alert samples. Above this, the output is shown as raw JSON. Set to 0 to force JSON for all samples.",
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| @click.pass_context | ||||||||||||||||||||||||||||||||
| def monitor( | ||||||||||||||||||||||||||||||||
| ctx, | ||||||||||||||||||||||||||||||||
|
|
@@ -316,6 +323,7 @@ def monitor( | |||||||||||||||||||||||||||||||
| filters, | ||||||||||||||||||||||||||||||||
| excludes, | ||||||||||||||||||||||||||||||||
| teams_webhook, | ||||||||||||||||||||||||||||||||
| maximum_columns_in_alert_samples, | ||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
| Get alerts on failures in dbt jobs. | ||||||||||||||||||||||||||||||||
|
|
@@ -347,6 +355,7 @@ def monitor( | |||||||||||||||||||||||||||||||
| slack_group_alerts_by=group_by, | ||||||||||||||||||||||||||||||||
| report_url=report_url, | ||||||||||||||||||||||||||||||||
| teams_webhook=teams_webhook, | ||||||||||||||||||||||||||||||||
| maximum_columns_in_alert_samples=maximum_columns_in_alert_samples, | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| anonymous_tracking = AnonymousCommandLineTracking(config) | ||||||||||||||||||||||||||||||||
| anonymous_tracking.set_env("use_select", bool(select)) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,4 @@ target/ | |
| dbt_modules/ | ||
| dbt_packages*/ | ||
| logs/ | ||
| dbt_internal_packages/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,5 +148,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,5 +87,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,5 +148,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
|
Comment on lines
+151
to
+154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainLGTM: Teams full-width hint added correctly. The top-level msteams.width="Full" is valid for Teams and the JSON remains well-formed after the version comma. Optional: verify all AdaptiveCard fixtures include the new msteams hint when version=1.5. 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Lists JSON fixtures under tests/unit that declare version 1.5 but lack the Teams width hint.
missing=()
while IFS= read -r -d '' f; do
if rg -q '"version":\s*"1\.5"' "$f"; then
if ! rg -q '"msteams":\s*\{\s*"width":\s*"Full"\s*\}' "$f"; then
missing+=("$f")
fi
fi
done < <(fd -t f -e json tests/unit | tr '\n' '\0')
printf "%s\n" "${missing[@]:-}" | sortLength of output: 534 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Lists JSON fixtures under tests/unit that declare version 1.5 but lack the Teams width hint.
missing=()
while IFS= read -r -d '' f; do
if grep -q '"version":\s*"1\.5"' "$f"; then
if ! grep -q '"msteams":\s*{[^}]*"width":\s*"Full"' "$f"; then
missing+=("$f")
fi
fi
done < <(find tests/unit -type f -name '*.json' -print0)
printf "%s\n" "${missing[@]:-}" | sortLength of output: 192 #!/bin/bash
set -euo pipefail
# Find all JSON fixtures under tests/unit and list those that have version "1.5" but lack the msteams width hint
find tests/unit -type f -name '*.json' -exec sh -c '
for f; do
if grep -Eq '"version":[[:space:]]*"1\.5"' "$f"; then
if ! grep -Eq '"msteams":[[:space:]]*{[^}]*"width":[[:space:]]*"Full"' "$f"; then
echo "$f"
fi
fi
done
' sh {} +🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find JSON fixtures under tests/unit with version "1.5" missing msteams.width="Full"
find tests/unit -type f -name '*.json' -exec sh -c '
f="$1"
if grep -Eq "\"version\":[[:space:]]*\"1\.5\"" "$f" && \
! grep -Eq "\"msteams\":[[:space:]]*{[^}]*\"width\":[[:space:]]*\"Full\"" "$f"; then
echo "$f"
fi
' _ {} \;Length of output: 16609 Ensure all version “1.5” AdaptiveCard fixtures include the Teams width hint "msteams": { "width": "Full" }block. Add this hint to every AdaptiveCard fixture with version 1.5. 🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,5 +209,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,5 +148,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,5 +148,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,5 +209,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,5 +209,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,5 +209,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -270,5 +270,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -270,5 +270,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,5 +202,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,5 +202,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,5 +202,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,5 +185,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,5 +202,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,5 +202,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,5 +202,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,5 +160,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,5 +185,8 @@ | |
| ] | ||
| } | ||
| ], | ||
| "version": "1.5" | ||
| "version": "1.5", | ||
| "msteams": { | ||
| "width": "Full" | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Rate limiting import added — verify dependency is declared/pinned.
Ensure ratelimit is listed in your dependency files (and pinned) to avoid runtime ImportError.
🏁 Script executed:
Length of output: 207
Pin ratelimit dependency to a specific version
Replace
ratelimit = "*"in pyproject.toml (line 22) with a fixed version specifier (e.g.ratelimit = "==1.0.0") to ensure reproducible builds.🤖 Prompt for AI Agents