-
Notifications
You must be signed in to change notification settings - Fork 35
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
Scott.solmonson/batch item failure metric #532
Conversation
…ent on empty arrays
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is a really good first stab at this feature, well done @scott.solmonson!
I've added a few notes for your reference, but I'll pick up this PR and get it shipped.
The biggest thing is that this implementation sets a value of 1 if batchItemFailures
is present. We'd like this to be the count of failures.
Otherwise, this looks pretty good with some minor style tweaks.
Thanks again!
src/utils/response.ts
Outdated
@@ -0,0 +1,12 @@ | |||
export interface LambdaResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed. This file should be just a utils file for batch item failures, it doesn't cover all responses (nor does it need to)
src/utils/response.ts
Outdated
batchItemFailures?: { itemIdentifier: string }[]; | ||
} | ||
|
||
export function isBatchItemFailure(lambdaResponse: any): lambdaResponse is LambdaResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lambdaResponse is LambdaResponse
is not needed here, not sure what it's trying to do but this function returns a boolean.
src/metrics/enhanced-metrics.ts
Outdated
@@ -81,3 +81,7 @@ export function incrementInvocationsMetric(listener: MetricsListener, context: C | |||
export function incrementErrorsMetric(listener: MetricsListener, context: Context): void { | |||
incrementEnhancedMetric(listener, "errors", context); | |||
} | |||
|
|||
export function incrementBatchItemFailureMetric(listener: MetricsListener, context: Context): void { | |||
incrementEnhancedMetric(listener, "batch_item_failures", context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sets 1 for all batch item failures. We'd want this to be a count of the failures.
src/index.spec.ts
Outdated
@@ -2,26 +2,35 @@ import http from "http"; | |||
import nock from "nock"; | |||
|
|||
import { Context, Handler } from "aws-lambda"; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally we try not to introduce new whitespace changes unless the original violated whitespace rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM – great tests and approach.
What does this PR do?
Creates a metric for batch item failures and closes issue #435
Motivation
#435
Testing Guidelines
Additional Notes
SVLS-3126
Types of Changes
Check all that apply