Skip to content
Prev Previous commit
Next Next commit
Adding javadoc.
  • Loading branch information
jeet1995 committed Jan 6, 2025
commit 62ca4967689b23993ee7831811bda87dc52d4856
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public final class CosmosBatchResponse {
private final List<CosmosBatchOperationResult> results;
private final int subStatusCode;
private final CosmosDiagnostics cosmosDiagnostics;
private long opCountPerEvaluation;
private long retriedOpCountPerEvaluation;
private long globalOpCount;
private int targetMaxMicroBatchSize;

/**
* Initializes a new instance of the {@link CosmosBatchResponse} class.
Expand Down Expand Up @@ -189,6 +193,71 @@ public Duration getDuration() {
return this.cosmosDiagnostics.getDuration();
}

/**
* Get operation count per evaluation
* @return Operation count per evaluation
* */
public long getOpCountPerEvaluation() {
return opCountPerEvaluation;
}

/**
* Set operation count per evaluation
* @param opCountPerEvaluation Operation count per evaluation
* */
public void setOpCountPerEvaluation(long opCountPerEvaluation) {
this.opCountPerEvaluation = opCountPerEvaluation;
}

/**
* Get global operation count
* @return Global operation count
* */
public long getGlobalOpCount() {
return this.globalOpCount;
}

/**
* Set global operation count
* @param globalOpCount Global operation count
* */
public void setGlobalOpCount(long globalOpCount) {
this.globalOpCount = globalOpCount;
}

/**
* Get retried operation count per evaluation
* @return retried operation count per evaluation
* */
public long getRetriedOpCountPerEvaluation() {
return retriedOpCountPerEvaluation;
}

/**
* Set retried operation count per evaluation
* @param retriedOpCountPerEvaluation retried operation count per evaluation
* */
public void setRetriedOpCountPerEvaluation(long retriedOpCountPerEvaluation) {
this.retriedOpCountPerEvaluation = retriedOpCountPerEvaluation;
}

/**
* Get target max micro batch size
* @return target max micro batch size
* */
public int getTargetMaxMicroBatchSize() {
return this.targetMaxMicroBatchSize;
}

/**
* Set target max micro batch size
* @param targetMaxMicroBatchSize target max micro batch size
* */
public void setTargetMaxMicroBatchSize(int targetMaxMicroBatchSize) {
this.targetMaxMicroBatchSize = targetMaxMicroBatchSize;
}


void addAll(List<? extends CosmosBatchOperationResult> collection) {
this.results.addAll(collection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,37 @@ private CosmosMetricName(String name, CosmosMetricCategory metricCategory) {
public static final CosmosMetricName REQUEST_SUMMARY_DIRECT_ACTUAL_ITEM_COUNT = new CosmosMetricName(
nameOf("req.rntbd.actualItemCount"),
CosmosMetricCategory.REQUEST_SUMMARY);
/**
* Op count per evaluation - relevant for batch operations executed by bulk executor
* NOTE: No percentiles or histogram supported
*/
public static final CosmosMetricName REQUEST_SUMMARY_DIRECT_OP_COUNT_PER_EVALUATION = new CosmosMetricName(
nameOf("req.rntbd.opCountPerEvaluation"),
CosmosMetricCategory.REQUEST_SUMMARY);

/**
* Op retried count per evaluation - relevant for batch operations executed by bulk executor
* NOTE: No percentiles or histogram supported
*/
public static final CosmosMetricName REQUEST_SUMMARY_DIRECT_OP_RETRIED_COUNT_PER_EVALUATION = new CosmosMetricName(
nameOf("req.rntbd.opRetriedCountPerEvaluation"),
CosmosMetricCategory.REQUEST_SUMMARY);

/**
* Global op count - relevant for batch operations executed by bulk executor
* NOTE: No percentiles or histogram supported
*/
public static final CosmosMetricName REQUEST_SUMMARY_DIRECT_GLOBAL_OP_COUNT = new CosmosMetricName(
nameOf("req.rntbd.globalOpCount"),
CosmosMetricCategory.REQUEST_SUMMARY);

/**
* Target max micro batch size - relevant for batch operations executed by bulk executor
* NOTE: No percentiles or histogram supported
*/
public static final CosmosMetricName REQUEST_SUMMARY_DIRECT_TARGET_MAX_MICRO_BATCH_SIZE = new CosmosMetricName(
nameOf("req.rntbd.targetMaxMicroBatchSize"),
CosmosMetricCategory.REQUEST_SUMMARY);

/**
* Number of requests (Counter)
Expand Down Expand Up @@ -145,6 +176,22 @@ private CosmosMetricName(String name, CosmosMetricCategory metricCategory) {
nameOf("req.gw.actualItemCount"),
CosmosMetricCategory.REQUEST_SUMMARY);

public static final CosmosMetricName REQUEST_SUMMARY_GATEWAY_OP_COUNT_PER_EVALUATION = new CosmosMetricName(
nameOf("req.gw.opCountPerEvaluation"),
CosmosMetricCategory.REQUEST_SUMMARY);

public static final CosmosMetricName REQUEST_SUMMARY_GATEWAY_OP_RETRIED_COUNT_PER_EVALUATION = new CosmosMetricName(
nameOf("req.gw.opRetriedCountPerEvaluation"),
CosmosMetricCategory.REQUEST_SUMMARY);

public static final CosmosMetricName REQUEST_SUMMARY_GATEWAY_GLOBAL_OP_COUNT = new CosmosMetricName(
nameOf("req.gw.globalOpCount"),
CosmosMetricCategory.REQUEST_SUMMARY);

public static final CosmosMetricName REQUEST_SUMMARY_GATEWAY_TARGET_MAX_MICRO_BATCH_SIZE = new CosmosMetricName(
nameOf("req.gw.targetMaxMicroBatchSize"),
CosmosMetricCategory.REQUEST_SUMMARY);

/**
* Size of the request payload (DistributionSummary)
* NOTE: No percentiles or histogram supported
Expand Down Expand Up @@ -389,10 +436,18 @@ private static Map<String, CosmosMetricName> createMeterNameMap() {
map.put(nameOf("req.rntbd.backendlatency"), CosmosMetricName.REQUEST_SUMMARY_DIRECT_BACKEND_LATENCY);
map.put(nameOf("req.rntbd.rus"), CosmosMetricName.REQUEST_SUMMARY_DIRECT_REQUEST_CHARGE);
map.put(nameOf("req.rntbd.actualitemcount"), CosmosMetricName.REQUEST_SUMMARY_DIRECT_ACTUAL_ITEM_COUNT);
map.put(nameOf("req.rntbd.opCountPerEvaluation"), CosmosMetricName.REQUEST_SUMMARY_DIRECT_OP_COUNT_PER_EVALUATION);
map.put(nameOf("req.rntbd.opRetriedCountPerEvaluation"), CosmosMetricName.REQUEST_SUMMARY_DIRECT_OP_RETRIED_COUNT_PER_EVALUATION);
map.put(nameOf("req.rntbd.globalOpCount"), CosmosMetricName.REQUEST_SUMMARY_DIRECT_GLOBAL_OP_COUNT);
map.put(nameOf("req.rntbd.targetMaxMicroBatchSize"), CosmosMetricName.REQUEST_SUMMARY_DIRECT_TARGET_MAX_MICRO_BATCH_SIZE);
map.put(nameOf("req.gw.requests"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_REQUESTS);
map.put(nameOf("req.gw.latency"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_LATENCY);
map.put(nameOf("req.gw.rus"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_REQUEST_CHARGE);
map.put(nameOf("req.gw.actualitemcount"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_ACTUAL_ITEM_COUNT);
map.put(nameOf("req.gw.opCountPerEvaluation"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_OP_COUNT_PER_EVALUATION);
map.put(nameOf("req.gw.opRetriedCountPerEvaluation"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_OP_RETRIED_COUNT_PER_EVALUATION);
map.put(nameOf("req.gw.globalOpCount"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_GLOBAL_OP_COUNT);
map.put(nameOf("req.gw.targetMaxMicroBatchSize"), CosmosMetricName.REQUEST_SUMMARY_GATEWAY_TARGET_MAX_MICRO_BATCH_SIZE);
map.put(nameOf("req.reqpayloadsize"), CosmosMetricName.REQUEST_SUMMARY_SIZE_REQUEST);
map.put(nameOf("req.rsppayloadsize"), CosmosMetricName.REQUEST_SUMMARY_SIZE_RESPONSE);
map.put(nameOf("req.rntbd.timeline"), CosmosMetricName.REQUEST_DETAILS_DIRECT_TIMELINE);
Expand Down