Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4d741ea3
Unverified
Commit
4d741ea3
authored
Nov 08, 2019
by
Dominik Prokop
Committed by
GitHub
Nov 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build: Collect frontend build time metric (#20254)
parent
26c03066
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
scripts/build/build-all.sh
+16
-0
scripts/build/build.sh
+4
-0
scripts/ci-metrics-publisher.sh
+12
-2
No files found.
scripts/build/build-all.sh
View file @
4d741ea3
...
...
@@ -2,6 +2,8 @@
# shellcheck disable=SC2086
# shellcheck source=./scripts/helpers/exit-if-fail.sh
source
"
$(
dirname
"
$0
"
)
/../helpers/exit-if-fail.sh"
#
# This script is executed from within the container.
#
...
...
@@ -24,6 +26,16 @@ CCX64_MUSL=/tmp/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc
cd
/go/src/github.com/grafana/grafana
echo
"current dir:
$(
pwd
)
"
function
reportFrontEndBuildTime
()
{
if
echo
"
$EXTRA_OPTS
"
|
grep
-vq
enterprise
;
then
# Only report for build job
# build-enterprise happens right after build on master
# so there is no need for reporting the same metric again
exit_if_fail ./scripts/ci-metrics-publisher.sh
"grafana.ci-performance.frontend-build=
$1
"
fi
}
if
[
"
$CIRCLE_TAG
"
!=
""
]
;
then
echo
"Building releases from tag
$CIRCLE_TAG
"
OPT
=
"-includeBuildId=false
${
EXTRA_OPTS
}
"
...
...
@@ -60,7 +72,11 @@ else
echo
"Building frontend and packaging incremental build for
$CIRCLE_BRANCH
"
fi
echo
"Building frontend"
start
=
$(
date +%s%N
)
go run build.go
${
OPT
}
build-frontend
runtime
=
$((
(
$(
date +%s%N
)
-
start
)/
1000000
))
echo
"Frontent build took
$runtime
"
reportFrontEndBuildTime
$runtime
if
[
-d
"dist"
]
;
then
rm
-rf
dist
...
...
scripts/build/build.sh
View file @
4d741ea3
...
...
@@ -98,7 +98,11 @@ function build_frontend() {
fi
yarn install
--pure-lockfile
--no-progress
echo
"Building frontend"
start
=
$(
date +%s%N
)
go run build.go
${
OPT
}
build-frontend
runtime
=
$((
(
$(
date +%s%N
)
-
start
)/
1000000
))
echo
"Frontent build took:
$runtime
ms"
echo
"FRONTEND: finished"
}
...
...
scripts/ci-metrics-publisher.sh
View file @
4d741ea3
...
...
@@ -6,13 +6,23 @@ data=""
for
((
i
=
1
;
i <
=
$#;
i++
))
;
do
remainder
=
"
${
!i
}
"
first
=
"
${
remainder
%%=*
}
"
;
remainder
=
"
${
remainder
#*=
}
"
# Find everything until last = character (= is included in the result)
# This allows to add tags to metric names
metricName
=
$(
grep
-o
"
\(
.*
\)
="
<<<
$remainder
)
# Get the metric value
value
=
${
remainder
#
"
$metricName
"
}
# Remove remaining = character from metric name
metricName
=
${
metricName
%?
}
;
if
[
-n
"
$data
"
]
;
then
data
=
"
$data
,"
fi
data
=
''
$data
'{"name": "'
${
first
}
'", "value": '
${
remainder
}
', "interval": 60, "mtype": "gauge", "time": '
$(
date +%s
)
'}'
data
=
''
$data
'{"name": "'
${
metricName
}
'", "value": '
${
value
}
', "interval": 60, "mtype": "gauge", "time": '
$(
date +%s
)
'}'
done
echo
"Publishing metrics:"
echo
"
$data
"
curl
"https://6371:
$GRAFANA_MISC_STATS_API_KEY
@graphite-us-central1.grafana.net/metrics"
\
-H
'Content-type: application/json'
\
-d
"[
$data
]"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment