Configure custom interaction events
Event configuration enables you to perform drill-down analysis on individual fields or query results for deeper data analysis. You can configure interaction events for the attributes of a trace to query detailed trace information or view associated logs, metrics, and other data. This topic describes how to configure interaction events.
Interaction events are an essential feature for data analysis. By changing data dimensions and analysis granularity, you can gain deeper insights from your data. Trace analysis allows you to set interaction events for the fields and attributes of a span. The available interaction event types include:
-
Open Logstore: Redirects to a target Logstore page in Simple Log Service (SLS).
-
Custom HTTP Link: Redirects to a target HTTP URL.
-
Open in Editor: Displays the field value in text or JSON format in a pop-up window.
-
Open Saved Search: Redirects to a target saved search page in Simple Log Service (SLS).
Add a custom interaction event
-
On the Trace Explorer page, click the TraceID of a trace.
-
Select a target span, and in the Span Details pane on the right, click Event Config.
-
In the Drilldown Config panel, select the scope for the interaction event.
Custom events have two scopes: service event configuration and global event configuration. The service event configuration applies only to traces of the current application, whereas the global event configuration applies to all traces in the current region.
On the service event configuration tab, click Add Field to add the SpanId and TraceID fields.
-
Click Add Field, select the field to configure for the event, and then click OK.
-
Click Add Event and select an interaction event from the drop-down list.
Available interaction events include Open Logstore, Custom HTTP Link, Open in Editor, and Open Saved Search.
-
Configure the event parameters and click OK.
For parameter details, see Interaction event parameters.
On the service event configuration tab, add an event for the SpanId field. Configure the Custom Name and select the Text Type. You can click Add Event to add more interaction events.
Trigger a custom event
In the Span Details pane, hover over a field highlighted in blue. A tooltip appears, displaying the configured custom events. Click an event name to trigger the interaction event.
For example, when you hover over the value of the SpanId field, the Custom Events section in the pop-up menu displays configured events, such as Open in Editor and Query Associated Logs.
Interaction event parameters
Open Logstore
When you trigger the Open Logstore interaction event, the console redirects you to the target SLS Logstore page.
-
Prerequisites
The target Logstore must already be created. For more information, see Manage Logstores.
-
Parameters
Parameter
Required
Description
Custom name
Yes
The name of the custom interaction event. This name is displayed in the custom event tooltip.
Select region
Yes
The region where the target SLS project is located.
Select project
Yes
The name of the target SLS project.
Select logstore
Yes
The name of the target Logstore. When you trigger the interaction event, the console redirects to this Logstore.
Open in new window
No
If you enable this option, the target Logstore opens in a new browser window when you trigger the interaction event.
Time range
No
Specifies the query time range for the target Logstore. Options:
-
Preset: After you open the target Logstore, SLS uses the default query time range, which is 15 minutes (relative).
-
Inherit current query time: After you open the target Logstore, the query time range is inherited from the Trace Analysis page at the moment you trigger the interaction event.
-
Inherit data point time: After you open the target Logstore, the query start time is the value of Time Range Field minus the Time Range Offset, and the end time is the value of Time Range Field plus the Time Range Offset.
-
Relative Time: After you open the target Logstore, the query time is the specified relative time range.
-
Time Frame: After you open the target Logstore, the query time is the specified time frame.
Filter statement
No
Enter a filter statement. The system syncs it to the target Logstore and prepends it to the query statement with the
ANDoperator.Click Add Variable in the filter statement to insert field values as filter conditions.
Example:
traceId=${{TraceID}} AND spanId=${{SpanId}} -
Custom HTTP Link
When you trigger the Custom HTTP Link interaction event, the console redirects you to the target HTTP URL.
-
Prerequisites
An HTTP URL is available.
-
Parameters
Parameter
Required
Description
Custom name
Yes
The name of the custom interaction event. This name is displayed in the custom event tooltip.
Protocol
Yes
The protocol of the HTTP URL, such as HTTP or HTTPS.
URL
Yes
The destination URL.
The path in the HTTP URL represents the hierarchical path to the target resource. You can click Add Variable to insert variables into the URL path. When the link is clicked, the system replaces the variables with corresponding field values and redirects to the updated URL.
Encode URL
No
If you enable Encode URL, the link content is URL-encoded.
Open in new window
No
If you enable this option, the target HTTP URL opens in a new browser window when the interaction event is triggered.
Open in Editor
When you trigger the Open in Editor interaction event, the console displays the field value in text or JSON format in a pop-up window.
|
Parameter |
Required |
Description |
|
Custom name |
Yes |
The name of the custom interaction event. This name is displayed in the custom event tooltip. |
|
Text type |
No |
The display format for the field value. Valid values: Text and JSON. |
Open Saved Search
When you trigger the Open Saved Search interaction event, the console redirects you to the target SLS saved search page.
-
Prerequisites
A target saved search must already be created in SLS. For more information, see Saved searches.
To use variables, configure them in the target saved search's query statement. For more information, see Dynamically adjust query statement parameters by using variables.
-
Parameters
Parameter
Required
Description
Custom name
Yes
The name of the custom interaction event. This name is displayed in the custom event tooltip.
Select region
Yes
The region where the target SLS project is located.
Select project
Yes
The name of the target SLS project.
Select saved search
Yes
The target saved search in SLS. After you trigger the interaction event, the console opens the page for this saved search.
Open in new window
No
If you enable this option, the target saved search page opens in a new browser window when the interaction event is triggered.
Time range
No
Specifies the query time range for the target saved search. Options:
-
Preset: After you open the target saved search page, SLS uses the default query time range, which is 15 minutes (relative).
-
Inherit current query time: After you open the target saved search page, the query time range is inherited from the Trace Analysis page at the moment you trigger the interaction event.
-
Inherit data point time: After you open the target saved search page, the query start time is the value of Time Range Field minus the Time Range Offset, and the end time is the value of Time Range Field plus the Time Range Offset.
-
Relative Time: After you open the target saved search page, the query time is the specified relative time range.
-
Time Frame: After you open the target saved search page, the query time is the specified time frame.
Filter statement
No
Enter a filter statement. The system syncs it to the target saved search page and prepends it to the query statement with the
ANDoperator.Click Add Variable in the filter statement to insert field values as filter conditions.
Dynamic variables
No
SLS allows you to use variables to flexibly modify the query statement in the target saved search. If a variable added here has the same name as a variable in the target saved search query, the value of the field that triggers the interaction event replaces the variable in the query statement.
NoteYou can add up to five dynamic variables and five static variables.
-
Dynamic variables
-
Variable name: The name of the variable.
-
Variable value column: The column whose value dynamically replaces the variable in the saved search query.
-
-
Static variables
-
Variable name: The name of the variable.
-
Static value: The fixed value that replaces the variable in the saved search query.
-
Static variables
No
-
Preset interaction events
Trace Analysis includes the following preset interaction events:
When you right-click a span field value, a context menu appears. This menu is divided into the Advanced Configuration and Custom Events sections. The Advanced Configuration section displays built-in events, such as Query Trace with Current Condition and View Application Details. The Custom Events section displays user-configured events. The Event Config option at the bottom of the menu allows you to manage custom events.
|
Built-in event |
Applicable field |
Description |
|
Query Trace with Current Condition |
All fields except for span events |
Appends this field as a query condition to the Trace Analysis query. |
|
View Application Details |
Application name (serviceName) |
Redirects to the Application Monitoring Overview page. |
|
View Provided Services |
Interface name (spanName) |
Redirects to the Application Monitoring Provided Services page. |
|
View Instance Monitoring |
IP |
Redirects to the Application Monitoring Instance Monitoring page. |
|
View Raw Trace Data |
TraceID, SpanId |
Displays the raw trace data stored in SLS. |
FAQ
If you access the Trace Analysis page by using a virtual domain name (for example, if the ARMS page is embedded in a self-managed web page), triggering the Open Logstore or Open Saved Search events may redirect you to a logon page instead of the SLS console. To work around this issue, use a Custom HTTP Link interaction event to achieve the same effect. Follow these steps:
-
Create a Custom HTTP Link interaction event.
-
Select https as the Protocol and enter the destination URL in the URL field.
-
Prepare the target SLS URL. Replace the standard domain name (sls.console.alibabacloud.com) with the SLS virtual domain name (sls4servims.console.alibabacloud.com). For more information, see Prepare a shareable link. Disable Encode URL and enable Open in new window.
-
If you want to pass query parameters when redirecting to the Logstore, click Add Variable and select the variables to add.
The following example URL opens the Logstore named test-logstore in the project test-project and filters logs where the traceId equals the current trace's TraceID.
https://sls4servims.console.alibabacloud.com/lognext/project/test-project/logsearch/test-logstore?queryString=traceId=${{TraceID}}