-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include value in metrics for unspecified value (#389)
Signed-off-by: Jesper Söderlund <[email protected]>
- Loading branch information
1 parent
5f3f5a4
commit f28024e
Showing
13 changed files
with
226 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
integration-test/scripts/value-included-in-stats-key-when-unspecified.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# descriptor: (unspec: *) | ||
# Has rate limit quota 2 req / min | ||
# detailed_metric is true | ||
# | ||
|
||
response=$(curl -f -s -H "unspec: unspecified_value" http://envoy-proxy:8888/unspec) | ||
response=$(curl -f -s -H "unspec: unspecified_value" http://envoy-proxy:8888/unspec) | ||
|
||
# This should be successful | ||
if [ $? -ne 0 ]; then | ||
echo "These should not be rate limited" | ||
exit 1 | ||
fi | ||
|
||
# This one should be ratelimited | ||
response=$(curl -f -s -H "unspec: unspecified_value" http://envoy-proxy:8888/unspec) | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "This should be a ratelimited call" | ||
exit 1 | ||
fi | ||
|
||
# Sleep a bit to allow the stats to be propagated | ||
sleep 2 | ||
|
||
# Extract the metric for the unspecified value, which shoulb be there due to the "detailed_metric" | ||
stats=$(curl -f -s statsd:9102/metrics | grep -e ratelimit_service_rate_limit_over_limit | grep unspec_unspecified_value | cut -d} -f2 | sed 's/ //g') | ||
|
||
echo "Length: ${#stats}" | ||
echo "${stats}" | ||
|
||
if [ "${stats}" != "1" ]; then | ||
echo "Overlimit should be 1" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.