USE Statement
The USE statement is used to define the data model to be queried. A data model is a way to view a set of events, including columns parsed off the event body. The data model defines which events to parse, how to parse them, and which columns to extract in order to execute this query.
The USE statement is an optional parameter, but it is a good practice to improve performance by reducing the set of event sources and set of parsers used.
<useStatement> ::= "USE" <identifier> ( "," <identifier> )* ;
The USE statement consists of the USE keyword followed by one or many data model names separated by commas. An <identifier> is a letter followed by any sequence of letters, digits, or an underscore (_).
There following data models are supported by TIBCO OI Hawk RedTail:
| 1. | DataModels starting with ‘OI_’: These data models represent TIBCO OI Hawk RedTail time series database internal information e.g. OI_Prometheus_Runtime. |
| 2. | DataModels starting with ‘RT_’: These data models represent Hawk microagent method information. Note that all the Hawk microagent methods are automatically converted to equivalent data models with each microagent method return argument mapped to the data model column with appropriate data type. For example, the Hawk Self microagent’s method getReleaseVersion will be translated to the data model:“ RT_Self_getReleaseVersion” with columns as:Name : STRING Version : STRING Date : STRING Major : INT Minor : INT Update : INT AgentName : STRING HawkDomain : STRING sys_eventTime : TIMESTAMP sys_domain : STRING |
| 3. | DataModels starting with ‘TS_’: These data models represent the exported metric time series. For every metric scraped by TIBCO OI Hawk RedTail, there is an equivalent data model created. For example, for the metric exported by BWCE Activity Execution time, the data model created in the background would be: TS_hawk_bwce_getactivitystats_execution_time with columns as:activity_name : STRING application_name : STRING application_version : STRING process_name : STRING value : FLOAT |
Considerations when Using a Data Model
| • | TIBCO OI Hawk RedTail does not allow user created data models. They are auto-generated for each Hawk microagent method or when you configure a metric exporter. |
| • | You must provide a data model in the Search field, otherwise the search will not return any results. |
| • | If you are using more than one time series Data model (TS_) in the query, then all the data models in the query should have the same columns (labels) and there should be an arithmetic operation on the value column of all the constituting data models |
| • | You cannot use multiple non time series data models (viz. OI_ or RT_) in the query. |
| • | Full-text search is not supported. You need to filter on a specific column in the data model. |
Examples
| Data Model Expression | Definition |
|---|---|
use TS_go_memstats_alloc_bytes_total
|
The result displays all values from TS_go_memstats_alloc_bytes_total metric. |
use TS_go_memstats_alloc_bytes_total, TS_go_memstats_heap_inuse_bytes | COLUMNS instance, job, TS_go_memstats_alloc_bytes_total.value + TS_go_memstats_heap_inuse_bytes.value AS CombinedValue
|
The result displays all values from TS_go_memstats_alloc_bytes_total and TS_go_memstats_heap_inuse_bytes metrics with the value summed from both the metric data model. |