Skip to content

Commit

Permalink
feat: Add support for processing_time_ms state (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
cynicaljoy authored Nov 12, 2024
1 parent 4e8b457 commit 07a62d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestDefaultClient(t *testing.T) {
assert.Zero(t, res.Stats.WriteOps, "should not have written any bytes")
assert.Zero(t, res.Stats.StorageBytesRead, "should not have read from storage")
assert.Zero(t, res.Stats.StorageBytesWrite, "should not have written to storage")
assert.Nil(t, res.Stats.ProcessingTimeMs, "should not have processing time ms")
})
})

Expand Down
3 changes: 3 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type Stats struct {
// StorageBytesWrite is the amount of data written to storage, in bytes.
StorageBytesWrite int `json:"storage_bytes_write"`

// ProcessingTimeMs is the amount of time producing the event, only applies to events.
ProcessingTimeMs *int `json:"processing_time_ms,omitempty"`

// Attempts is the number of times the client attempted to run the query.
Attempts int `json:"_"`
}
Expand Down
1 change: 1 addition & 0 deletions stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestStreaming(t *testing.T) {
err = events.Next(&event)
require.NoError(t, err)
require.Equal(t, fauna.StatusEvent, event.Type)
require.NotNil(t, event.Stats.ProcessingTimeMs)
})

t.Run("Fails on non-streamable values", func(t *testing.T) {
Expand Down

0 comments on commit 07a62d9

Please sign in to comment.