Skip to content

Commit

Permalink
Merge pull request #94 from caraml-dev/key-retrieval
Browse files Browse the repository at this point in the history
Add key retrieval metrics
  • Loading branch information
khorshuheng authored Mar 27, 2023
2 parents 4421ca3 + dabfd98 commit d4059e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ private List<Counter> 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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand All @@ -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");
}

Expand Down

0 comments on commit d4059e3

Please sign in to comment.