Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
61ca125c
Unverified
Commit
61ca125c
authored
7 months ago
by
Chris Truter
Committed by
GitHub
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add logging catch around query analysis worker (#47206)
parent
2bb3eede
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/task/analyze_queries.clj
+22
-19
22 additions, 19 deletions
src/metabase/task/analyze_queries.clj
with
22 additions
and
19 deletions
src/metabase/task/analyze_queries.clj
+
22
−
19
View file @
61ca125c
...
...
@@ -38,29 +38,32 @@
(
max
fail-wait-ms
(
wait-proportional
time-taken-ms
)))
(
defn-
analyzer-loop*
[
stop-after
next-card-id-fn
]
(
loop
[
remaining
stop-after
]
(
when
(
public-settings/query-analysis-enabled
)
(
try
(
loop
[
remaining
stop-after
]
(
let
[
card-or-id
(
next-card-id-fn
)
card-id
(
u/the-id
card-or-id
)
timer
(
u/start-timer
)
card
(
query-analysis/->analyzable
card-or-id
)]
(
if
(
failure-map/non-retryable?
card
)
(
log/warnf
"Skipping analysis of Card %s as its query has caused failures in the past."
card-id
)
(
try
(
query-analysis/analyze-card!
card
)
(
failure-map/track-success!
card
)
(
let
[
taken-ms
(
Math/ceil
(
u/since-ms
timer
))
sleep-ms
(
wait-proportional
taken-ms
)]
(
log/debugf
"Query analysis for Card %s took %sms (incl. persisting)"
card-id
taken-ms
)
(
log/debugf
"Waiting %sms before analysing further cards"
sleep-ms
)
(
Thread/sleep
sleep-ms
))
(
catch
Exception
e
(
log/errorf
e
"Error analysing and updating query for Card %s"
card-id
)
(
failure-map/track-failure!
card
)
(
Thread/sleep
(
wait-fail
(
u/since-ms
timer
))))))
(
cond
(
nil?
remaining
)
(
recur
nil
)
(
>
remaining
1
)
(
recur
(
dec
remaining
)))))))
(
when
(
public-settings/query-analysis-enabled
)
(
if
(
failure-map/non-retryable?
card
)
(
log/warnf
"Skipping analysis of Card %s as its query has caused failures in the past."
card-id
)
(
try
(
query-analysis/analyze-card!
card
)
(
failure-map/track-success!
card
)
(
let
[
taken-ms
(
Math/ceil
(
u/since-ms
timer
))
sleep-ms
(
wait-proportional
taken-ms
)]
(
log/debugf
"Query analysis for Card %s took %sms (incl. persisting)"
card-id
taken-ms
)
(
log/debugf
"Waiting %sms before analysing further cards"
sleep-ms
)
(
Thread/sleep
sleep-ms
))
(
catch
Exception
e
(
log/errorf
e
"Error analysing and updating query for Card %s"
card-id
)
(
failure-map/track-failure!
card
)
(
Thread/sleep
(
wait-fail
(
u/since-ms
timer
))))))
(
cond
(
nil?
remaining
)
(
recur
nil
)
(
>
remaining
1
)
(
recur
(
dec
remaining
))))))
(
catch
Exception
e
(
log/error
e
"Unhandled error when attempting to analyse the next card in the queue"
))))
(
defn-
analyzer-loop!
([]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment