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
c2c1d123
Commit
c2c1d123
authored
8 years ago
by
Sameer Al-Sakran
Browse files
Options
Downloads
Patches
Plain Diff
characterize by latency
parent
7e95c0f5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/util/stats.clj
+12
-7
12 additions, 7 deletions
src/metabase/util/stats.clj
with
12 additions
and
7 deletions
src/metabase/util/stats.clj
+
12
−
7
View file @
c2c1d123
...
...
@@ -63,11 +63,12 @@
)
(
defn
-
bin-large-number
(
defn
bin-large-number
"Return large bin number. Assumes positive inputs"
[
x
]
(
cond
(
=
0
x
)
"0"
(
<
x
1
)
"< 1"
(
<=
1
x
10
)
"1-10"
(
<=
11
x
50
)
"11-50"
(
<=
51
x
250
)
"51-250"
...
...
@@ -228,8 +229,7 @@
(
defn
get-table-metrics
"Get metrics based on tables
TODO characterize by # fields"
"Get metrics based on tables"
[]
(
let
[
tables
(
db/select
'Table
)]
{
:tables
(
count
tables
)
...
...
@@ -260,20 +260,25 @@
(
let
[
metrics
(
db/select
'Metric
)]
{
:metrics
(
count
metrics
)}))
(
defn
bin-latencies
"Bin latencies, which are in milliseconds"
[
query-executions
]
(
let
[
latency-vals
(
map
#
(
/
%1
1000
)
(
map
:running_time
query-executions
))]
(
frequencies
(
map
bin-large-number
latency-vals
))))
;; Execution Metrics
(
defn
get-execution-metrics
"Get metrics based on executions.
This should be done in a single pass, as there might
be a LOT of query executions in a normal instance
TODO: characterize by ad hoc vs cards
characterize by latency
characterize by error status"
TODO: characterize by ad hoc vs cards"
[]
(
let
[
executions
(
db/select
'QueryExecution
)]
{
:executions
(
count
executions
)
:by_status
(
frequencies
(
map
:status
executions
))
:num_per_user
(
large-histogram
executions
:executor_id
)
:num_per_card
(
large-histogram
executions
:table_id
)}))
:num_per_card
(
large-histogram
executions
:table_id
)
:num_by_latency
(
bin-latencies
executions
)}))
(
defn
get-map-metrics
"Get metrics based on custom geojson maps
...
...
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