// Stats exposes some useful metrics to monitor an Olric node.
Stats exposes some useful metrics to monitor an Olric node.
// Stats exposes some useful metrics to monitor an Olric node .
func (c *Client) Stats(addr string, options ...StatsOption) (stats.Stats, error) {
	var extra protocol.StatsExtra
	for _, opt := range options {
		opt(&extra)
	}
	s := stats.Stats{}
	req := protocol.NewSystemMessage(protocol.OpStats)
	req.SetExtra(extra)
	resp, err := c.client.RequestTo(addr, req)
	if err != nil {
		return s, err
	}
	err = checkStatusCode(resp)
	if err != nil {
		return s, err
	}
	err = msgpack.Unmarshal(resp.Value(), &s)
	if err != nil {
		return s, err
	}
	return s, nil
}
func ( c * Client ) Stats ( addr string , options ... StatsOption ) ( stats . Stats , error ) { var extra protocol . StatsExtra for _ , opt := range options { opt ( & extra ) } s := stats . Stats { } req := protocol . NewSystemMessage ( protocol . OpStats ) req . SetExtra ( extra ) resp , err := c . client . RequestTo ( addr , req ) if err != nil { return s , err } err = checkStatusCode ( resp ) if err != nil { return s , err } err = msgpack . Unmarshal ( resp . Value ( ) , & s ) if err != nil { return s , err } return s , nil }
Stats exposes some useful metrics to monitor an Olric node.
Stats exposes some useful metrics to monitor an Olric node .