Created
June 4, 2020 03:58
-
-
Save RyanKung/d9ba2813f2190c51520f6dc818f3ad46 to your computer and use it in GitHub Desktop.
Record Elastic APM Python Agent requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def monkey_patch_transport(): | |
from functools import wraps | |
import gzip | |
from elasticapm.transport.http import Transport | |
Transport.origin_send = Transport.send | |
@wraps(Transport.send) | |
def _(self, data): | |
print("{url: '%s', data: '%s', method: '%s', gzip: 1}" % (self._url, gzip.decompress(data.tobytes()) , 'POST')) | |
return Transport.origin_send(self, data) | |
Transport.send = _ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment