Skip to content

Commit

Permalink
Add javadocs for query stats classes
Browse files Browse the repository at this point in the history
  • Loading branch information
pnwpedro committed Nov 6, 2024
1 parent c0cb361 commit 3311626
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 89 deletions.
59 changes: 41 additions & 18 deletions src/main/java/com/fauna/client/QueryStatsSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,39 @@ public final class QueryStatsSummary {
private final int rateLimitedComputeQueryCount;
private final int rateLimitedWriteQueryCount;

/**
* @param readOps the read ops
* @param computeOps the compute ops
* @param writeOps the write ops
* @param queryTimeMs the query time in milliseconds
* @param contentionRetries the number of retries due to
* contention
* @param storageBytesRead the number of storage bytes read
* @param storageBytesWrite the number of storage bytes written
* @param processingTimeMs the event processing time in
* milliseconds
* @param queryCount the number of queries included in the
* summary
* @param rateLimitedReadQueryCount the count of queries limited
* by read ops
* @param rateLimitedComputeQueryCount the count of queries limited
* by compute ops
* @param rateLimitedWriteQueryCount the count of queries limited
* by write ops
*/
public QueryStatsSummary(
long readOps,
long computeOps,
long writeOps,
long queryTimeMs,
int contentionRetries,
long storageBytesRead,
long storageBytesWrite,
long processingTimeMs,
int queryCount,
int rateLimitedReadQueryCount,
int rateLimitedComputeQueryCount,
int rateLimitedWriteQueryCount
final long readOps,
final long computeOps,
final long writeOps,
final long queryTimeMs,
final int contentionRetries,
final long storageBytesRead,
final long storageBytesWrite,
final long processingTimeMs,
final int queryCount,
final int rateLimitedReadQueryCount,
final int rateLimitedComputeQueryCount,
final int rateLimitedWriteQueryCount
) {
this.readOps = readOps;
this.computeOps = computeOps;
Expand All @@ -50,7 +70,7 @@ public QueryStatsSummary(
}

/**
* Gets the aggregate read ops.
* Gets the aggregate Transactional Read Operations (TROs) recorded.
*
* @return A long representing the aggregate read ops
*/
Expand All @@ -59,7 +79,7 @@ public long getReadOps() {
}

/**
* Gets the aggregate compute ops.
* Gets the aggregate Transactional Compute Operations (TCOs) recorded.
*
* @return A long representing the aggregate compute ops
*/
Expand All @@ -68,7 +88,7 @@ public long getComputeOps() {
}

/**
* Gets the aggregate write ops.
* Gets the aggregate Transactional Write Operations (TWOs) recorded.
*
* @return A long representing the aggregate write ops
*/
Expand Down Expand Up @@ -106,16 +126,19 @@ public long getStorageBytesRead() {
/**
* Gets the aggregate storage bytes written.
*
* @return A long representing the aggregate number of storage bytes written.
* @return A long representing the aggregate number of storage bytes
* written.
*/
public long getStorageBytesWrite() {
return storageBytesWrite;
}

/**
* Gets the aggregate processing time in milliseconds.
* Gets the aggregate event processing time in milliseconds.
* Applies to Streams and Feeds only.
*
* @return A long representing the aggregate processing time in milliseconds.
* @return A long representing the aggregate processing time in
* milliseconds.
*/
public long getProcessingTimeMs() {
return processingTimeMs;
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/fauna/client/StatsCollectorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ public class StatsCollectorImpl implements StatsCollector {

@Override
public void add(QueryStats stats) {
readOps.addAndGet(stats.readOps);
computeOps.addAndGet(stats.computeOps);
writeOps.addAndGet(stats.writeOps);
queryTimeMs.addAndGet(stats.queryTimeMs);
contentionRetries.addAndGet(stats.contentionRetries);
storageBytesRead.addAndGet(stats.storageBytesRead);
storageBytesWrite.addAndGet(stats.storageBytesWrite);
processingTimeMs.addAndGet(stats.processingTimeMs);
readOps.addAndGet(stats.getReadOps());
computeOps.addAndGet(stats.getComputeOps());
writeOps.addAndGet(stats.getWriteOps());
queryTimeMs.addAndGet(stats.getQueryTimeMs());
contentionRetries.addAndGet(stats.getContentionRetries());
storageBytesRead.addAndGet(stats.getStorageBytesRead());
storageBytesWrite.addAndGet(stats.getStorageBytesWrite());
processingTimeMs.addAndGet(stats.getProcessingTimeMs());

List<String> rateLimitsHit = stats.rateLimitsHit;
List<String> rateLimitsHit = stats.getRateLimitsHit();
rateLimitsHit.forEach(limitHit -> {
switch (limitHit) {
case RATE_LIMIT_READ_OPS:
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/fauna/client/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* Classes related initializing, configuring, and using a client to interact
* with Fauna.
*/
package com.fauna.client;
Loading

0 comments on commit 3311626

Please sign in to comment.