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" }