Separate transaction for every resolver in AWS Lambda

Ad 1:
In the traces for specific APIs, I can see the URL arguments used for the requests, which is sufficient for my needs.

Ad 2:

  • I had to set the flag ELASTIC_APM_CAPTURE_BODY to "all" for each API called by AppSync to view the request bodies for each call.
  • I was able to capture response bodies by using labels.

My remaining concern is the maxLength for JSON in labels. Here’s how I’m currently creating the label for responses in my Flask API service:

@app.after_request
def apm_label_response_data(response):
    response_data = response.get_json(silent=True)
    limited_data = json.dumps(response_data)[:10000]
    elasticapm.label(response_body=limited_data)
        
    return response

The problem is that my limit doesn’t seem to take effect, as the JSON is still truncated to only 1024 characters. I believe the reason is explained here. Is there any way to adjust this limit for my label?