Metrics

Enrich events with pre-calculated metrics to facilitate further advanced processing

Objective

Advanced use cases may need pre-computed metrics as inputs for calculations, event triggers, or additional context.

The enricher processor uses the Metrics Engine query interface to query and bind metrics to an event using additional DSL attributes

The Metrics Engine is enabled by default using the following configuration in joule.properties: joule.internaldb.enable=true

Uses

There are various uses for this filter such as:

  1. In retail Utilise real-time sales data and competitor pricing metrics to adjust product prices dynamically, maximising profit margins and ensuring competitiveness.

  2. In manufacturing Use sensor data from machinery to predict failures before they occur, enabling proactive maintenance scheduling and reducing unplanned downtime.

  3. In e-commerce Combine user behaviour data with product performance metrics to generate personalised product recommendations, enhancing the customer shopping experience.

Example & DSL attributes

This example defines three enrichment strategies:

  1. bid_ask_avg Retrieves avg_ask and avg_bid values by using the AskBidMovingAverage metric family and symbol as the key from the MetricsDB.

  2. market_depth_metrics Fetches all attributes related to marketDepth for a given symbol from the MetricsDB.

  3. trading_triggers Retrieves tradingTriggers data as an object for a given symbol from the MetricsDB.

All enrichments use the MetricsDB for data retrieval.

enricher:
  fields:
    bid_ask_avg:
      by metric family: AskBidMovingAverage
      by key: symbol
      with values: [avg_ask, avg_bid]
      using: MetricsDB

    market_depth_metrics:
      by metric family: marketDepth
      by key: symbol
      all attributes: true
      using: MetricsDB
    
    trading_triggers:
      by metric family: tradingTriggers
      by key: symbol
      as object: true
      using: MetricsDB

Attributes schema

To direct the enricher to use the computed in-memory metrics database two attributes must be set.

Last updated