2015-11-19 05:45:05 +00:00
|
|
|
package rabbithole
|
|
|
|
|
|
|
|
import "strconv"
|
|
|
|
|
|
|
|
// Extra arguments as a map (on queues, bindings, etc)
|
|
|
|
type Properties map[string]interface{}
|
|
|
|
|
|
|
|
// Port used by RabbitMQ or clients
|
|
|
|
type Port int
|
|
|
|
|
|
|
|
func (p *Port) UnmarshalJSON(b []byte) error {
|
|
|
|
stringValue := string(b)
|
|
|
|
var parsed int64
|
|
|
|
var err error
|
|
|
|
if stringValue[0] == '"' && stringValue[len(stringValue)-1] == '"' {
|
|
|
|
parsed, err = strconv.ParseInt(stringValue[1:len(stringValue)-1], 10, 32)
|
|
|
|
} else {
|
|
|
|
parsed, err = strconv.ParseInt(stringValue, 10, 32)
|
|
|
|
}
|
|
|
|
if err == nil {
|
|
|
|
*p = Port(int(parsed))
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-01-04 21:47:38 +00:00
|
|
|
// RateDetailSample single touple
|
|
|
|
type RateDetailSample struct {
|
|
|
|
Sample int64 `json:"sample"`
|
|
|
|
Timestamp int64 `json:"timestamp"`
|
|
|
|
}
|
|
|
|
|
2015-11-19 05:45:05 +00:00
|
|
|
// Rate of change of a numerical value
|
|
|
|
type RateDetails struct {
|
2017-01-04 21:47:38 +00:00
|
|
|
Rate float32 `json:"rate"`
|
|
|
|
Samples []RateDetailSample `json:"samples"`
|
2015-11-19 05:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RabbitMQ context (Erlang app) running on
|
|
|
|
// a node
|
|
|
|
type BrokerContext struct {
|
|
|
|
Node string `json:"node"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Path string `json:"path"`
|
|
|
|
Port Port `json:"port"`
|
|
|
|
Ignore bool `json:"ignore_in_use"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Basic published messages statistics
|
|
|
|
type MessageStats struct {
|
2017-01-04 21:47:38 +00:00
|
|
|
Publish int64 `json:"publish"`
|
2016-06-08 14:33:08 +00:00
|
|
|
PublishDetails RateDetails `json:"publish_details"`
|
2017-01-04 21:47:38 +00:00
|
|
|
Deliver int64 `json:"deliver"`
|
2016-06-08 14:33:08 +00:00
|
|
|
DeliverDetails RateDetails `json:"deliver_details"`
|
2017-01-04 21:47:38 +00:00
|
|
|
DeliverNoAck int64 `json:"deliver_noack"`
|
2016-06-08 14:33:08 +00:00
|
|
|
DeliverNoAckDetails RateDetails `json:"deliver_noack_details"`
|
2017-01-04 21:47:38 +00:00
|
|
|
DeliverGet int64 `json:"deliver_get"`
|
2016-06-08 14:33:08 +00:00
|
|
|
DeliverGetDetails RateDetails `json:"deliver_get_details"`
|
2017-01-04 21:47:38 +00:00
|
|
|
Redeliver int64 `json:"redeliver"`
|
2016-06-08 14:33:08 +00:00
|
|
|
RedeliverDetails RateDetails `json:"redeliver_details"`
|
2017-01-04 21:47:38 +00:00
|
|
|
Get int64 `json:"get"`
|
2016-06-08 14:33:08 +00:00
|
|
|
GetDetails RateDetails `json:"get_details"`
|
2017-01-04 21:47:38 +00:00
|
|
|
GetNoAck int64 `json:"get_no_ack"`
|
2016-06-08 14:33:08 +00:00
|
|
|
GetNoAckDetails RateDetails `json:"get_no_ack_details"`
|
2015-11-19 05:45:05 +00:00
|
|
|
}
|