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
23338803
Unverified
Commit
23338803
authored
5 months ago
by
bryan
Committed by
GitHub
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix grouped metrics + add some safety to it (#48995)
parent
cf2dd2c9
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/analytics/stats.clj
+30
-23
30 additions, 23 deletions
src/metabase/analytics/stats.clj
with
30 additions
and
23 deletions
src/metabase/analytics/stats.clj
+
30
−
23
View file @
23338803
...
...
@@ -626,22 +626,36 @@
(
update-vals
count
)))
:eid-translations-24h
(
get-translation-count
)}))
(
defn-
snowplow-grouped-metrics
[{
:keys
[
eid-translations-24h
query-executions
query-executions-24h
]
:as
_snowplow-grouped-metric-info
}]
[{
:name
:query_executions_by_source
:values
(
mapv
(
fn
[
qe-group
]
{
:group
qe-group
:value
(
get
query-executions
qe-group
)})
[
"interactive_embed"
"internal"
"public_link"
"sdk_embed"
"static_embed"
])
:tags
[
"embedding"
]}
{
:name
:query_executions_by_source_24h
:values
(
mapv
(
fn
[
qe-group
]
{
:group
qe-group
:value
(
get
query-executions-24h
qe-group
)})
[
"interactive_embed"
"internal"
"public_link"
"sdk_embed"
"static_embed"
])
:tags
[
"embedding"
]}
{
:name
:entity_id_translations_last_24h
:values
eid-translations-24h
:tags
[
"embedding"
]}])
(
defn-
deep-string-keywords
"Snowplow data will not work if you pass in keywords, but this will let use use keywords all over."
[
data
]
(
walk/postwalk
(
fn
[
x
]
(
if
(
keyword?
x
)
(
->
x
u/->snake_case_en
name
)
x
))
data
))
(
mu/defn-
snowplow-grouped-metrics
:-
[
:sequential
[
:map
[
"name"
:string
]
[
"values"
[
:sequential
[
:map
[
"group"
:string
]
[
"value"
:int
]]]]
[
"tags"
[
:sequential
:string
]]]]
[{
:keys
[
eid-translations-24h
query-executions
query-executions-24h
]
:as
_snowplow-grouped-metric-info
}]
(
deep-string-keywords
[{
:name
:query_executions_by_source
:values
(
mapv
(
fn
[
qe-group
]
{
:group
qe-group
:value
(
get
query-executions
qe-group
)})
[
"interactive_embed"
"internal"
"public_link"
"sdk_embed"
"static_embed"
])
:tags
[
"embedding"
]}
{
:name
:query_executions_by_source_24h
:values
(
mapv
(
fn
[
qe-group
]
{
:group
qe-group
:value
(
get
query-executions-24h
qe-group
)})
[
"interactive_embed"
"internal"
"public_link"
"sdk_embed"
"static_embed"
])
:tags
[
"embedding"
]}
{
:name
:entity_id_translations_last_24h
:values
(
mapv
(
fn
[[
k
v
]]
{
:group
k
:value
v
})
eid-translations-24h
)
:tags
[
"embedding"
]}]))
(
defn-
->snowplow-metric-info
"Collects Snowplow metrics data that is not in the legacy stats format. Also clears entity id translation count."
...
...
@@ -888,13 +902,6 @@
(
update-in
[
:stats
:cache
]
dissoc
:num_queries_cached_unbinned
))
:snowplow-stats
(
snowplow-anonymous-usage-stats
stats
)}))
(
defn-
deep-string-keywords
"Snowplow data will not work if you pass in keywords, but this will let use use keywords all over."
[
data
]
(
walk/postwalk
(
fn
[
x
]
(
if
(
keyword?
x
)
(
->
x
u/->snake_case_en
name
)
x
))
data
))
(
defn-
stats-post-cleanup
[]
(
clear-translation-count!
))
...
...
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