LogoLogo
StackState.comDownloadSupportExplore playground
StackState v5.1
StackState v5.1
  • Welcome to the StackState docs!
  • StackState self-hosted v5.1 docs
  • Getting Started
  • 🚀Setup
    • Install StackState
      • Requirements
      • Kubernetes / OpenShift
        • Kubernetes install
        • OpenShift install
        • Required Permissions
        • Non-high availability setup
        • Override default configuration
        • Configure storage
        • Configure Ingress
        • Install from custom image registry
        • Migrate from Linux install
      • Linux
        • Before you install
        • Download
        • Install StackState
        • Install with production configuration
        • Install with development configuration
        • Install with POC configuration
        • Set up a reverse proxy
        • Set up TLS without reverse proxy
      • Initial run guide
      • Troubleshooting
    • Upgrade StackState
      • Steps to upgrade
      • Version specific upgrade instructions
      • StackPack versions
      • StackState release notes
    • StackState Agent
      • About StackState Agent V3
      • Docker
      • Kubernetes / OpenShift
      • Linux
      • Windows
      • Advanced Agent configuration
      • Use an HTTP/HTTPS proxy
      • Agent V1 (legacy)
      • Migrate Agent V1 to Agent V2
        • Linux
        • Docker
    • StackState CLI
      • CLI: sts
      • CLI: stac (deprecated)
      • Comparison between CLIs
    • Data management
      • Backup and Restore
        • Kubernetes backup
        • Linux backup
        • Configuration backup
      • Data retention
      • Clear stored data
  • 👤Use
    • Concepts
      • The 4T data model
      • Components
      • Relations
      • Health state
      • Layers, Domains and Environments
      • Perspectives
      • Anomaly detection
      • StackState architecture
    • StackState UI
      • Explore mode
      • Filters
      • Views
        • About views
        • Configure the view health
        • Create and edit views
        • Visualization settings
      • Perspectives
        • Topology Perspective
        • Events Perspective
        • Traces Perspective
        • Metrics Perspective
      • Timeline and time travel
      • Analytics
      • Keyboard shortcuts
    • Checks and monitors
      • Checks
      • Add a health check
      • Anomaly health checks
      • Monitors
      • Manage monitors
    • Problem analysis
      • About problems
      • Problem lifecycle
      • Investigate a problem
      • Problem notifications
    • Metrics
      • Telemetry streams
      • Golden signals
      • Top metrics
      • Add a telemetry stream
      • Browse telemetry
      • Set telemetry stream priority
    • Events
      • About events
      • Event notifications
      • Manage event handlers
    • Glossary
  • 🧩StackPacks
    • About StackPacks
    • Add-ons
      • Autonomous Anomaly Detector
      • Health Forecast
    • Integrations
      • About integrations
      • 💠StackState Agent V2
      • 💠AWS
        • AWS
        • AWS ECS
        • AWS X-ray
        • StackState/Agent IAM role: EC2
        • StackState/Agent IAM role: EKS
        • Policies for AWS
        • AWS (legacy)
        • Migrate AWS (legacy) to AWS
      • 💠Dynatrace
      • 💠Kubernetes
      • 💠OpenShift
      • 💠OpenTelemetry
        • About instrumentations
        • AWS NodeJS Instrumentation
        • Manual Instrumentation
          • Prerequisites
          • Tracer and span mappings
          • Relations between components
          • Span health state
          • Merging components
          • Code examples
      • 💠ServiceNow
      • 💠Slack
      • 💠Splunk
        • Splunk
        • Splunk Events
        • Splunk Health
        • Splunk Metrics
        • Splunk Topology
      • 💠VMWare vSphere
      • Apache Tomcat
      • Azure
      • Cloudera
      • Custom Synchronization
      • DotNet APM
      • Elasticsearch
      • Humio
      • Java APM
      • JMX
      • Logz.io
      • MySQL
      • Nagios
      • OpenMetrics
      • PostgreSQL
      • Prometheus
      • SAP
      • SCOM
      • SolarWinds
      • Static Health
      • Static Topology
      • Traefik
      • WMI
      • Zabbix
    • Develop your own StackPacks
  • 🔧Configure
    • Topology
      • Component actions
      • Identifiers
      • Topology naming guide
      • Topology sources
      • Create a topology manually
      • Configure topology synchronizations
      • Enable email event notifications
      • Send topology data over HTTP
      • Set the topology filtering limit
      • Use a proxy for event handlers
      • Use tags
      • Tune topology synchronization
      • Debug topology synchronization
    • Telemetry
      • Add telemetry during topology synchronization
      • Data sources
        • Elasticsearch
        • Prometheus mirror
      • Send events over HTTP
      • Send metrics data over HTTP
      • Set the default telemetry interval
      • Debug telemetry synchronization
    • Traces
      • Set up traces
      • Advanced configuration for traces
    • Health
      • Health synchronization
      • Send health data over HTTP
        • Send health data
        • Repeat Snapshots JSON
        • Repeat States JSON
        • Transactional Increments JSON
      • Debug health synchronization
    • Anomaly Detection
      • Export anomaly feedback
      • Scale the AAD up and down
      • The AAD status UI
    • Security
      • Authentication
        • Authentication options
        • File based
        • LDAP
        • Open ID Connect (OIDC)
        • KeyCloak
        • Service tokens
      • RBAC
        • Role-based Access Control
        • Permissions
        • Roles
        • Scopes
        • Subjects
      • Secrets management
      • Self-signed certificates
      • Set up a security backend for Linux
      • Set up a security backend for Windows
    • Logging
      • Kubernetes logs
      • Linux logs
      • Enable logging for functions
  • 📖Develop
    • Developer guides
      • Agent checks
        • About Agent checks
        • Agent check API
        • Agent check state
        • How to develop Agent checks
        • Connect an Agent check to StackState
      • Custom functions and scripts
        • StackState functions
        • Check functions
        • Component actions
        • Event handler functions
        • ID extractor functions
        • Mapping functions
        • Monitor functions
        • Propagation functions
        • Template functions
        • View health state configuration functions
      • Custom Synchronization StackPack
        • About the Custom Synchronization StackPack
        • How to customize elements created by the Custom Synchronization StackPack
        • How to configure a custom synchronization
      • Integrate external services
      • Mirroring Telemetry
      • Monitors
        • Create monitors
        • Monitor STJ file format
      • StackPack development
        • How to create a StackPack
        • Packaging
        • How to get a template file
        • How to make a multi-instance StackPack
        • Prepare a multi-instance provisioning script
        • Upload a StackPack file
        • Prepare a shared template
        • Customize a StackPack
        • Prepare instance template files
        • Prepare a StackPack provisioning script
        • Resources in a StackPack
        • StackState Common Layer
      • Synchronizations and templated files
    • Reference
      • StackState OpenAPI docs
      • StackState Template JSON (STJ)
        • Using STJ
        • Template functions
      • StackState Markup Language (STML)
        • Using STML
        • STML Tags
      • StackState Query Language (STQL)
      • StackState Scripting Language (STSL)
        • Scripting in StackState
        • Script result: Async
        • Script result: Streaming
        • Time in scripts
        • Script APIs
          • Async - script API
          • Component - script API
          • HTTP - script API
          • Prediction - script API
          • StackPack - script API
          • Telemetry - script API
          • Time - script API
          • Topology - script API
          • UI - script API
          • View - script API
    • Tutorials
      • Create a simple StackPack
      • Push data to StackState from an external system
      • Send events to StackState from an external system
      • Set up a mirror to pull telemetry data from an external system
