Open
Conversation
hsik0225
commented
May 1, 2023
| import java.util.List; | ||
|
|
||
| /** | ||
| * https://api.slack.com/reference/block-kit |
Contributor
Author
There was a problem hiding this comment.
block kit 데모 사이트입니다.
https://app.slack.com/block-kit-builder/T02TM7502NM#%7B%22type%22:%22home%22,%22blocks%22:%5B%5D%7D
block kit은 사이트에서 보이다시피 JSON으로 슬랙의 메시지를 표현해줘요!
| @AllArgsConstructor | ||
| @Entity | ||
| @Table(indexes = {@Index(name = "IDX_KEY_CODE", columnList = "keyCode", unique = true)}) | ||
| public class Slack extends DeletableEntity { |
Contributor
Author
There was a problem hiding this comment.
Slack 엔티티를 따로 만든 이유는 추후 다른 모니터링 도구(ex. 센트리, 그라파나, ...)에서 슬랙으로 알림을 보낼 수 있기 때문입니다.
슬랙 채널마다 고유의 경로(path)를 가지고 있습니다.
그걸 yml파일에 적어놓을 수도 있지만 그렇게 하면 path가 변경될 때마다 어플리케이션을 새로 빌드해야 합니다.
설정 하나 변경하려고 어플리케이션을 새로 띄우는 건 좋지 않아보여 DB에서 관리하도록 했습니다.
| @@ -0,0 +1,37 @@ | |||
| ### send infra emergency | |||
| POST {{host}}/api/webhook/from/pinpoint/to/slack | |||
Contributor
Author
There was a problem hiding this comment.
Intellij의 HttpClient로 Slack에 메세지 보내는 것을 테스트할 수 있습니다.
어플리케이션을 로컬에서 띄운 후 HttpClient의 환경 설정을 local로 한 후 실행시키면 됩니다.
Homework 워크 스페이스에 infra-emergency 채널 만들어져있고, 해당 채널에 메시지가 갑니다.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요구 사항
초기에는 어플리케이션에서 400이나 500에러를 발생시키면 핀포인트가 이를 감지해 슬랙으로 보내주는 것을 생각했었는데요.
핀포인트가 기능을 제공하긴 하지만 디테일한 예외 정보(ex. 예외 타입, 메시지, Status Code, ...)는 주지 않아서 핀포인트로는 서버의 인프라 적인 요소만 봐야할 것 같습니다 😥
추가로 PINPOINT 서버도 완료했습니다.
URL은 http://dev.homework.codes:8090/ 입니다.
현재 방화벽 설정이 덜 되어서 아마 접근이 안될거에요.
추후 해당 설정까지 끝내면 또 말씀드릴게요.