Open cpiment opened 1 month ago
Thanks for reporting, I think if you are keen to contributing a possible patch would be to just skip the json decoding if body is falsy and set it to {}
.
Thanks @xrmx , will do that. What would be the best way to check "falsyness"? Something in the line of this would be enough?
if not body:
body = {}
else:
try:
body = json.loads(body)
except json.decoder.JSONDecodeError: # str not bytes
body = {}
I would keep the happy path before (if body:
) but yeah, something like that.
Describe the bug:
When using Azure Table Client (package
azure-data-tables
) inside an Azure Function instrumented withelasticapm.contrib.serverless.azure.ElasticAPMExtension
and querying a data table usingPartitionKey
andRowKey
, the underlying HTTP request to the table service sends the request parameters in the query string and the request has no body. When Azure Tables instrumentation from Elastic APM reaches this line:https://github.com/elastic/apm-agent-python/blob/fc8ef22e3427f23d77d26cbb647eceafd9ec3f19/elasticapm/instrumentation/packages/azure.py#L302-L307
It crashes because the body is
None
To Reproduce
func host start
to start the local development environmentfunc
logsEnvironment (please complete the following information)
Additional context
Add any other context about the problem here.
requirements.txt
:Click to expand
``` elasticapm azure-functions azure-data-tables ```