IBM Streams 4.2.1

Operator MetricsSink

Primitive operator image not displayed. Problem loading file: ../../image/tk$spl/op$spl.adapter$MetricsSink.svg

The MetricsSink operator reads tuples and populates metrics with the values. It creates Custom Operator Metrics and updates them with values when a tuple is received. These metrics can be viewed with Streams Studio and the streamtool capturestate command.

Each operator metric has kind Gauge.

Checkpointed data

When the MetricsSink operator is checkpointed, the current values of the Custom Operator Metrics are saved in checkpoint. Logic state variables (if present) are also included in checkpoint.

Behavior in a consistent region

The MetricsSink operator can be an operator within the reachability graph of a consistent region. It cannot be the start of a consistent region. When in a consistent region, the MetricsSink operator checkpoints and resets the current values of the Custom Operator Metrics. Logic state variables (if present) are also automatically checkpointed and resetted.

Checkpointing behavior in an autonomous region

When the MetricsSink operator is in an autonomous region and configured with config checkpoint : periodic(T) clause, a background thread in SPL Runtime checkpoints the operator every T seconds, and such periodic checkpointing activity is asynchronous to tuple processing. Upon restart, the operator restores its state from the last checkpoint.

When the MetricsSink operator is in an autonomous region and configured with config checkpoint : operatorDriven clause, no checkpoint is taken at runtime. Upon restart, the operator restores to its initial state.

Such checkpointing behavior is subject to change in the future.

Examples

This example uses the MetricsSink operator.

composite Main {                                                                
  graph                                                                         
    stream <int64 a, int64 b> A = Beacon() {}                                   
    () as Nil = MetricsSink(A)                                                  
    {                                                                           
      param                                                                     
        metrics       : a, b, a + b, a * b;                                     
        names         : "a", "b", "sum", "product";                             
        descriptions  : "A", "B", "sum of A and B", "product of A and B";       
        initialValues : 100l, 1000l, -900l, 5l;                                 
    }                                                                           
}

Summary

Ports
This operator has 1 input port and 0 output ports.
Windowing
This operator does not accept any windowing configurations.
Parameters
This operator supports 4 parameters.

Required: metrics

Optional: descriptions, initialValues, names

Metrics
This operator does not report any metrics.

Properties

Implementation
C++
Threading
Always - Operator always provides a single threaded execution context.

Input Ports

Ports (0)

The MetricsSink operator is configurable with a single input port, which ingests tuples that are used to set metrics.

Properties

Parameters

This operator supports 4 parameters.

Required: metrics

Optional: descriptions, initialValues, names

descriptions

Specifies a list of expressions that are used for the description of the Custom Operator Metrics. If this parameter is present, the number of expressions must match the number of expressions in the metrics parameter. If this parameter is omitted, the metric descriptions default to empty string {""}.

Properties

initialValues

Specifies a list of expressions that are used for the starting value for the Custom Operator Metrics. If this parameter is present, the number of expressions must match the number of expressions in the metrics parameter. If this parameter is omitted, the initial metric values default to 0.

Properties

metrics

Specifies a list of expressions that are used to set the values of Custom Operator Metrics. Each expression sets the value for one metric.

Properties

names

Specifies a list of expressions that are used for the name of the Custom Operator Metrics. If this parameter is present, the number of expressions must match the number of expressions in the metrics parameter. If this parameter is omitted, the metric names default to the SPL expression for each metric.

Properties