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

fixed slack interval and new error msg #322

Merged
merged 4 commits into from
Mar 2, 2023

Conversation

jo-bisonai
Copy link
Member

@jo-bisonai jo-bisonai commented Feb 27, 2023

Description

Slack alarm call with unlimited time of interval issue.

Fixes # (issue)
This adds a feature of interval 1 min to send slack alarm notifications.
If the error message is different, it sends without an interval period.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Deployment

  • Should publish npm package
  • Should publish Docker image

@jo-bisonai jo-bisonai added the bug Something isn't working label Feb 27, 2023
@jo-bisonai jo-bisonai self-assigned this Feb 27, 2023
@jo-bisonai jo-bisonai linked an issue Feb 27, 2023 that may be closed by this pull request
@jo-bisonai jo-bisonai marked this pull request as draft February 27, 2023 06:37
@jo-bisonai jo-bisonai marked this pull request as ready for review February 27, 2023 06:41
const webhook = new IncomingWebhook(SLACK_WEBHOOK_URL)
const text = ` :fire: _An error has occurred at_ \`${os.hostname()}\`\n \`\`\`${JSON.stringify(
error
error[1]
Copy link
Member

Choose a reason for hiding this comment

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

@joseph-bisonai What is stored in the first field of error?

Copy link
Member

Choose a reason for hiding this comment

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

From this PR, you started treating it differently than before so I am curious. It could be a bit better to define the value somewhere in advance because it is reused at many places. E.g.:

const e = error[1]

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the logger is changed to PINO, an error message differs from the previous error message. PINO logger has another array at index [0], which is unnecessary.
So I decided to bring only Index[1] contents.

For reusing the value defining a value is okay. I will change it.~

Copy link
Member

Choose a reason for hiding this comment

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

Great! Thank you for the explanation!

Copy link
Member

@martinkersner martinkersner left a comment

Choose a reason for hiding this comment

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

LGTM!

@martinkersner martinkersner merged commit 87bdec4 into master Mar 2, 2023
@martinkersner martinkersner deleted the i-285/slack-alram-test-and-interval branch March 2, 2023 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slack alarm test and interval
2 participants