Skip to content

Commit 0e9e1b0

Browse files
committed
Add IsIdempotent to ObservedQuery and ObservedBatch
1 parent bf16ec3 commit 0e9e1b0

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

session.go

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,16 +1135,17 @@ func (q *Query) attempt(keyspace string, end, start time.Time, iter *Iter, host
11351135

11361136
if q.observer != nil {
11371137
q.observer.ObserveQuery(q.Context(), ObservedQuery{
1138-
Keyspace: keyspace,
1139-
Statement: q.stmt,
1140-
Values: q.values,
1141-
Start: start,
1142-
End: end,
1143-
Rows: iter.numRows,
1144-
Host: host,
1145-
Metrics: metricsForHost,
1146-
Err: iter.err,
1147-
Attempt: attempt,
1138+
Keyspace: keyspace,
1139+
Statement: q.stmt,
1140+
IsIdempotent: q.IsIdempotent(),
1141+
Values: q.values,
1142+
Start: start,
1143+
End: end,
1144+
Rows: iter.numRows,
1145+
Host: host,
1146+
Metrics: metricsForHost,
1147+
Err: iter.err,
1148+
Attempt: attempt,
11481149
})
11491150
}
11501151
}
@@ -1993,11 +1994,12 @@ func (b *Batch) attempt(keyspace string, end, start time.Time, iter *Iter, host
19931994
}
19941995

19951996
b.observer.ObserveBatch(b.Context(), ObservedBatch{
1996-
Keyspace: keyspace,
1997-
Statements: statements,
1998-
Values: values,
1999-
Start: start,
2000-
End: end,
1997+
Keyspace: keyspace,
1998+
Statements: statements,
1999+
IsIdempotent: b.IsIdempotent(),
2000+
Values: values,
2001+
Start: start,
2002+
End: end,
20012003
// Rows not used in batch observations // TODO - might be able to support it when using BatchCAS
20022004
Host: host,
20032005
Metrics: metricsForHost,
@@ -2226,6 +2228,9 @@ type ObservedQuery struct {
22262228
// Do not modify the values here, they are shared with multiple goroutines.
22272229
Values []interface{}
22282230

2231+
// IsIdempotent is true if the query is marked as idempotent.
2232+
IsIdempotent bool
2233+
22292234
Start time.Time // time immediately before the query was called
22302235
End time.Time // time immediately after the query returned
22312236

@@ -2263,6 +2268,9 @@ type ObservedBatch struct {
22632268
Keyspace string
22642269
Statements []string
22652270

2271+
// IsIdempotent is true if the query is marked as idempotent.
2272+
IsIdempotent bool
2273+
22662274
// Values holds a slice of bound values for each statement.
22672275
// Values[i] are bound values passed to Statements[i].
22682276
// Do not modify the values here, they are shared with multiple goroutines.

0 commit comments

Comments
 (0)