pinpoint-apm / pinpoint

APM, (Application Performance Management) tool for large-scale distributed systems.
https://pinpoint-apm.gitbook.io/
Apache License 2.0
13.31k stars 3.75k forks source link

Webhook alarm #8549

Open haotao666 opened 2 years ago

haotao666 commented 2 years ago

pinpoint-batch-2.3.2.jar Prompt when webhook alarm is triggered: org.springframework.web.client.RestClientException: Error while extracting response for type [class java.lang.String] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type java.lang.String from Object value (token JsonToken.START_OBJECT); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.lang.String from Object value (token JsonToken.START_OBJECT) at [Source: (PushbackInputStream); line: 1, column: 1] image

ga-ram commented 2 years ago

https://github.com/pinpoint-apm/pinpoint/blob/b6dee2864c8d27cb5d355bd0157115a0c3a64365/batch/src/main/java/com/navercorp/pinpoint/batch/alarm/WebhookSenderImpl.java#L86

As you can see, pinpoint-batch expects String as return. It seems like your webhook receiving part replied with JSON, not String.

It seems like the webhook has been successfully received and dealt with in your receiving application, just pinpoint-batch was expecting String as a return but it got another type as the response.

If you have no control over the return type your webhook destination is sending, you might need to implement another server to process this.

Please refer to slack-receiver project.

PIYUSHRAJ24 commented 1 year ago

Hi, I have created my Pinpoint APM infrastructure in the dockerized environment, now, my concern is that I need to implement alarm alerts on my Slack channel. I have my webhook URL but I don't know where or in which directory or files I need to configure the slack webhook URL and what should be the parameter. I have tried this I(PINPOINT_NOTIFICATION_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/xxxxxxxxx/xxxxxxxxxxx )n the .env file but I am not able to see the slack option in alarm settings of pinpoint web UI. Please help. It would be very helpful.

Thanks

ga-ram commented 1 year ago

@PIYUSHRAJ24 There isn't ready-to-go slack webhook implementation on Pinpoint. Currently there should be another server to translate received pinpoint webhook into slack webhook format and then send it to your slack. That slack receiver project above does exactly that so it might be worth checking it.

PIYUSHRAJ24 commented 1 year ago

Can you please guide me, I have already created the package with the Slack receiver project by mentioning the Slack webhook URL in application.properties. after that I got a jar file I have run the jar file it is running perfectly but whenever I am trying to access http://10.136.184.102:8085/api/send/slack URL. Showing error Whitelabel Error Page

ga-ram commented 1 year ago

@PIYUSHRAJ24 you can't access that page because it is there for POST requests. I haven't used slack receiver before but it seems like you should put http://10.136.184.102:8085/api/send/slack as url when adding pinpoint webhook? After adding webhook, first test with total count = 1 alarm with that webhook and see if it works.

PIYUSHRAJ24 commented 1 year ago

Okay, Let me try. Thanks for your help.