Skip to content

Commit 07a62d9

Browse files
author
Darren Cunningham
authored
feat: Add support for processing_time_ms state (#187)
1 parent 4e8b457 commit 07a62d9

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

client_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func TestDefaultClient(t *testing.T) {
4646
assert.Zero(t, res.Stats.WriteOps, "should not have written any bytes")
4747
assert.Zero(t, res.Stats.StorageBytesRead, "should not have read from storage")
4848
assert.Zero(t, res.Stats.StorageBytesWrite, "should not have written to storage")
49+
assert.Nil(t, res.Stats.ProcessingTimeMs, "should not have processing time ms")
4950
})
5051
})
5152

response.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ type Stats struct {
2424
// StorageBytesWrite is the amount of data written to storage, in bytes.
2525
StorageBytesWrite int `json:"storage_bytes_write"`
2626

27+
// ProcessingTimeMs is the amount of time producing the event, only applies to events.
28+
ProcessingTimeMs *int `json:"processing_time_ms,omitempty"`
29+
2730
// Attempts is the number of times the client attempted to run the query.
2831
Attempts int `json:"_"`
2932
}

stream_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func TestStreaming(t *testing.T) {
4040
err = events.Next(&event)
4141
require.NoError(t, err)
4242
require.Equal(t, fauna.StatusEvent, event.Type)
43+
require.NotNil(t, event.Stats.ProcessingTimeMs)
4344
})
4445

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

0 commit comments

Comments
 (0)