Business event metric extraction is a convenient way to create your own business metrics. It enables you to:
You need to create your business metrics before ingesting business event data.
To add a business event metric
Go to Settings > Business Analytics > Metric extraction.
Select Add business event metric and name your metric by adding a metric Key starting with the bizevents.
prefix (for example, bizevents.EasyTrade.TradingVolume
).
Add a Matcher to your rule by pasting your matcher-specific DQL query. In the above example, to calculate your trading volume metric, you need to extract only buy transactions, so the matcher query is as follows.
matchesValue(event.type, "com.easytrade.buy-assets")
Choose the Measure on which your metric will be based. There are two options.
Occurrence of business events records—a count of events that match your DQL query
Attribute value—a collection of measures for the attribute value of business events that match your DQL query
Specify your attribute name in the Attribute field. Attribute name matching is not case sensitive. For example, if you choose Trading_Volume
, the specified attribute name for metric extraction should be trading_volume
. However, be sure to use the exact attribute name of your business event.
Select Add dimension. Adding dimensions allows you to split the business event occurrences by a specific business event attribute such as a hostname. If the attribute contains more than one value, the first attribute value acts as the metric dimension. The maximum number of dimensions is 50. Be sure to use the exact attribute name of your business event.
Select Save changes.
You can extract and visualize your metrics to use them further in your analysis. You can also create metric-based alerts tailored to your needs.
To display business event metrics
Go to Data Explorer.
Find your metric in the search window, select Run query, and display the results.
You can also:
See the example visualization below.
You can also explore custom metrics based on business events in Grail, for example, by using the DQL timeseries
command. The following is an example DQL timeseries
query against the bizevents.easyTrade.TradingVolume
metric.
timeseries avg(bizevents.easyTrade.TradingVolume), alias:avgTradingVolume, interval:1d, from:now()-30d, to:now()
Run this query in Notebooks (Query Grail > Run query) and view results using the recommended Line chart visualization option.
To create alerts based on business event metrics
Go to Settings > Anomaly detection > Metric events.
Select Add metric event and create a custom event where Type is Metric selector. This is the metric key defined earlier, for example, bizevents.EasyTrade.TradingVolume
.
Metric events based on business events are only supported with metric selector queries. See Metric selector events for more information.
If the event timestamp doesn't fall within the allowed range, your metric is replaced in Grail by a metric with the .failed
suffix added to the metric key. This new metric will have a recent timestamp, (now())
and the dimension that would have been attached to the metric you wanted to extract. You can also visualize this metric in Data Explorer or Notebooks.