Powered by GitBook
LogoLogo

Legal notices

  • Privacy
  • Cookies
  • Responsible disclosure
  • SOC 2/SOC 3
On this page
  • Function: UI.baseUrl()
  • Examples
  • Function: UI.createUrl()
  • Args
  • Return type
  • Builder methods
  • Examples
  • Function: UI.redirectToURL(url: String)
  • Args
  • Return type
  • Examples
  • Function: UI.showReport(reportName: String, stmlContent: String)
  • Args
  • Return type
  • Examples
  • Function: UI.showTopologyByQuery(query: String)
  • Args
  • Return type
  • Examples
  1. Develop
  2. Reference
  3. StackState Scripting Language (STSL)
  4. Script APIs

UI - script API

StackState Self-hosted v5.1.x

PreviousTopology - script APINextView - script API

Last updated 2 years ago

These functions only work in the context of scripts that are executed by a user from the user-interface. are an example of scripts that can trigger actions in the user-interface.

Function: UI.baseUrl()

Returns the baseUrl of the StackState instance (<STACKSTATE_BASE_URL>) as configured in the application.conf or values.yaml.

Examples

Return the base URL from the StackState configuration.

Function: UI.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) or explore() - returns a PerspectiveUrlBuilder for either the specified view or the exploration mode with the following methods:

    • at(time: instant) - specifies a for which the view query should be executed.

    • topologyQuery(query: String) - specifies a topology query

    • withComponent(component) - creates a view URL with the specified component in focus.

    • withTelemetryComponent(component: Any) - specifies telemetry component to show charts for on the Metrics Perspective

    • eventsPerspective() - points the URL to the Events Perspective

    • tracesPerspective() - points the URL to the Traces Perspective

    • telemetryPerspective() - points the URL to the Metrics Perspective

    • topologyPerspective() - points the URL to the Topology Perspective

    • noRootCause() - disable root cause analysis for the Topology Perspective

    • rootCauseOnly() - show root cause on the Topology Perspective

    • fullCauseTree() - show full cause tree on the Topology Perspective

    • topologyListMode() - use list mode on Topology Perspective

    • topologyGraphMode() - use graph mode on Topology Perspective

    • withEventType(value: String) - adds type to events filtering

    • withEventTag(value: String) - adds tag to events filtering

    • withEventCategory(value: String) - adds categories to events filtering

    • withEventSource(value: String) - adds a source to events filtering

    • withTraceTag(value: String) - adds tag to traces filtering

    • withTraceSpanType(value: String) - adds span type to traces filtering

    • domainGrid(enabled: Boolean) - enables or disables domain grid for the topology in graph mode

    • layerGrid(enabled: Boolean) - enables or disables layer grid for the topology in graph mode

    • noGrouping() - disables grouping of components on the topology in graph mode

    • autoGrouping() - enables automatic grouping of components on the topology in graph mode

    • groupingByTypeAndState() or groupingByTypeAndState(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 group

    • groupingByTypeStateAndRelations() or groupingByTypeStateAndRelations(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 group

    • showIndirectRelations() - enables rendering of indirect relations on the Topology Perspective

    • url() - gives the final URL of the view.

Examples

Create a URL to a view at a specific time.

View.getAll().then { views ->
    UI.createUrl().view(views[0].view).at('-15m').url()
}

Create a URL to a view focussing on a component.

View.getAll().then { views ->
    Component.withId(component).get().then { component ->
        UI.createUrl().view(views[0].view).at('-15m').withComponent(component).url()
    }
}

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

UI.createUrl().explore().topologyQuery('environment IN ("Production") AND healthstate IN ("CRITICAL")').fullCauseTree().url()

Function: UI.redirectToURL(url: String)

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.

UI.redirectToURL("http://wwww.stackstate.com")

Function: UI.showReport(reportName: String, stmlContent: String)

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.

  • 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:

UI.showReport(
    "My shopping list",
    """# To buy
    | Bring *report*.
    |  * Apples
    |  * Oranges
    """.stripMargin()
)

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: UI.showTopologyByQuery(query: String)

Sets the user-interface to the Topology Perspective and changes the SQTL query.

If the user is currently in an unsaved view, they will receive a prompt dialog asking whether they're okay in navigating to another part of the topology. If the user continues the action they will lose their current view.

Args

Return type

  • Async: ShowTopologyByQuery

Examples

Redirects the user-interface to show the Azure topology.

UI.showTopologyByQuery('domain IN ("Azure")')

stmlContent - The report markup. See for more information on how to format a report.

query - that selects what part of the topology is shown.

📖
Component actions
time
StackState Markup Language
STQL query