diff --git a/caraml-store-serving/src/main/java/dev/caraml/serving/monitoring/ServingMetrics.java b/caraml-store-serving/src/main/java/dev/caraml/serving/monitoring/ServingMetrics.java index f2e328f..114d4a0 100644 --- a/caraml-store-serving/src/main/java/dev/caraml/serving/monitoring/ServingMetrics.java +++ b/caraml-store-serving/src/main/java/dev/caraml/serving/monitoring/ServingMetrics.java @@ -61,11 +61,18 @@ private List newEntityCounters(GetOnlineFeaturesRequest featureRequest) .toList(); } + private Counter newKeyRetrievalCounter(String project) { + return Counter.builder("caraml_serving_key_retrieval_count") + .tag("project", project) + .register(registry); + } + @Override public void onRequestReceived(ReqT requestMessage) { if (requestMessage instanceof GetOnlineFeaturesRequest featureRequest) { String project = featureRequest.getProject(); newServingRequestCounter(project).increment(); + newKeyRetrievalCounter(project).increment(featureRequest.getEntityRowsCount()); newEntityCounters(featureRequest) .forEach(counter -> counter.increment(featureRequest.getEntityRowsCount())); } diff --git a/caraml-store-serving/src/main/java/dev/caraml/serving/store/StoreService.java b/caraml-store-serving/src/main/java/dev/caraml/serving/store/StoreService.java index dbe786d..41345a0 100644 --- a/caraml-store-serving/src/main/java/dev/caraml/serving/store/StoreService.java +++ b/caraml-store-serving/src/main/java/dev/caraml/serving/store/StoreService.java @@ -56,7 +56,7 @@ public StoreService(OnlineRetriever retriever, FeatureSpecService specService) { } public GetOnlineFeaturesResponseV2 getOnlineFeaturesV2(GetOnlineFeaturesRequest request) { - if(request.getEntityRowsList().isEmpty()) { + if (request.getEntityRowsList().isEmpty()) { throw new IllegalArgumentException("Entity rows cannot be empty"); } @@ -77,7 +77,7 @@ public GetOnlineFeaturesResponseV2 getOnlineFeaturesV2(GetOnlineFeaturesRequest } public GetOnlineFeaturesResponse getOnlineFeatures(GetOnlineFeaturesRequest request) { - if(request.getEntityRowsList().isEmpty()) { + if (request.getEntityRowsList().isEmpty()) { throw new IllegalArgumentException("Entity rows cannot be empty"); }