A CA PC App is an open source application running in CA PC App View or Browser view, typically published on http://github.com/CA-PM.
What to check when a CA PC App does not perform as expected?
Make yourself familiar with the in-browser debug tool. To launch it in IE/Chrome, hit F12
- Console log and source code view are of primary interest here. Most apps log meaningful data. It can be viewed at any time.
- You can view the source code in debugger. Find the app source file (e.g. index.html, Chrome: Ctrl+P, IE: Ctrl+O). In some cases, a trace might be required to inspect variable settings at different stage.
no data in app view
verify context parameters and queries -> see “Query verification” below
error messages "HttpRequest" or returncode 403/Forbidden:
A non-admin user is making a request to /pc/da/rest without authorization. see https://communities.ca.com/docs/DOC-231174750-ca-pc-apps-and-user-authorization
Most apps log the OpenAPI or REST query URL to console for verification.
- on console tab, CTRL+F, search for “url”
- Are context parameters correctly passed to the query in the url?
- look for other log messages
- verify the query output. Copy the query into new browser tab, replace the proxy tag /pc as below and execute
- Does the query return valid output?
App interactive tracing
The in-browser debugger allows interactive tracing. If the code has callbacks (e.g. for buttons or other controls) you can
- pause the script execution
- set breakpoint at callback function
- resume execution
- once arrived at breakpoint, hover with the mouse over a variable occurrence. A popup window will display its contents and allow further inspection of array or structure elements
Trace App from start
The code might require tracing right from the beginning. Just refresh the page or view while the debugger is open. The execution will stop at the “debugger;” statement in the code.
- If the app does not already have debugger statement in its code, edit the app file with standard text editor as follows:
- add “debugger;” statement at the beginning of the main script code
NOTE: Minor in place (debug) edits are fine. In case of permanent changes, don’t forget to maintain its integrity with the app package source.
App location is on CA PC host, /opt/CA/PerformanceCenter/PC/webapps/<APP_LOC> file, where <APP_LOC> is the first part of the URL in the CA PC APP View definition, such as /pc/apps/user/Google-WeatherMap-master/index.html
- refresh the app page or view while the debugger is open
- execution will pause at debugger statement
- set breakpoints in the source code view wherever appropriate, such as
- parsing routine of query output
- before calling other library functions
- resume execution and once arrived at breakpoint, inspect variables of interest