SystemPerformance Utility (pka pButtons) API (and REST API) [and sample UI]
While reviewing our documentation for our ^pButtons (in IRIS renamed as ^SystemPerformance) performance monitoring utility, a customer told me: "I understand all of this, but I wish it could be simpler… easier to define profiles, manage them etc.".
After this session I thought it would be a nice exercise to try and provide some easier human interface for this.
The first step in this was to wrap a class-based API to the existing pButtons routine.
I was also able to add some more "features" like showing what profiles are currently running, their time remaining to run, previously running processes and more.
The next step was to add on top of this API, a REST API class.
With this artifact (a pButtons REST API) in hand, one can go ahead and build a modern UI on top of that.
For example -
So I'm sharing with you here a few steps of the way:
Two classes which are the "Basic" API –
As well as the REST API (including some Unit Test classes to test these).
A Swagger JSON for the REST API. To build this I used what was then (back in 2017) a not yet released capability in InterSystems IRIS for REST management. Building on top of the basic Swagger JSON provided by the InterSystems IRIS I added further information.
As well as a simple angular UI (based on this http://websystique.com/angularjs/angularjs-crud-application-using-ngresource/)
A few important notes:
- Most of the "Basic" API methods use documented and supported entry points to the pButtons/SystemPerformance routine. But some methods access the internal structures managed by the pButtons utility. These are NOT documented or supported and these methods could stop working upon upgrade without notice.
- This code by any means is not intended as a "best-practice" example for building a REST-based Angular app with InterSystems IRIS. The UI part was just given as an example/"teaser" and a sample starting point [It's not complete for example - the "General section" (e.g. a place-holder for Log folder location management) was not implemented; and the Refresh of the contents doesn't work fully across the board and some other "known issues..."]
- The initial code for this was written quite some time ago - so:
- (a) I came back to this now to make sure it runs with IRIS (and had to make some naming changes).
- (b) The REST API did not use the spec-first approach - I did initially play with the (back then) IRIS-beta's support for generating a Swagger, and now used that to make this into a spec-first approach.
- (c) This might not use the latest features available today.
- (d) I added now also support for this running within a Docker container (with the relevant Dockerfile etc.).
- (e) I also added support for this being installed as a ZPM package.