Skip to content

Commit

Permalink
Merge pull request #53 from chanzuckerberg/edu/file-after-event
Browse files Browse the repository at this point in the history
Read the arbitrary fields file _after_ the command instead of before to allow the command to use it to add additional data to the command span itself.
  • Loading branch information
maplebed authored Oct 18, 2019
2 parents 75759c9 + 3b82fca commit 943bf98
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ will be launched via "bash -c" using "exec".`,
defer ev.Send()

providerInfo(*ciProvider, ev)
arbitraryFields(*filename, ev)

spanBytes := make([]byte, 16)
rand.Read(spanBytes)
Expand All @@ -59,6 +58,10 @@ will be launched via "bash -c" using "exec".`,
err := runCommand(subcmd)
dur := time.Since(start)

// Annotate with arbitrary fields after the command runs
// this way we can consume a file if the command itself generated one
arbitraryFields(*filename, ev)

ev.Add(map[string]interface{}{
"trace.parent_id": stepID,
"trace.span_id": fmt.Sprintf("%x", spanBytes),
Expand Down

0 comments on commit 943bf98

Please sign in to comment.