I am running a flask application with apm as an agent.
I have configured my app as the following initially:
app = Flask(__name__)
APM_DICTIONARY = {
'SERVICE_NAME': 'MY_SERVICE_NAME' ,
'SERVER_URL': 'MY_URL'
'SECRET_TOKEN': 'MY_TOKEN'
}
app.config['ELASTIC_APM'] = APM_DICTIONARY
apm.init_app(app)
So far everything worked fine, but on a particular function that has a bigger body than others this error happens:
elasticapm.transport.exceptions.TransportException: HTTP 400: {"accepted":69,"errors":[{"message":"event exceeded the permitted size."
So I checked for some documentation and i ended up Configuration | APM Python Agent Reference [6.x] | Elastic
I noticed the parameter API_REQUEST_SIZE
and I started tuning it. I used respectively:
1mb, 10mb, 100mb, 1gb, 10gb and 100gb. None of them worked, and I'm quite sure the size of the whole body would hardly exceed the 1mb.
Then I also tried to tune the LOG_LEVEL
as I do not really want apm to log every single event. So in the end my configuration looked as:
app = Flask(__name__)
APM_DICTIONARY = {
'SERVICE_NAME': 'MY_SERVICE_NAME' ,
'SERVER_URL': 'MY_URL'
'SECRET_TOKEN': 'MY_TOKEN',
'API_REQUEST_SIZE': '10gb',
'LOG_LEVEL': 'error'
}
app.config['ELASTIC_APM'] = APM_DICTIONARY
apm.init_app(app)
Though, whatever the LOG_LEVEL
and the API_REQUEST_SIZE
nothing seems to actually affect apm.
My first question is: how can I ensure that the parameters are not ignored? But mostly, how do I make apm not logging all the events, but only logging events when I want it through apm.capture_message
?
On a side note, I noticed the following: APM agent crashes if the SQL query is too large · Issue #827 · elastic/apm-agent-python · GitHub