Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(error-tracking): build cymbal with frame pointers for profiling (#68035)

Catalin Irimie5797d1c46955
diff --git a/.github/rust-images.yml b/.github/rust-images.yml
index a57916d686d4..e667d1b30191 100644
--- a/.github/rust-images.yml
+++ b/.github/rust-images.yml
@@ -37,6 +37,9 @@
- image: cymbal
dockerfile: ./rust/Dockerfile
project: 8dq0xkk0ck
+ # Frame pointers so the eBPF profiler can walk cymbal's native stacks on
+ # aarch64 (see EXTRA_RUSTFLAGS in rust/Dockerfile).
+ extra_rustflags: -C force-frame-pointers=yes
- image: embedding-worker
dockerfile: ./rust/Dockerfile
diff --git a/.github/workflows/_rust-build-images.yml b/.github/workflows/_rust-build-images.yml
index 4f5986b5c558..e9ea4cec7e9b 100644
--- a/.github/workflows/_rust-build-images.yml
+++ b/.github/workflows/_rust-build-images.yml
@@ -171,6 +171,7 @@ jobs:
SCCACHE_NO_DAEMON=1
BIN=${{ matrix.bin || matrix.image }}
BUILD_FEATURES=${{ matrix.features || '' }}
+ EXTRA_RUSTFLAGS=${{ matrix.extra_rustflags || '' }}
SCCACHE_WEBDAV_KEY_PREFIX=${{ steps.sccache.outputs.cache-key-prefix }}
secrets: |
SCCACHE_WEBDAV_ENDPOINT=${{ steps.sccache.outputs.endpoint }}
diff --git a/rust/Dockerfile b/rust/Dockerfile
index 94c2c2567390..701eb359ba4e 100644
--- a/rust/Dockerfile
+++ b/rust/Dockerfile
@@ -18,6 +18,14 @@ WORKDIR /app
ARG BIN
ARG BUILD_FEATURES=""
ARG SCCACHE_WEBDAV_KEY_PREFIX
+# Extra rustc flags for specific images, set per-image in
+# .github/rust-images.yml (e.g. cymbal passes -C force-frame-pointers=yes so
+# the eBPF profiler can walk its native stacks on aarch64). Guarded exports
+# below because the RUSTFLAGS env var replaces [build].rustflags from
+# .cargo/config.toml entirely (no merging): when extra flags are set the
+# export re-adds --cfg tokio_unstable, and when unset RUSTFLAGS stays unset so
+# .cargo/config.toml keeps applying.
+ARG EXTRA_RUSTFLAGS=""
ENV PROTO_ROOT=../proto SCCACHE_WEBDAV_KEY_PREFIX=${SCCACHE_WEBDAV_KEY_PREFIX}
# Ensure working C compile setup (not installed by default in arm64 images)
@@ -30,6 +38,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,sharing=locked \
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
SCCACHE_NO_DAEMON=1 SCCACHE_START_SERVER=1 sccache 2>&1 & \
+ if [ -n "$EXTRA_RUSTFLAGS" ]; then export RUSTFLAGS="--cfg tokio_unstable $EXTRA_RUSTFLAGS"; fi && \
cargo chef cook --release --recipe-path recipe.json --bin $BIN ${BUILD_FEATURES:+--features $BUILD_FEATURES} && \
sccache --show-stats
@@ -44,6 +53,7 @@ RUN --mount=type=secret,id=SCCACHE_WEBDAV_ENDPOINT,required=false \
export SCCACHE_WEBDAV_TOKEN=$(cat /run/secrets/SCCACHE_WEBDAV_TOKEN); \
fi && \
SCCACHE_NO_DAEMON=1 SCCACHE_START_SERVER=1 sccache 2>&1 & \
+ if [ -n "$EXTRA_RUSTFLAGS" ]; then export RUSTFLAGS="--cfg tokio_unstable $EXTRA_RUSTFLAGS"; fi && \
cargo build --release --bin $BIN ${BUILD_FEATURES:+--features $BUILD_FEATURES} && \
sccache --show-stats