Documentation ¶
Overview ¶
The oryx kxps package provides some kxps, for example:
N kbps, N k bits per seconds N krps, N k requests per seconds
over some duration for instance 10s, 30s, 5m, average.
The kbps is about the bitrate.
The krps is about the request or message rate.
The shared objects for kxps.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kbps ¶
type Kbps interface { // Start the kbps sample goroutine. Start() (err error) // Get the kbps in last 10s. Kbps10s() float64 // Get the kbps in last 30s. Kbps30s() float64 // Get the kbps in last 300s. Kbps300s() float64 // Get the kbps in average Average() float64 // When closed, this kbps should never use again. io.Closer }
The object to calc the kbps.
Example ¶
package main import ( "github.com/ossrs/go-oryx-lib/kxps" ) func main() { // user must provides the kbps source var source kxps.KbpsSource kbps := kxps.NewKbps(nil, source) defer kbps.Close() if err := kbps.Start(); err != nil { return } _ = kbps.Average() _ = kbps.Kbps10s() _ = kbps.Kbps30s() _ = kbps.Kbps300s() }
Output:
type KbpsSource ¶
type KbpsSource interface { // Get total number of bytes. TotalBytes() uint64 }
The source to stat the bitrate.
type Krps ¶
type Krps interface { // Start the krps sample goroutine. Start() (err error) // Get the rps in last 10s. Rps10s() float64 // Get the rps in last 30s. Rps30s() float64 // Get the rps in last 300s. Rps300s() float64 // Get the rps in average Average() float64 // When closed, this krps should never use again. io.Closer }
The object to calc the krps.
Example ¶
package main import ( "github.com/ossrs/go-oryx-lib/kxps" ) func main() { // user must provides the krps source var source kxps.KrpsSource krps := kxps.NewKrps(nil, source) defer krps.Close() if err := krps.Start(); err != nil { return } _ = krps.Average() _ = krps.Rps10s() _ = krps.Rps30s() _ = krps.Rps300s() }
Output:
type KrpsSource ¶
type KrpsSource interface { // Get total number of requests. NbRequests() uint64 }
The source to stat the requests.
Click to show internal directories.
Click to hide internal directories.