Can I get the stack trace without an exception/error in Sentry? - sentry

Trying to see if I can get the stack trace (for both backend and frontend) on Sentry, without actually creating an error. I don't need to create an event, just sort of fetch whatever the last 50 actions (breadcrumbs, I believe?) were. Any help would be much appreciated!
Using Python for backend.

you can just do a captureMessage instead, but remember to enable the attach_stacktrace mode -> https://docs.sentry.io/platforms/python/configuration/options/#attach-stacktrace

Related

How to debug HyperLedger Composer Transaction code in Playground

I am using a local install of Playground on MacOS.
I was successful to create my business network, add my model file and logic to this network and create assets and participants instances.
So now I am ready to submit my first transaction, but I get an error message in the popup window as a result to my request. The message per se is not the problem (it's about some Undefined asset), my problem is I want to debug this transaction code by producing some execution traces, using old-school printf or log message.
I tried to insert console.log(message) instructions in my transaction code but eventually I was not able to retrieve those logs traces (eg. using a command like docker logs -f composer).
Is there another way to produce logs traces? Or did I miss a config setting to defilter logs in docker logs?
Any help greatly appreciated!
Olivier.
On console logging (and seeing them in the browser Developer console), see this Stack Overflow here (hyperledger composer playground) Can you see results of console.log('something') in browser? (it also has a link to more info there
See here https://hyperledger.github.io/composer/latest/problems/diagnostics.html for more on logging / where to find debug logs.
As for setting checkpoint/breakpoints: These are set by the Editor tooling 🙂 In H/Composer, you can just use the embedded connector (eg such as TP functions) to try out / step through each breakpoint - for more info on VSCode -> https://code.visualstudio.com/docs/editor/debugging and Atom -> How do I set a breakpoint inside of atom's package? and I posted the link to diagnostics/logging above.
One quick way I used to insert breakpoints with debug messages, is to throw an exception using throw new Error(...) in the transaction method.
This shows up in the playground interface as well.

Codeigniter global error override

Is there a way in Codeigniter to override global errors. For instance if an DB error or PHP critical occurs it wont show the error itself but something like 'Our admin guy is fixing the issue' and the error is just logged and emailed.
Codeigniter lets you handle error messages your way, depending on the HTTP status.
Refer to this documentation on error handling
In addition to #Pos5e5s3dFr3ak's answer, you should handle as many errors as you can manually. For example, if you have a database error, your code should acknowledge (or 'catch') it and perhaps load the appropriate view, or pass it onto a library that will log an email the fault, instead of displaying the intended result.
This method can be used as an alternative, or as an addition to the original answer - sometimes you need not locate the error just by its HTTP response Status Code.
As an example, you may find that the database engine in use is down. If this is the case (you would have to determine if it is indeed down - ie. you are not getting the desired response), you would pass the user on to example.com/error/database, for example.

Can sitebricks be configured to not say "Sitebricks received a null reply from the resource..."?

In some error cases including the one above Sitebricks adds a stack trance to the response. This is a security issue with leaking information. We plug the problems we find but is there a way to tell site bricks never to send stack traces?
The problem is not at the Sitebricks level but at your servlet container or Filter level. If you are using a normal servlet container you should configure error pages in web.xml using the directive:
http://www.tutorialspoint.com/servlets/servlets-exception-handling.htm
Alternatively, you can use a filter to check if the response code is not 2XX and display a custom error page yourself.
Sitebricks shows the error trace as a debugging tool.

Log HTTP Header redirects, ideally in Firefox

I'm attempting to diagnose a specific failing test case in a legacy X-Cart installation, and determining program flow from reading the PHP source is non-trivial. I need to be able to see what redirects occur and when, ideally in a sequential log, IE:
[timestamp] domain.com/cart.php?mode=checkout
[timestamp] paypal.com/magic?afoot&this=sorcery
[timestamp] domain.com/cart.php?mode=soulcrushingdespair
I've Googled to no avail. If anyone knows how to log redirects in this way, or even similar ways, I would be appreciative.
Install Live HTTP Headers, which is an add-on you can download the usual way.
Firebug also does a great job of this.

Need to debug recorded jmeter script

I recently recorded a test script in Jmeter intended for use as a load test script (using this handy set of instructions. The recording itself worked great and I even figured out how to grab and parametrize the session ids and timestamps. However, if I run the recorded steps just as they were recorded some of them don't work -- they generate "500--Server encountered and internal error ...nested exception is java.lang.NullPointerException" The failing steps are all Ajax calls that populate sidebar elements. If I copy the request GET call (Request tab, ViewResultsTree) and paste it into a browser I get the exact same error. Do I need to record my script differently, or hand-code the ajax calls? Other, earlier steps work correctly and send the expected POST data, so it isn't the application under test or forgotten proxy settings. Currently running against Firefox 3.6.10
Any suggestions on how I can debug this would be greatly appreciated.
The first thing I'd do is determine if the java.lang.NullPointerException is happening on the client side (JMeter) or on your server. If it is happening in JMeter, than something is terribly wrong with either your script or with JMeter.
But assuming that the error is encountered on your server, then looking into the cause of the exception may shed light on what is wrong with the request issued by JMeter. Do you have access to the code where the exception is thrown?
I would also recommend comparing the request in the recording with the request that generated the error. You may need to determine which parts of the request are session-specific and ensure those fields are populated correctly.
It sounds like Jmeter isn't executing the AJAX calls, and this can be fine depending on your site. Can you simply do an HTTP request to get the pages the AJAX calls populate?
I would recommend reading this post, as it looks pretty good.
I've seen that situation caused by a few things:
a page is required to load and be cached BEFORE making the failing request;
the failing page needs to automatically redirected to work properly;
the failing page has sub-requests JMeter failed to record. Devs can help with this.
Hope this helps.

Resources