Create metrics
Define a set of time based metrics that are generated using captured and stored streamed events
Objective
Example
metrics engine:
...
foreach metric compute:
metrics:
#
# Metric family: BidMovingAverage
#
- name: BidMovingAverage
#
# Metric definition
#
metric key: symbol
table definition: standardQuoteAnalyticsStream.BidMovingAverage
(symbol VARCHAR, avg_bid_min FLOAT, avg_bid_avg FLOAT,avg_bid_max FLOAT)
query:
SELECT symbol,
MIN(bid) AS 'avg_bid_min',
AVG(bid) AS 'avg_bid_avg',
MAX(bid) AS 'avg_bid_max'
FROM standardQuoteAnalyticsStream.quote
WHERE
ingestTime >= date_trunc('minutes',now() - INTERVAL 2 MINUTES) AND
ingestTime <= date_trunc('minutes',now())
GROUP BY symbol
ORDER BY 1;
#
# Truncate BidMovingAverage on startup
#
truncate on start: true
#
# Manage metric storage
#
compaction policy:
frequency: 8
time unit: HOURSAttributes schema
Attribute
Description
Data Type
Required
Last updated