diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-12-22 09:37:32 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-12-22 09:37:32 +0100 |
commit | fd70322f9f0b7aeb66b7293beee2cda86f904316 (patch) | |
tree | 042726426c7f0f44d5d34c3c3bfa2be6b83c44ea /vespaclient-container-plugin | |
parent | 418170df6700d7b64a46e94af1e733b82223ce58 (diff) |
Updatese with craete true should not increemeent not found metric
Diffstat (limited to 'vespaclient-container-plugin')
2 files changed, 7 insertions, 3 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java index 2a7e69a0bf4..3eac4ff5c5d 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java @@ -468,7 +468,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { DocumentOperationParameters parameters = parametersFromRequest(request, ROUTE) .withResponseHandler(response -> { outstanding.decrementAndGet(); - updateUpdateMetrics(response.outcome()); + updateUpdateMetrics(response.outcome(), update.getCreateIfNonExistent()); handleFeedOperation(path, handler, response); }); return () -> dispatchOperation(() -> asyncSession.update(update, parameters)); @@ -1047,7 +1047,8 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler { } } - private void updateUpdateMetrics(Outcome outcome) { + private void updateUpdateMetrics(Outcome outcome, boolean create) { + if (create && outcome == Outcome.NOT_FOUND) outcome = Outcome.SUCCESS; // >_< switch (outcome) { case SUCCESS: metric.add(MetricNames.SUCCEEDED, 1, null); break; case NOT_FOUND: metric.add(MetricNames.NOT_FOUND, 1, null); break; diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java index b71b5d79520..3762d52ba19 100644 --- a/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java +++ b/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedReplyReader.java @@ -2,6 +2,7 @@ package com.yahoo.vespa.http.server; import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol; +import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage; import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentReply; import com.yahoo.documentapi.metrics.DocumentApiMetrics; import com.yahoo.documentapi.metrics.DocumentOperationStatus; @@ -68,7 +69,9 @@ public class FeedReplyReader implements ReplyHandler { } private static boolean updateNotFound(Reply reply) { - return reply instanceof UpdateDocumentReply && ! ((UpdateDocumentReply) reply).wasFound(); + return reply instanceof UpdateDocumentReply + && ! ((UpdateDocumentReply) reply).wasFound() + && ! ((UpdateDocumentMessage) reply.getMessage()).getDocumentUpdate().getCreateIfNonExistent(); } private void enqueue(ReplyContext context, String message, ErrorCode status, boolean isConditionNotMet, Trace trace) { |