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

Display task container names for ECS task state change events #175

Merged
merged 6 commits into from
Dec 11, 2024
Merged
Changes from 4 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
4 changes: 4 additions & 0 deletions cloud-watch-to-slack-testing/deployment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ function ecsTaskStateChangeMessageText(message) {
const taskArn = message?.detail?.taskArn;
const lastStatus = message?.detail?.lastStatus;
let messageText = `Task ${taskArn} is now ${lastStatus}`;
const taskContainers = message?.detail?.containers
?.map((container) => container.name)
.join(", ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be robust when the containers field is missing, probably needs a ?.join so that an undefined continues to propagate.

Also, right now, if the value of containers is a scalar (which it probably never will be, but you never know), this code will throw at the map invocation. What happens when the lambda throws, are we notified? If so, probably not worth worrying about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we are notified. The lambda does have a dead queue configured but I don't think we do anything with it https://github.com/dockstore/dockstore-deploy/blob/38977e218b16a73d0a29167d00f3c89bbdb09b3d/cloudwatch-to-slack.yml.template#L146-L147

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messageText += `\nContainers: ${taskContainers}`;
["startedAt", "stoppedAt", "stoppedReason"].forEach((name) => {
const value = message?.detail?.[name];
if (value != undefined) {
Expand Down
Loading