Stop elasticsearch_dsl from sending events to Elastic when server is down

Adso_4
Fri, 29 Jul 2022 10:36:07 +0000
Elasticsearch

We have a django web application that sends user data with elasticsearch_dsl library to an APM server. Our Elastic Stack is mounted with docker-compose, with Kibana, Elasticsearch and APM nodes.

For every user interaction, django tracking analyzer creates the corresponding instance in our database, and signals elasticsearch_dsl to synchronize data with APM server.

What we have experienced is that, in the case of APM server down, the server cannot respond and the nginx timeout is triggered:

upstream prematurely closed connection while reading response header from upstream

Is there a way to avoid sending elasticsearch_dsl signals when the server is down? How can we detect the server availability to avoid sending this request to APM?

2 posts - 2 participants