This is an automated email from the ASF dual-hosted git repository.
jlli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 07b3ee639c Add segment replace api failure metrics. (#8784)
07b3ee639c is described below
commit 07b3ee639c6ff75b13465088208287d3297afca1
Author: Jiapeng Tao <[email protected]>
AuthorDate: Wed Jun 1 11:02:39 2022 -0700
Add segment replace api failure metrics. (#8784)
---
.../pinot/common/metrics/ControllerMeter.java | 4 ++
.../PinotSegmentUploadDownloadRestletResource.java | 51 ++++++++++------------
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java
index 082893b7ff..9fd0e7dd17 100644
---
a/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java
+++
b/pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerMeter.java
@@ -49,6 +49,10 @@ public enum ControllerMeter implements AbstractMetrics.Meter
{
NUMBER_TIMES_SCHEDULE_TASKS_CALLED("tasks", true),
NUMBER_TASKS_SUBMITTED("tasks", false),
NUMBER_SEGMENT_UPLOAD_TIMEOUT_EXCEEDED("SegmentUploadTimeouts", true),
+ // Segment replace api failure metrics
+ NUMBER_START_REPLACE_FAILURE("NumStartReplaceFailure", false),
+ NUMBER_END_REPLACE_FAILURE("NumEndReplaceFailure", false),
+ NUMBER_REVERT_REPLACE_FAILURE("NumRevertReplaceFailure", false),
CRON_SCHEDULER_JOB_TRIGGERED("cronSchedulerJobTriggered", false),
LLC_SEGMENTS_DEEP_STORE_UPLOAD_RETRY_ERROR("LLCSegmentDeepStoreUploadRetryError",
false),
NUMBER_ADHOC_TASKS_SUBMITTED("adhocTasks", false);
diff --git
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
index 0590fb2b1a..5a86d46642 100644
---
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
+++
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
@@ -589,20 +589,19 @@ public class PinotSegmentUploadDownloadRestletResource {
@ApiParam(value = "Force cleanup") @QueryParam("forceCleanup")
@DefaultValue("false") boolean forceCleanup,
@ApiParam(value = "Fields belonging to start replace segment request",
required = true)
StartReplaceSegmentsRequest startReplaceSegmentsRequest) {
+ TableType tableType = Constants.validateTableType(tableTypeStr);
+ if (tableType == null) {
+ throw new ControllerApplicationException(LOGGER, "Table type should
either be offline or realtime",
+ Response.Status.BAD_REQUEST);
+ }
+ String tableNameWithType =
+
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager,
tableName, tableType, LOGGER).get(0);
try {
- TableType tableType = Constants.validateTableType(tableTypeStr);
- if (tableType == null) {
- throw new ControllerApplicationException(LOGGER, "Table type should
either be offline or realtime",
- Response.Status.BAD_REQUEST);
- }
- String tableNameWithType =
-
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager,
tableName, tableType, LOGGER).get(0);
String segmentLineageEntryId =
_pinotHelixResourceManager.startReplaceSegments(tableNameWithType,
startReplaceSegmentsRequest.getSegmentsFrom(),
startReplaceSegmentsRequest.getSegmentsTo(), forceCleanup);
return
Response.ok(JsonUtils.newObjectNode().put("segmentLineageEntryId",
segmentLineageEntryId)).build();
- } catch (WebApplicationException wae) {
- throw wae;
} catch (Exception e) {
+ _controllerMetrics.addMeteredTableValue(tableNameWithType,
ControllerMeter.NUMBER_START_REPLACE_FAILURE, 1);
throw new ControllerApplicationException(LOGGER, e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR, e);
}
}
@@ -617,21 +616,20 @@ public class PinotSegmentUploadDownloadRestletResource {
@ApiParam(value = "OFFLINE|REALTIME", required = true)
@QueryParam("type") String tableTypeStr,
@ApiParam(value = "Segment lineage entry id returned by
startReplaceSegments API", required = true)
@QueryParam("segmentLineageEntryId") String segmentLineageEntryId) {
+ TableType tableType = Constants.validateTableType(tableTypeStr);
+ if (tableType == null) {
+ throw new ControllerApplicationException(LOGGER, "Table type should
either be offline or realtime",
+ Response.Status.BAD_REQUEST);
+ }
+ String tableNameWithType =
+
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager,
tableName, tableType, LOGGER).get(0);
try {
- TableType tableType = Constants.validateTableType(tableTypeStr);
- if (tableType == null) {
- throw new ControllerApplicationException(LOGGER, "Table type should
either be offline or realtime",
- Response.Status.BAD_REQUEST);
- }
- String tableNameWithType =
-
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager,
tableName, tableType, LOGGER).get(0);
// Check that the segment lineage entry id is valid
Preconditions.checkNotNull(segmentLineageEntryId,
"'segmentLineageEntryId' should not be null");
_pinotHelixResourceManager.endReplaceSegments(tableNameWithType,
segmentLineageEntryId);
return Response.ok().build();
- } catch (WebApplicationException wae) {
- throw wae;
} catch (Exception e) {
+ _controllerMetrics.addMeteredTableValue(tableNameWithType,
ControllerMeter.NUMBER_END_REPLACE_FAILURE, 1);
throw new ControllerApplicationException(LOGGER, e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR, e);
}
}
@@ -648,21 +646,20 @@ public class PinotSegmentUploadDownloadRestletResource {
String segmentLineageEntryId,
@ApiParam(value = "Force revert in case the user knows that the lineage
entry is interrupted")
@QueryParam("forceRevert") @DefaultValue("false") boolean forceRevert) {
+ TableType tableType = Constants.validateTableType(tableTypeStr);
+ if (tableType == null) {
+ throw new ControllerApplicationException(LOGGER, "Table type should
either be offline or realtime",
+ Response.Status.BAD_REQUEST);
+ }
+ String tableNameWithType =
+
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager,
tableName, tableType, LOGGER).get(0);
try {
- TableType tableType = Constants.validateTableType(tableTypeStr);
- if (tableType == null) {
- throw new ControllerApplicationException(LOGGER, "Table type should
either be offline or realtime",
- Response.Status.BAD_REQUEST);
- }
- String tableNameWithType =
-
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager,
tableName, tableType, LOGGER).get(0);
// Check that the segment lineage entry id is valid
Preconditions.checkNotNull(segmentLineageEntryId,
"'segmentLineageEntryId' should not be null");
_pinotHelixResourceManager.revertReplaceSegments(tableNameWithType,
segmentLineageEntryId, forceRevert);
return Response.ok().build();
- } catch (WebApplicationException wae) {
- throw wae;
} catch (Exception e) {
+ _controllerMetrics.addMeteredTableValue(tableNameWithType,
ControllerMeter.NUMBER_REVERT_REPLACE_FAILURE, 1);
throw new ControllerApplicationException(LOGGER, e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR, e);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]