Skip to content

Commit f91119e

Browse files
committed
fix(profiler): Add missing script to setup profiling
1 parent 87e5fcc commit f91119e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

prof-reload.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# TODO: Might this file is redundant and we can use dev-reload
5+
# script instead?
6+
7+
GREEN='\033[0;32m'
8+
YELLOW='\033[1;33m'
9+
BLUE='\033[0;34m'
10+
NC='\033[0m'
11+
12+
PROFILER=${1:-flamegraph}
13+
echo -e "${BLUE}Using profiler: ${GREEN}${PROFILER}${NC}"
14+
15+
# Ensure profiling output directory exists
16+
mkdir -p contrib/profiling/indexer-service
17+
mkdir -p contrib/profiling/tap-agent
18+
19+
# 1. Compile the binaries locally
20+
# and use profiling feature flag
21+
# for flamegraph
22+
echo -e "${BLUE}Compiling Rust code...${NC}"
23+
RUSTFLAGS='-C force-frame-pointers=yes' CARGO_PROFILE_RELEASE_DEBUG=true cargo build --release --features "profiling"
24+
25+
# 2. Check if compilation succeeded
26+
if [ $? -ne 0 ]; then
27+
echo -e "${YELLOW}Compilation failed. Not restarting containers.${NC}"
28+
exit 1
29+
fi
30+
31+
echo -e "${GREEN}Compilation successful!${NC}"
32+
33+
echo -e "${BLUE}Restarting indexer-service with profiling...${NC}"
34+
cd contrib
35+
36+
# Stop the existing service and remove container
37+
# to avoid conflicts. probably not needed and a restart could
38+
# be enough.
39+
docker compose -f docker-compose.prof.yml stop indexer-service tap-agent
40+
docker rm -f indexer-service tap-agent 2>/dev/null || true
41+
42+
export PROFILER=$PROFILER
43+
docker compose -f docker-compose.prof.yml up -d indexer-service tap-agent
44+
45+
echo -e "${GREEN}Done! Containers restarted with profiling.${NC}"

0 commit comments

Comments
 (0)