UI - script API
StackState Self-hosted v4.5.x
This page describes StackState v4.5.x. The StackState 4.5 version range is End of Life (EOL) and no longer supported. We encourage customers still running the 4.5 version range to upgrade to a more recent release.
These functions only work in the context of scripts that are executed by a user from the user-interface. Component actions are an example of scripts that can trigger actions in the user-interface.
Function: baseUrl
Returns the baseUrl of the StackState instance as configured in the application.conf
or values.yaml
.
Examples:
Return the base URL from the StackState configuration.
Function: createUrl
createUrl
Creates a URL builder that can be used to generate URLs that can be linked back in StackState.
Args:
No arguments.
Return type:
PerspectiveUrlBuilder
Builder methods:
view(viewURN)
orexplore()
- returns aPerspectiveUrlBuilder
for either the specified view or the exploration mode with the following methods:at(time: instant)
- specifies a time for which the view query should be executed.topologyQuery(query: String)
- specifies a topology querywithComponent(component)
- creates a view URL with the specified component in focus.withTelemetryComponent(component: Any)
- specifies telemetry component to show charts for on the Telemetry PerspectiveeventsPerspective()
- points the URL to the Events PerspectivetracesPerspective()
- points the URL to the Traces PerspectivetelemetryPerspective()
- points the URL to the Telemetry PerspectivetopologyPerspective()
- points the URL to the Topology PerspectivenoRootCause()
- disable root cause analysis for the Topology PerspectiverootCauseOnly()
- show root cause on the Topology PerspectivefullCauseTree()
- show full cause tree on the Topology PerspectivetopologyListMode()
- use list mode on Topology PerspectivetopologyGraphMode()
- use graph mode on Topology PerspectivewithEventType(value: String)
- adds type to events filteringwithEventTag(value: String)
- adds tag to events filteringwithEventCategory(value: String)
- adds categories to events filteringwithEventSource(value: String)
- adds a source to events filteringwithTraceTag(value: String)
- adds tag to traces filteringwithTraceSpanType(value: String)
- adds span type to traces filteringdomainGrid(enabled: Boolean)
- enables or disables domain grid for the topology in graph modelayerGrid(enabled: Boolean)
- enables or disables layer grid for the topology in graph modenoGrouping()
- disables grouping of components on the topology in graph modeautoGrouping()
- enables automatic grouping of components on the topology in graph modegroupingByTypeAndState()
orgroupingByTypeAndState(minimumGroupSize: Int)
- enables grouping of components on the topology in graph mode by component type and state and specifies a minimum number of components to form a groupgroupingByTypeStateAndRelations()
orgroupingByTypeStateAndRelations(minimumGroupSize: Int)
- enables grouping of components on the topology in graph mode by component type, state and relations and specifies a minimum number of components to form a groupshowIndirectRelations()
- enables rendering of indirect relations on the Topology Perspectiveurl()
- gives the final URL of the view.
Examples:
Create a URL to a view at a specific time.
Create a URL to a view focussing on a component.
Create a URL to the Topology Perspective explore mode with filters in place to show all components from the production environment that are in critical state and showing the full root cause tree
Function: redirectToURL
redirectToURL
Opens a new tab in the user's browser to some URL.
Args:
url
- the URL to redirect the browser to.
Return type:
Async: URLRedirectResponse
Examples:
Open the stackstate.com website in a new tab in the browser.
Function: showReport
showReport
Shows a report in the user-interface. The user-interface will open a dialog with the report in it. You can also see the result of these reports in the preview of the analytics environment.
Args:
reportName
- Name of the report. In a dialog with the report, the name of the report will be in the title bar.stmlContent
- The report markup. See StackState Markup Language for more information on how to format a report.Optional
data
- A map with data elements that can be referenced by the STML.
Return type:
Async: ShowStmlReport
Examples:
The following example will show a nice shopping list report:
Note the .stripMargin()
call. This is a Groovy function for strings that strips leading whitespace/control characters followed by '|' from every line. This way, indenting can be retained without introducing leading whitespace in the STML.
Function: showTopologyByQuery
showTopologyByQuery
Sets the user-interface to the Topology Perspective and changes the SQTL query.
If the user is currently in an unsaved view, the user receives a prompt dialog asking whether they are okay in navigating to another part of the topology. If the user continues the action they will loose their current view.
Args:
query
- STQL query that selects what part of the topology is shown.
Return type:
Async: ShowTopologyByQuery
Examples:
Redirects the user-interface to show the Azure topology.
Last updated