Skip to content

Commit

Permalink
return quota limited in response
Browse files Browse the repository at this point in the history
  • Loading branch information
frankh committed Aug 12, 2024
1 parent 130a5ff commit 58a0792
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions vector/replay-capture/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ tests:
."_" = "123456789"
%token = "limited_token"
# we can't properly check things that we verify in the capture decoding vrl sadly :(
%quota_limited = true
outputs:
- conditions:
- source: |
Expand Down
11 changes: 9 additions & 2 deletions vector/replay-capture/vector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,15 @@ sources:
assert!(is_string(.message[0].properties."$$session_id"), "$$session_id is required")
assert!(is_string(%token), "token is required")
_, err = get_enrichment_table_record("quota_limited_teams", { "token": %token })
# get_enrichment_table_record returns an err if record is not found
# that means err == null iff we found the quota limited record
%quota_limited = err == null
%response = {"status": 1}
if %quota_limited {
%response.quota_limited = ["recordings"]
}
transforms:
quota_check:
Expand All @@ -74,8 +82,7 @@ transforms:
quota_limited:
type: vrl
source: |
_, err = get_enrichment_table_record("quota_limited_teams", { "token": %token })
err == null # err is not null if row not found, we want to drop where the row _is_ found
%quota_limited
events_parsed:
type: remap
Expand Down

0 comments on commit 58a0792

Please sign in to comment.