Skip to content

Commit

Permalink
Add project_id as label to prometheus table access counter
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrdoherty committed Sep 19, 2024
1 parent a47955c commit 7eff2de
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class RecordService extends AbstractWdkService {
private static final Counter TABLE_REQUEST_COUNTER = Counter.build()
.name("wdk_table_requests")
.help("Times individual tables are requested at the /records endpoint")
.labelNames("table")
.labelNames("project_id", "table")
.register();

@GET
Expand Down Expand Up @@ -136,7 +136,7 @@ else if (records.size() > 1) {
// update metrics; increment entries for requested tables
request.getTableNames().stream()
.map(tableName -> recordClass.getUrlSegment() + "." + tableName)
.forEach(key -> TABLE_REQUEST_COUNTER.labels(key).inc());
.forEach(key -> TABLE_REQUEST_COUNTER.labels(getWdkModel().getProjectId(), key).inc());

TwoTuple<JSONObject,List<Exception>> recordJsonResult = RecordFormatter.getRecordJson(
records.get(0), request.getAttributeNames(), request.getTableNames(), AttributeFormat.DISPLAY);
Expand Down

0 comments on commit 7eff2de

Please sign in to comment.