When you set up your webhook to receive data from Metric, you expect it to be always up and running. However, sometimes things can go wrong and the webhook might not be available to receive the data that we send. In this case, we consider the webhook to have failed.
What is a Webhook Failure?
A webhook failure occurs when the Metric server doesn't receive a successful response from your webhook within 5 seconds or when your webhook returns a non-200 HTTP response code. When either of these events occur, we consider the webhook to have failed and we take action to ensure that the data is not lost.
Handling Webhook Failures
In the event of a webhook failure, the Metric server takes care of such infrequent failures and tries to resend the data after 15 minutes. This means that you can be assured that your data is not lost and will eventually make it to your server.
Disabling on Concurrent Failures
However, if the Metric server encounters 5 concurrent webhook failures, we assume that the webhook is down and we disable it. This means that we won't send any more data to the webhook until it's manually re-enabled from the dashboard.
It's important to ensure that your webhook is always up and running to avoid any data loss. If you suspect that your webhook is down, please check your server logs to identify and resolve the issue.
Preventing webhook timeout failures
To prevent webhook timeouts, it's recommended to process the data asynchronously on your server. When a request is received, the server should validate it and then return a response immediately. Once the request has been validated, the data can be processed asynchronously in the background.
By processing data asynchronously, your server won't hold up the response, and the webhook will receive an immediate response. This can help prevent timeouts and reduce the likelihood of webhook failures.