Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update 4xx threshold & timeframe #592

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions api/aws_lambdas/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def strip_event(event) -> tuple:


def parse_body(event):
if event["isBase64Encoded"] and "body" in event and event["body"]:
if event["isBase64Encoded"] and "body" in event and event["body"]:
body = json.loads(base64.b64decode(event["body"]).decode("utf-8"))
elif "body" in event and event["body"]:
body = json.loads(event["body"])
Expand Down Expand Up @@ -154,16 +154,18 @@ def wrapper(event, context, *args):
type(e), (400, "An error has occurred")
)

logger.exception(f"Error occurred with Passport API: {e}")

return {
response = {
"statusCode": status,
"statusCategory": "4XX" if (status >= 400 and status < 500) else "5XX",
"statusDescription": str(e),
"isBase64Encoded": False,
"headers": RESPONSE_HEADERS,
"body": '{"error": "' + message + '"}',
}

logger.exception("Error occurred with Passport API. Response: %s", json.dumps(response))
return response

return wrapper


Expand Down Expand Up @@ -223,15 +225,15 @@ def wrapper(_event, context):
type(e), (500, "An error has occurred")
)

logger.exception(f"Error occurred with Passport API: {e}")

response = {
"statusCode": status,
"statusCategory": "4XX" if (status >= 400 and status < 500) else "5XX",
"statusDescription": str(e),
"isBase64Encoded": False,
"headers": RESPONSE_HEADERS,
"body": '{"error": "' + message + '"}',
}
logger.exception("Error occurred with Passport API. Response: %s", json.dumps(response))

# Log analytics for the API call
try:
Expand Down
6 changes: 3 additions & 3 deletions infra/aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ const CERAMIC_CACHE_SCORER_ID_CONFG = Object({
});

const alarmConfigurations: AlarmConfigurations = {
percentHTTPCodeELB4XX: 0.1, // 0..1 value for ELB error codes
percentHTTPCodeELB4XX: 0.5, // 0..1 value for ELB error codes
percentHTTPCodeELB5XX: 0.01, // 0..1 value for ELB error codes
indexerErrorThreshold: 2, // threshold for indexer logged errors
indexerErrorPeriod: 1800, // period for indexer logged errors, set to 30 min for now

default: {
percentHTTPCodeTarget4XX: 0.1, // 0..1 value for target error codes
percentHTTPCodeTarget4XX: 0.5, // 0..1 value for target error codes
percentHTTPCodeTarget5XX: 0.01, // 0..1 value for target error codes
targetResponseTime: 2, // seconds
},
"passport-analysis-GET-0": {
percentHTTPCodeTarget4XX: 0.1, // 0..1 value for target error codes
percentHTTPCodeTarget4XX: 0.5, // 0..1 value for target error codes
percentHTTPCodeTarget5XX: 0.01, // 0..1 value for target error codes
targetResponseTime: 20, // 20 seconds - this is a slower request
},
Expand Down
4 changes: 2 additions & 2 deletions infra/lib/scorer/loadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function createLoadBalancerAlarms(
LoadBalancer: albArnSuffix,
},
namespace: metricNamespace,
period: 60,
period: 900, // 15 minutes
stat: "Sum",
},
},
Expand All @@ -110,7 +110,7 @@ export function createLoadBalancerAlarms(
LoadBalancer: albArnSuffix,
},
namespace: metricNamespace,
period: 60,
period: 900, // 15 minutes
stat: "Sum",
},
},
Expand Down
Loading