Skip to content

Commit

Permalink
ObservedQuery,ObservedBatch: replace string address with hostinfo (#1138
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Zariel committed Jun 2, 2018
1 parent beb14e3 commit 651d6b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions query_executor.go
Expand Up @@ -6,7 +6,7 @@ import (

type ExecutableQuery interface {
execute(conn *Conn) *Iter
attempt(keyspace string, end, start time.Time, iter *Iter, address string)
attempt(keyspace string, end, start time.Time, iter *Iter, host *HostInfo)
retryPolicy() RetryPolicy
GetRoutingKey() ([]byte, error)
Keyspace() string
Expand All @@ -23,7 +23,7 @@ func (q *queryExecutor) attemptQuery(qry ExecutableQuery, conn *Conn) *Iter {
iter := qry.execute(conn)
end := time.Now()

qry.attempt(q.pool.keyspace, end, start, iter, conn.Address())
qry.attempt(q.pool.keyspace, end, start, iter, conn.host)

return iter
}
Expand Down
12 changes: 6 additions & 6 deletions session.go
Expand Up @@ -807,7 +807,7 @@ func (q *Query) execute(conn *Conn) *Iter {
return conn.executeQuery(q)
}

func (q *Query) attempt(keyspace string, end, start time.Time, iter *Iter, address string) {
func (q *Query) attempt(keyspace string, end, start time.Time, iter *Iter, host *HostInfo) {
q.attempts++
q.totalLatency += end.Sub(start).Nanoseconds()
// TODO: track latencies per host and things as well instead of just total
Expand All @@ -819,7 +819,7 @@ func (q *Query) attempt(keyspace string, end, start time.Time, iter *Iter, addre
Start: start,
End: end,
Rows: iter.numRows,
Host: address,
Host: host,
Err: iter.err,
})
}
Expand Down Expand Up @@ -1524,7 +1524,7 @@ func (b *Batch) WithTimestamp(timestamp int64) *Batch {
return b
}

func (b *Batch) attempt(keyspace string, end, start time.Time, iter *Iter, address string) {
func (b *Batch) attempt(keyspace string, end, start time.Time, iter *Iter, host *HostInfo) {
b.attempts++
b.totalLatency += end.Sub(start).Nanoseconds()
// TODO: track latencies per host and things as well instead of just total
Expand All @@ -1544,7 +1544,7 @@ func (b *Batch) attempt(keyspace string, end, start time.Time, iter *Iter, addre
Start: start,
End: end,
// Rows not used in batch observations // TODO - might be able to support it when using BatchCAS
Host: address,
Host: host,
Err: iter.err,
})
}
Expand Down Expand Up @@ -1695,7 +1695,7 @@ type ObservedQuery struct {
Rows int

// Host is the informations about the host that performed the query
Host string
Host *HostInfo

// Err is the error in the query.
// It only tracks network errors or errors of bad cassandra syntax, in particular selects with no match return nil error
Expand All @@ -1720,7 +1720,7 @@ type ObservedBatch struct {
End time.Time // time immediately after the batch query returned

// Host is the informations about the host that performed the batch
Host string
Host *HostInfo

// Err is the error in the batch query.
// It only tracks network errors or errors of bad cassandra syntax, in particular selects with no match return nil error
Expand Down

0 comments on commit 651d6b1

Please sign in to comment.