Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add javadocs for QueryStats #170

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 64 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,62 @@ public final class QueryStatsSummary {
private final int rateLimitedComputeQueryCount;
private final int rateLimitedWriteQueryCount;

/**
* @param readOps Aggregate <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#tro">Transactional
* Read Operations (TROs)</a> consumed
* by the requests.
* @param computeOps Aggregate <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#tco">Transactional
* Compute Operations (TCOs)</a>
* consumed by the requests.
* @param writeOps Aggregate <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#two">Transactional
* Write Operations (TWOs)</a>
* consumed by the requests.
* @param queryTimeMs Aggregate query run time for the
* requests in milliseconds.
* @param contentionRetries Aggregate number of
* <a href="https://docs.fauna.com/fauna/current/learn/transactions/contention/#retries">retries
* for contended transactions</a>.
* @param storageBytesRead Aggregate amount of data read from
* storage, in bytes.
* @param storageBytesWrite Aggregate amount of data written to
* storage, in bytes.
* @param processingTimeMs Aggregate event processing time in
* milliseconds. Only applies to Event
* Feed and Event Stream requests.
* @param queryCount Number of requests included in the
* summary.
* @param rateLimitedReadQueryCount Aggregate count of requests that
* exceeded
* <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#throughput-limits">plan
* throughput limits</a> for
* <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#tro">Transactional
* Read Operations (TROs)</a>.
* @param rateLimitedComputeQueryCount Aggregate count of requests that
* exceeded
* <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#throughput-limits">plan
* throughput limits</a> for
* <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#tro">Transactional
* Compute Operations (TCOs)</a>.
* @param rateLimitedWriteQueryCount Aggregate count of requests that
* exceeded
* <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#throughput-limits">plan
* throughput limits</a> for
* <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#tro">Transactional
* Write Operations (TWOs)</a>.
*/
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 +93,7 @@ public QueryStatsSummary(
}

/**
* Gets the aggregate read ops.
* Gets the aggregate <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#tro">Transactional Read Operations (TROs)</a> recorded.
*
* @return A long representing the aggregate read ops
*/
Expand All @@ -59,7 +102,7 @@ public long getReadOps() {
}

/**
* Gets the aggregate compute ops.
* Gets the aggregate <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#tco">Transactional Compute Operations (TCOs)</a> recorded.
*
* @return A long representing the aggregate compute ops
*/
Expand All @@ -68,7 +111,7 @@ public long getComputeOps() {
}

/**
* Gets the aggregate write ops.
* Gets the aggregate <a href="https://docs.fauna.com/fauna/current/manage/plans-billing/plan-details/#two">Transactional Write Operations (TWOs)</a>) recorded.
*
* @return A long representing the aggregate write ops
*/
Expand Down Expand Up @@ -106,16 +149,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 Event Feeds and Event Stream requests 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
Loading