Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion internal/agent/profiler/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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-<pid>-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"
Expand Down
7 changes: 7 additions & 0 deletions internal/agent/profiler/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package common

import (
"path/filepath"
"strings"
"testing"

"github.com/nudgebee/application-profiler/api"
Expand Down Expand Up @@ -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"))
}
5 changes: 5 additions & 0 deletions test/e2e/python-austin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Loading