send-error-report: improve debugging
PATCH v2 1/1 send-error-report: improve debugging
From: Thomas Perrot <[email protected]>
- add a debug mode
- print the request and the response when an error occurs.
---
Changes in version 2:
- Drop the redundant checks
scripts/send-error-report | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
scripts/send-error-report +20 -5
@@ -6,6 +6,7 @@ # Copyright (C) 2013 Intel Corporation # Author: Andreea Proca <[email protected]> # Author: Michael Wood <[email protected]> +# Author: Thomas Perrot <[email protected]> # # SPDX-License-Identifier: GPL-2.0-only #
@@ -22,7 +23,7 @@ scripts_lib_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'li sys.path.insert(0, scripts_lib_path) import argparse_oe -version = "0.3" +version = "0.4" log = logging.getLogger("send-error-report") logging.basicConfig(format='%(levelname)s: %(message)s')
@@ -140,14 +141,21 @@ def send_data(data, args): url = args.protocol+args.server+"/ClientPost/" req = urllib.request.Request(url, data=data, headers=headers) + + log.debug(f"Request URL: {url}") + log.debug(f"Request Headers: {headers}") + log.debug(f"Request Data: {data.decode('utf-8')}") + try: response = urllib.request.urlopen(req) except urllib.error.HTTPError as e: - logging.error(str(e)) + log.error(f"HTTP Error {e.code}: {e.reason}") + log.debug(f"Response Content: {e.read().decode('utf-8')}") sys.exit(1) - print(response.read().decode('utf-8')) - + log.debug(f"Response Status: {response.status}") + log.debug(f"Response Headers: {response.getheaders()}") + log.info(response.read().decode('utf-8')) if __name__ == '__main__': arg_parse = argparse_oe.ArgumentParser(description="This scripts will send an error report to your specified error-report-web server.")
@@ -195,13 +203,20 @@ if __name__ == '__main__': dest="protocol", action="store_const", const="http://", default="https://") - + arg_parse.add_argument("-d", + "--debug", + help="Enable debug mode to print request/response details", + action="store_true") args = arg_parse.parse_args() if (args.json == False): print("Preparing to send errors to: "+args.server) + # Enable debugging if requested + if args.debug: + log.setLevel(logging.DEBUG) + data = prepare_data(args) send_data(data, args)
--
2.49.0
Hi Thomas,
Quoted 6 lines · Thomas Perrot via lists.openembedded.org
From: Thomas Perrot <[email protected]>
- add a debug mode
- print the request and the response when an error occurs.Signed-off-by Thomas Perrot <[email protected]>
Thanks!
Quentin
I noticed that this (or at least v1) was applied on master - would like to call some attention to a related discussion[1] in a neighboring list, and some patches[2][3][4] that followed it - at least [3] is a pre-requisite for this patch (error-report-web has hardcoded the version of the script to 0.3).
[1]: https://lists.yoctoproject.org/g/yocto/message/65184
[2]: https://lists.yoctoproject.org/g/yocto/message/65188
[3]: https://lists.yoctoproject.org/g/yocto/message/65199
[4]: https://lists.yoctoproject.org/g/yocto/message/65200
Quoted 93 lines · Thomas Perrot via lists.openembedded.org
From: Thomas Perrot <[email protected]>
- add a debug mode
- print the request and the response when an error occurs.Signed-off-by Thomas Perrot <[email protected]>---
Changes in version 2:
- Drop the redundant checks
scripts/send-error-report| 25 ++++++++++++++++++++-----1 file changed, 20 insertions(+), 5 deletions(-)scripts/send-error-report +20
-6@@ -6,6 +6,7 @@ # Copyright (C) 2013 Intel Corporation # Author: Andreea Proca <[email protected]> # Author: Michael Wood <[email protected]> +# Author: Thomas Perrot <[email protected]> # # SPDX-License-Identifier: GPL-2.0-only #@@ -22,7 +23,7 @@ scripts_lib_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'li sys.path.insert(0, scripts_lib_path) import argparse_oe -version = "0.3" +version = "0.4" log = logging.getLogger("send-error-report") logging.basicConfig(format='%(levelname)s: %(message)s')@@ -140,14 +141,21 @@ def send_data(data, args): url = args.protocol+args.server+"/ClientPost/" req = urllib.request.Request(url, data=data, headers=headers) + + log.debug(f"Request URL: {url}") + log.debug(f"Request Headers: {headers}") + log.debug(f"Request Data: {data.decode('utf-8')}") + try: response = urllib.request.urlopen(req) except urllib.error.HTTPError as e: - logging.error(str(e)) + log.error(f"HTTP Error {e.code}: {e.reason}") + log.debug(f"Response Content: {e.read().decode('utf-8')}") sys.exit(1) - print(response.read().decode('utf-8')) - + log.debug(f"Response Status: {response.status}") + log.debug(f"Response Headers: {response.getheaders()}") + log.info(response.read().decode('utf-8')) if __name__ == '__main__': arg_parse = argparse_oe.ArgumentParser(description="This scripts will send an error report to your specified error-report-web server.")@@ -195,13 +203,20 @@ if __name__ == '__main__': dest="protocol", action="store_const", const="http://", default="https://") - + arg_parse.add_argument("-d", + "--debug", + help="Enable debug mode to print request/response details", + action="store_true") args = arg_parse.parse_args() if (args.json == False): print("Preparing to send errors to: "+args.server) + # Enable debugging if requested + if args.debug: + log.setLevel(logging.DEBUG) + data = prepare_data(args) send_data(data, args) --2.49.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#215131): https://lists.openembedded.org/g/openembedded-core/message/215131
Mute This Topic: https://lists.openembedded.org/mt/112330994/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hello,
Quoted 9 lines · Gyorgy Sarvari via lists.openembedded.org
I noticed that this (or at least v1) was applied on master - would like
to call some attention to a related discussion[1] in a neighboring list,
and some patches[2][3][4] that followed it - at least [3] is a pre-requisite for this patch (error-report-web has hardcoded the version
of the script to 0.3).
Quoted 5 lines
[1]: https://lists.yoctoproject.org/g/yocto/message/65184
[2]: https://lists.yoctoproject.org/g/yocto/message/65188
[3]: https://lists.yoctoproject.org/g/yocto/message/65199
[4]: https://lists.yoctoproject.org/g/yocto/message/65200
Can you revert the patch v1 and then apply patch v2, at least after patch [3] has been applied to error-report-web?
Kind regards,
Thomas Perrot
Quoted 106 lines · Thomas Perrot via lists.openembedded.org
Quoted 87 lines
From: Thomas Perrot <[email protected]>
- add a debug mode
- print the request and the response when an error occurs.Signed-off-by Thomas Perrot <[email protected]>---
Changes in version 2:
- Drop the redundant checks
scripts/send-error-report| 25 ++++++++++++++++++++-----1 file changed, 20 insertions(+), 5 deletions(-)scripts/send-error-report +1
-0@@ -6,6 +6,7 @@ # Copyright (C) 2013 Intel Corporation # Author: Andreea Proca <[email protected]> # Author: Michael Wood <[email protected]> +# Author: Thomas Perrot <[email protected]> # # SPDX-License-Identifier: GPL-2.0-only #@@ -22,7 +23,7 @@ scripts_lib_path =os.path.join(os.path.dirname(os.path.realpath(__file__)), 'li
sys.path.insert(0, scripts_lib_path)
importargparse_oescripts/send-error-report +1
-1-version = "0.3" +version = "0.4"log =
logging.getLogger("send-error-report")logging.basicConfig(format='%(levelname)s: %(message)s')scripts/send-error-report +0
-0@@ -140,14 +141,21 @@ def send_data(data, args):url = args.protocol+args.server+"/ClientPost/"
req =
urllib.request.Request(url, data=data, headers=headers)scripts/send-error-report +5
-0+ + log.debug(f"Request URL: {url}") + log.debug(f"Request Headers: {headers}") + log.debug(f"Request Data: {data.decode('utf-8')}") +try:
response =urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
- logging.error(str(e))
+log.error(f"HTTP Error {e.code}: {e.reason}")
+log.debug(f"Response Content: {e.read().decode('utf-8')}")sys.exit(1)- print(response.read().decode('utf-8'))
-
+log.debug(f"Response Status: {response.status}")+log.debug(f"Response Headers: {response.getheaders()}")+ log.info(response.read().decode('utf-8'))if
__name__== '__main__':
arg_parse=argparse_oe.ArgumentParser(description="This scripts will send an error report to your specified error-report- web server.")scripts/send-error-report +4
-1@@ -195,13 +203,20 @@ if __name__ == '__main__': dest="protocol", action="store_const", const="http://", default="https://") - + arg_parse.add_argument("-d", + "--debug", + help="Enable debug mode to print request/response details", + action="store_true") args = arg_parse.parse_args()if (args.json == False):
print("Preparing to send errors to: "+args.server)+ # Enable debugging if requested
+ if args.debug:
+log.setLevel(logging.DEBUG)
+
data =prepare_data(args)
send_data(data, args)Quoted 5 lines
--
2.49.0-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#215153):
https://lists.openembedded.org/g/openembedded-core/message/215153
Mute This Topic: https://lists.openembedded.org/mt/112330994/5443093
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Thomas Perrot, Bootlin Embedded Linux and kernel engineering https://bootlin.com
Quoted 13 lines · Thomas Perrot via lists.openembedded.org
Hello,
Quoted 9 lines · Gyorgy Sarvari via lists.openembedded.org
I noticed that this (or at least v1) was applied on master - would like
to call some attention to a related discussion[1] in a neighboring list,
and some patches[2][3][4] that followed it - at least [3] is a pre-requisite for this patch (error-report-web has hardcoded the version
of the script to 0.3).
Quoted 8 lines
Quoted 5 lines
[1]: https://lists.yoctoproject.org/g/yocto/message/65184
[2]: https://lists.yoctoproject.org/g/yocto/message/65188
[3]: https://lists.yoctoproject.org/g/yocto/message/65199
[4]: https://lists.yoctoproject.org/g/yocto/message/65200Can you revert the patch v1 and then apply patch v2, at least after patch [3] has been applied to error-report-web?
It would be helpful to address that to the person who maintains the repo. I've updated to the v2 of your patch.
I've queued your patch for the server but updating the instance is beyond my access/skills. I also queued a django and python3 upgrade on master-next there which it would be good to test.
Copying helpdesk to see if they can schedule in some help in updating the instance either to master (easier) or ultimately to test master- next and move to that.
Cheers,
Richard
The new Django 4.2.20 https://errors.yoctoproject.org/ is live. The previous version is still available at
https://errors-prev.yoctoproject.org/Errors/Latest/Autobuilder/ for comparison. Tracking at
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15336.
Thanks to everyone who helped with the upgrade.
Quoted 50 lines · Richard Purdie via lists.openembedded.org
Quoted 13 lines · Thomas Perrot via lists.openembedded.org
Hello,
Quoted 9 lines · Gyorgy Sarvari via lists.openembedded.org
I noticed that this (or at least v1) was applied on master - would like
to call some attention to a related discussion[1] in a neighboring list,
and some patches[2][3][4] that followed it - at least [3] is a pre-requisite for this patch (error-report-web has hardcoded the version
of the script to 0.3).Quoted 8 lines
Quoted 5 lines
[1]: https://lists.yoctoproject.org/g/yocto/message/65184
[2]: https://lists.yoctoproject.org/g/yocto/message/65188
[3]: https://lists.yoctoproject.org/g/yocto/message/65199
[4]: https://lists.yoctoproject.org/g/yocto/message/65200Can you revert the patch v1 and then apply patch v2, at least after patch [3] has been applied to error-report-web?
It would be helpful to address that to the person who maintains the repo. I've updated to the v2 of your patch.
I've queued your patch for the server but updating the instance is beyond my access/skills. I also queued a django and python3 upgrade on master-next there which it would be good to test.
Copying helpdesk to see if they can schedule in some help in updating the instance either to master (easier) or ultimately to test master- next and move to that.
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#215480):
https://lists.openembedded.org/g/openembedded-core/message/215480
Mute This Topic: https://lists.openembedded.org/mt/112330994/1003190
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Michael Halstead Linux Foundation / Yocto Project Systems Operations Engineer