Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for processing_time_ms state #187

Merged
merged 1 commit into from
Nov 12, 2024
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
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
Loading