Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

timecraft: add trace command #43

Merged
merged 10 commits into from
Jun 6, 2023
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: 2 additions & 3 deletions describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

pprof "github.com/google/pprof/profile"
"github.com/google/uuid"
"github.com/stealthrocket/timecraft/format"
"github.com/stealthrocket/timecraft/internal/print/human"
"github.com/stealthrocket/timecraft/internal/print/jsonprint"
Expand Down Expand Up @@ -366,9 +365,9 @@ func descriptorAndData(desc *format.Descriptor, data any) any {
}

func lookupProcessByLogID(ctx context.Context, reg *timemachine.Registry, id string) (format.UUID, *format.Descriptor, *format.Process, error) {
processID, err := uuid.Parse(id)
processID, err := parseProcessID(id)
if err != nil {
return processID, nil, nil, errors.New(`malformed process id (not a UUID)`)
return processID, nil, nil, err
}
manifest, err := reg.LookupLogManifest(ctx, processID)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions export.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"io"
"os"

"github.com/google/uuid"
"github.com/stealthrocket/timecraft/format"
)

Expand Down Expand Up @@ -61,9 +60,9 @@ func export(ctx context.Context, args []string) error {

var hash format.Hash
if resource.typ == "process" {
processID, err := uuid.Parse(args[1])
processID, err := parseProcessID(args[1])
if err != nil {
return errors.New(`malformed process id (not a UUID)`)
return err
}
manifest, err := registry.LookupLogManifest(ctx, processID)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3
github.com/google/uuid v1.3.0
github.com/klauspost/compress v1.16.5
github.com/stealthrocket/wasi-go v0.3.1
github.com/stealthrocket/wasi-go v0.3.2
github.com/stealthrocket/wazergo v0.19.0
github.com/stealthrocket/wzprof v0.1.5
github.com/tetratelabs/wazero v1.1.1-0.20230522055633-256b7a4bf970
Expand Down
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ github.com/stealthrocket/wasi-go v0.3.1-0.20230603195135-80f8c0d13ce3 h1:rBxTTdW
github.com/stealthrocket/wasi-go v0.3.1-0.20230603195135-80f8c0d13ce3/go.mod h1:LBhZHvAroNNQTejkVTMJZ01ssj3jXF+3Lkbru4cTzGQ=
github.com/stealthrocket/wasi-go v0.3.1 h1:S5fy66QFbYdhBA/sK8g0Vdm38n56PCsq/0bV76HFbZM=
github.com/stealthrocket/wasi-go v0.3.1/go.mod h1:LBhZHvAroNNQTejkVTMJZ01ssj3jXF+3Lkbru4cTzGQ=
github.com/stealthrocket/wasi-go v0.3.2-0.20230604180758-b724aaba60ad h1:5v+GFNFvzaMuYklGhqu5kl1Cj7hkR3Ia9G0WrmEWcD8=
github.com/stealthrocket/wasi-go v0.3.2-0.20230604180758-b724aaba60ad/go.mod h1:LBhZHvAroNNQTejkVTMJZ01ssj3jXF+3Lkbru4cTzGQ=
github.com/stealthrocket/wasi-go v0.3.2-0.20230604190248-9463acc8381d h1:MSwJU5X7hpy64tJezvNs57qVOH3yjCMbv6Xlg1jqPaE=
github.com/stealthrocket/wasi-go v0.3.2-0.20230604190248-9463acc8381d/go.mod h1:LBhZHvAroNNQTejkVTMJZ01ssj3jXF+3Lkbru4cTzGQ=
github.com/stealthrocket/wasi-go v0.3.2-0.20230605001215-37616feebb15 h1:kMeRG7sDa39KtH3z0wuVz0djquExJoc+uIVNtec2GQA=
github.com/stealthrocket/wasi-go v0.3.2-0.20230605001215-37616feebb15/go.mod h1:LBhZHvAroNNQTejkVTMJZ01ssj3jXF+3Lkbru4cTzGQ=
github.com/stealthrocket/wasi-go v0.3.2 h1:69jmfwmWPGgL6U5aSFrSIKq9ea3WuqFfHuq9bizx0ZE=
github.com/stealthrocket/wasi-go v0.3.2/go.mod h1:LBhZHvAroNNQTejkVTMJZ01ssj3jXF+3Lkbru4cTzGQ=
github.com/stealthrocket/wazergo v0.19.0 h1:0ZBya2fBURvV+I2hGl0vcuQ8dgoUvllxQ7aYlZSA5nI=
github.com/stealthrocket/wazergo v0.19.0/go.mod h1:riI0hxw4ndZA5e6z7PesHg2BtTftcZaMxRcoiGGipTs=
github.com/stealthrocket/wzprof v0.1.5 h1:abEwQF9KtqV7UQ0hWk7431vul9/FxOg1eRCqwEKo9/4=
Expand Down
3 changes: 3 additions & 0 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Runtime Commands:
Debugging Commands:
logs Print the logs for a module execution
profile Generate performance profile from execution records
trace Generate traces from execution records

Other Commands:
config View or edit the timecraft configuration
Expand Down Expand Up @@ -70,6 +71,8 @@ func help(ctx context.Context, args []string) error {
msg = runUsage
case "replay":
msg = replayUsage
case "trace":
msg = traceUsage
case "version":
msg = versionUsage
default:
Expand Down
Loading
Loading