Ejemplo n.º 1
0
func (n *networkServer) GetStatus() *pb.Status {
	status := new(pb.Status)
	if n.status == nil {
		return status
	}
	status.System = stats.GetSystem()
	status.Component = stats.GetComponent()
	uplink := n.status.uplink.Snapshot()
	status.Uplink = &api.Rates{
		Rate1:  float32(uplink.Rate1()),
		Rate5:  float32(uplink.Rate5()),
		Rate15: float32(uplink.Rate15()),
	}
	downlink := n.status.downlink.Snapshot()
	status.Downlink = &api.Rates{
		Rate1:  float32(downlink.Rate1()),
		Rate5:  float32(downlink.Rate5()),
		Rate15: float32(downlink.Rate15()),
	}
	activations := n.status.activations.Snapshot()
	status.Activations = &api.Rates{
		Rate1:  float32(activations.Rate1()),
		Rate5:  float32(activations.Rate5()),
		Rate15: float32(activations.Rate15()),
	}
	return status
}
Ejemplo n.º 2
0
func (r *router) GetStatus() *pb.Status {
	status := new(pb.Status)
	if r.status == nil {
		return status
	}
	status.System = stats.GetSystem()
	status.Component = stats.GetComponent()
	uplink := r.status.uplink.Snapshot()
	status.Uplink = &api.Rates{
		Rate1:  float32(uplink.Rate1()),
		Rate5:  float32(uplink.Rate5()),
		Rate15: float32(uplink.Rate15()),
	}
	downlink := r.status.downlink.Snapshot()
	status.Downlink = &api.Rates{
		Rate1:  float32(downlink.Rate1()),
		Rate5:  float32(downlink.Rate5()),
		Rate15: float32(downlink.Rate15()),
	}
	activations := r.status.activations.Snapshot()
	status.Activations = &api.Rates{
		Rate1:  float32(activations.Rate1()),
		Rate5:  float32(activations.Rate5()),
		Rate15: float32(activations.Rate15()),
	}
	gatewayStatus := r.status.gatewayStatus.Snapshot()
	status.GatewayStatus = &api.Rates{
		Rate1:  float32(gatewayStatus.Rate1()),
		Rate5:  float32(gatewayStatus.Rate5()),
		Rate15: float32(gatewayStatus.Rate15()),
	}
	status.ConnectedGateways = uint32(r.status.connectedGateways.Snapshot().Value())
	status.ConnectedBrokers = uint32(r.status.connectedBrokers.Snapshot().Value())
	return status
}
Ejemplo n.º 3
0
func (b *broker) GetStatus() *pb.Status {
	status := new(pb.Status)
	if b.status == nil {
		return status
	}
	status.System = stats.GetSystem()
	status.Component = stats.GetComponent()
	uplink := b.status.uplink.Snapshot()
	status.Uplink = &api.Rates{
		Rate1:  float32(uplink.Rate1()),
		Rate5:  float32(uplink.Rate5()),
		Rate15: float32(uplink.Rate15()),
	}
	uplinkUnique := b.status.uplinkUnique.Snapshot()
	status.UplinkUnique = &api.Rates{
		Rate1:  float32(uplinkUnique.Rate1()),
		Rate5:  float32(uplinkUnique.Rate5()),
		Rate15: float32(uplinkUnique.Rate15()),
	}
	downlink := b.status.downlink.Snapshot()
	status.Downlink = &api.Rates{
		Rate1:  float32(downlink.Rate1()),
		Rate5:  float32(downlink.Rate5()),
		Rate15: float32(downlink.Rate15()),
	}
	activations := b.status.activations.Snapshot()
	status.Activations = &api.Rates{
		Rate1:  float32(activations.Rate1()),
		Rate5:  float32(activations.Rate5()),
		Rate15: float32(activations.Rate15()),
	}
	activationsUnique := b.status.activationsUnique.Snapshot()
	status.UplinkUnique = &api.Rates{
		Rate1:  float32(activationsUnique.Rate1()),
		Rate5:  float32(activationsUnique.Rate5()),
		Rate15: float32(activationsUnique.Rate15()),
	}
	deduplication := b.status.deduplication.Snapshot().Percentiles([]float64{0.01, 0.05, 0.10, 0.25, 0.50, 0.75, 0.90, 0.95, 0.99})
	status.Deduplication = &api.Percentiles{
		Percentile1:  float32(deduplication[0]),
		Percentile5:  float32(deduplication[1]),
		Percentile10: float32(deduplication[2]),
		Percentile25: float32(deduplication[3]),
		Percentile50: float32(deduplication[4]),
		Percentile75: float32(deduplication[5]),
		Percentile90: float32(deduplication[6]),
		Percentile95: float32(deduplication[7]),
		Percentile99: float32(deduplication[8]),
	}
	status.ConnectedRouters = uint32(b.status.connectedRouters.Snapshot().Value())
	status.ConnectedHandlers = uint32(b.status.connectedHandlers.Snapshot().Value())
	return status
}