Manage metrics

Reuse existing metrics on startup and reduce the operational memory overhead

Objective

Provide optional ability to reuse existing metrics on startup and reduce the operational memory overhead for stored metrics.

Example & DSL attributes

This example performs two key metric table functions:

  1. Truncates the BidMovingAverage table on process startup providing a clean restart.

  2. Executes the default compaction query on a 8 hour schedule for the BidMovingAverage metric.

Example

metrics engine:
  ...
  foreach metric compute:
    metrics:
    - name: BidMovingAverage
    ...  
    #
    # Truncate BidMovingAverage on startup
    #
    truncate on start: true
    
    #
    # Manage metric storage
    #
    compaction policy:
      frequency: 8
      time unit: HOURS

Metric Management Attributes

Each metric definition includes management attributes to control how the metric table is managed throughout the Joule process lifetime. Since Joule uses an in-memory database the size of table needs to be managed.

AttributeDescriptionData TypeRequired

truncate on start

Truncate metric data on restart. Note if you import metrics using the initialisation DSL element you will need to set this to false

Boolean

Default: true

compaction policy

Execute table compaction on a scheduled cycle. See below.

Compaction Policy Attributes

Managing metrics is a key aspect to the performance of the Joule runtime. By applying the compaction policy this will reduce the memory footprint required of the JVM and therefore the number of GC cycles.

AttributeDescriptionData TypeRequired

frequency

Frequency metrics are computed. Minimum value cannot be set below 1 for minute or hour time units.

Long

Default: 1

compaction query

User defined compaction query.

Note: The default query compacts the metric table by deleting all row less than the max createdTimestamp.

String

time unit

Time unit used to set the scheduled processing policy.

Supported units: MINUTES, HOURS

TimeUnit

Default: HOURS

Last updated