Skip to content

Commit 3821b24

Browse files
committed
Fixed scripts
1 parent 5f24705 commit 3821b24

File tree

5 files changed

+44
-4
lines changed

5 files changed

+44
-4
lines changed

ydb/tests/tools/fqrun/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ sync_dir
55
*.conf
66
*.parquet
77
*.json
8+
*.yaml

ydb/tests/tools/kqprun/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ Tool can be used to execute queries by using kikimr provider.
44

55
For profiling memory allocations build kqprun with ya make flag `-D PROFILE_MEMORY_ALLOCATIONS`.
66

7+
## Scripts
8+
9+
* `flame_graph.sh` - script for collecting flame graphs in svg format, usage:
10+
```(bash)
11+
./flame_graph.sh [graph collection time in seconds]
12+
```
13+
14+
* `start_prometheus.sh` - script for starting prometheus web UI, can be used for counters visualisation (kqprun should be runned with flag `-M <monitoring port>`), usage:
15+
```(bash)
16+
./start_prometheus.sh <monitoring port> <web UI port> [config path]
17+
```
18+
19+
* `start_connector.sh` - script for starting local FQ connector, usage:
20+
```(bash)
21+
./start_connector.sh <connector port> [config path]
22+
```
23+
724
## Examples
825
926
### Queries

ydb/tests/tools/kqprun/flame_graph.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
set -eux
44

5+
function cleanup {
6+
sudo rm ./profdata
7+
rm ./profdata.txt
8+
}
9+
trap cleanup EXIT
10+
511
if [ $# -gt 1 ]; then
612
echo "Too many arguments"
713
exit -1
@@ -12,6 +18,8 @@ kqprun_pid=$(pgrep -u $USER kqprun)
1218
sudo perf record -F 50 --call-graph dwarf -g --proc-map-timeout=10000 --pid $kqprun_pid -v -o profdata -- sleep ${1:-'30'}
1319
sudo perf script -i profdata > profdata.txt
1420

15-
flame_graph_tool="../../../../contrib/tools/flame-graph/"
21+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
22+
23+
flame_graph_tool="$SCRIPT_DIR/../../../../contrib/tools/flame-graph/"
1624

1725
${flame_graph_tool}/stackcollapse-perf.pl profdata.txt | ${flame_graph_tool}/flamegraph.pl > profdata.svg

ydb/tests/tools/kqprun/start_connector.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22

33
set -eux
44

5+
function cleanup {
6+
rm ./connector_config.yaml
7+
}
8+
trap cleanup EXIT
9+
510
if [ $# -le 0 ]; then
611
echo "Please provide connector port (value of Generic::Connector::Endpoint::Port in config)"
712
exit -1
813
fi
914

10-
if [ $# -gt 1 ]; then
15+
if [ $# -gt 2 ]; then
1116
echo "Too many arguments"
1217
exit -1
1318
fi
@@ -17,7 +22,9 @@ if netstat -tuln | grep ":$1"; then
1722
exit -1
1823
fi
1924

20-
cp ${3:-'./configuration/connector_config.yaml'} ./connector_config.yaml
25+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
26+
27+
cp ${2:-"$SCRIPT_DIR/configuration/connector_config.yaml"} ./connector_config.yaml
2128
sed -i "s/\${TARGET_PORT}/$1/g" ./connector_config.yaml
2229

2330
docker run --rm --name=fq-connector-go-$1 --network host -v ./connector_config.yaml:/opt/ydb/cfg/fq-connector-go.yaml ghcr.io/ydb-platform/fq-connector-go:latest

ydb/tests/tools/kqprun/start_prometheus.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -eux
44

5+
function cleanup {
6+
rm ./prometheus_config.yaml
7+
}
8+
trap cleanup EXIT
9+
510
if [ $# -le 0 ]; then
611
echo "Please provide monitoring port to listen (value of -M argument)"
712
exit -1
@@ -25,7 +30,9 @@ if netstat -tuln | grep ":$2"; then
2530
exit -1
2631
fi
2732

28-
cp ${3:-'./configuration/prometheus_config.yaml'} ./prometheus_config.yaml
33+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
34+
35+
cp ${3:-"$SCRIPT_DIR/configuration/prometheus_config.yaml"} ./prometheus_config.yaml
2936
sed -i "s/\${TARGET_PORT}/$1/g" ./prometheus_config.yaml
3037

3138
docker run --rm --name=prometeus-$1 --network host -v ./prometheus_config.yaml:/etc/prometheus/prometheus.yml prom/prometheus --config.file=/etc/prometheus/prometheus.yml --web.listen-address=:$2

0 commit comments

Comments
 (0)