cartridge-java
cartridge-java copied to clipboard
Implement statistics API
For monitoring the internal driver state under load, the users should be able to get the following momentary parameters from the driver API:
- Current number of connections (dead, alive)
- Total number of processed requests
- For each connection:
- Time when the connection established
- Total number of processed requests
- Number of requests currently being processed
- Last time of any activity within the connection
Requirements:
- Performance of the operations with the driver shouldn't be noticeably affected
- Collecting the statistics via API should not affect the performance (it may be called periodically by the user)
- If the driver is closed, its "current" counters must be equal to zero
- When the driver is created, all counters must be initialized as zero
Proposed API:
New method TarantoolClient#statistics()
which returns the following structure:
class TarantoolStatistics {
public int connectionsTotal;
public int connectionsAlive;
public BigDecimal requestsTotal;
public Map<String, List<TarantoolConnectionStatistics>> connectionsStatistics; // Remote address mapped to connections
}
class TarantoolConnectionStatistics {
public boolean isAlive;
public LocalDateTime establishedAt;
public LocalDateTime closedAt; // will be null if is not closed yet
public BigDecimal requestsTotal;
public int requestsCurrent;
public LocalDateTime lastActivityTime; // may be not very accurate, with the precision of milliseconds
}
Looks like an epic.