From 139c604b99ef10c25684ac152f81c23c068d6d24 Mon Sep 17 00:00:00 2001 From: mayankpande88 Date: Sat, 3 Oct 2026 23:34:48 +0530 Subject: [PATCH] fix(python): publish raw austin profiles as .txt, not .svg austin had no case in GetFileExtension and fell through to the ".svg" default, so a raw memory profile shipped as agent-raw--1.svg.gz. Consumers that choose a renderer by suffix drew the text as an image. The e2e check now asserts the .txt.gz name. --- internal/agent/profiler/common/common.go | 5 ++++- internal/agent/profiler/common/common_test.go | 7 +++++++ test/e2e/python-austin.sh | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/internal/agent/profiler/common/common.go b/internal/agent/profiler/common/common.go index 929bf2f..611628b 100644 --- a/internal/agent/profiler/common/common.go +++ b/internal/agent/profiler/common/common.go @@ -70,7 +70,10 @@ func GetFileExtension(tool api.ProfilingTool, outputType api.OutputType) string // api.FlameGraph return ".svg" } - case api.Bpf, api.Perf: + // austin had no case and fell through to ".svg", so a raw (text) memory + // profile shipped as agent-raw--1.svg.gz — and consumers that pick a + // renderer by suffix drew it as a broken image. + case api.Bpf, api.Perf, api.Austin: switch outputType { case api.Raw: return ".txt" diff --git a/internal/agent/profiler/common/common_test.go b/internal/agent/profiler/common/common_test.go index 80db379..98e97fc 100644 --- a/internal/agent/profiler/common/common_test.go +++ b/internal/agent/profiler/common/common_test.go @@ -2,6 +2,7 @@ package common import ( "path/filepath" + "strings" "testing" "github.com/nudgebee/application-profiler/api" @@ -569,3 +570,9 @@ func TestGetFileExtension(t *testing.T) { }) } } + +func TestGetFileExtension_Austin(t *testing.T) { + assert.Equal(t, ".txt", GetFileExtension(api.Austin, api.Raw), "a raw austin profile is text") + assert.Equal(t, ".svg", GetFileExtension(api.Austin, api.FlameGraph)) + assert.True(t, strings.HasSuffix(GetResultFile("/tmp", api.Austin, api.Raw, "42", 1), "-42-1.txt")) +} diff --git a/test/e2e/python-austin.sh b/test/e2e/python-austin.sh index c798bed..57cdcb7 100755 --- a/test/e2e/python-austin.sh +++ b/test/e2e/python-austin.sh @@ -65,6 +65,11 @@ profile() { docker logs "$agent" >&2 return 1 fi + # Consumers pick a renderer by suffix; a raw profile must not look like an SVG. + case "$file" in + *.txt.gz) ;; + *) echo "raw profile published as $file, want *.txt.gz" >&2; return 1 ;; + esac docker cp -q "$agent:$file" "$work/profile.gz" gzip -dc "$work/profile.gz" }