apache / incubator-kie-kogito-runtimes

Kogito Runtimes - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
Apache License 2.0
491 stars 192 forks source link

[Fix #3486] Add input param counter #3489

Closed fjtirado closed 2 months ago

fjtirado commented 2 months ago

Fix https://github.com/apache/incubator-kie-kogito-runtimes/issues/3486 Name of the new counters issonataflow_input_parameters_counter Array input parameters will be stored by default as json strings This can be changed by setting kie.monitoring.sonataflow.arrays.store property value to MULTI_PARAM, in which case arrays will be stored individually with keys of the forms arrray_key_name[array_item_number]

Lets illustrate that with an example If input is

{
    "numbers": [
        {
            "x": 12321,
            "y": 3
        },
        {
            "x": 18,
            "y": 3232323
        }
    ]
}

by default it will be stored as "param_name":"numbers","param_value":"[{\"x\":12321,\"y\":3},{\"x\":18,\"y\":3232323}]"

But if application.properties contains kie.monitoring.sonataflow.arrays.store=MULTI_PARAM

There will be four entries added to the metrics

"param_name":"numbers[0].x","param_value":"12321"
"param_name":"numbers[0].y","param_value":"3"
"param_name":"numbers[1].x","param_value":"18"
"param_name":"numbers[1].y","param_value":"3232323"

Finally, If array mode value is STRING, then the whole array is stored as one big string, as by default, but the format is slightly different (remove quotes, so strings values cannot be differentiated from numbers but making easier the elastic search queries over them) "param_value":"[{x=12321, y=3}, {x=18, y=3232323}]"