Add RPC/getRecentPerformanceSamples
This commit is contained in:
parent
76750a9d90
commit
3605c7b3ef
|
@ -0,0 +1,26 @@
|
|||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
bin "github.com/dfuse-io/binary"
|
||||
)
|
||||
|
||||
type GetRecentPerformanceSamplesResult struct {
|
||||
Slot bin.Uint64 `json:"slot"` // Slot in which sample was taken at
|
||||
NumTransactions bin.Uint64 `json:"numTransactions"` // Number of transactions in sample
|
||||
NumSlots bin.Uint64 `json:"numSlots"` // Number of slots in sample
|
||||
SamplePeriodSecs uint16 `json:"samplePeriodSecs"` // Number of seconds in a sample window
|
||||
}
|
||||
|
||||
// GetRecentPerformanceSamples returns a list of recent performance samples,
|
||||
// in reverse slot order. Performance samples are taken every 60 seconds
|
||||
// and include the number of transactions and slots that occur in a given time window.
|
||||
func (cl *Client) GetRecentPerformanceSamples(ctx context.Context, limit *int) (out []*GetRecentPerformanceSamplesResult, err error) {
|
||||
params := []interface{}{}
|
||||
if limit != nil {
|
||||
params = append(params, limit)
|
||||
}
|
||||
err = cl.rpcClient.CallFor(&out, "getRecentPerformanceSamples", params)
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue