Note: Here we are not supplying the type of transform with -e TRANSFORM=Raw
and, in the corresponding sli.robot, if we do not input TRANSFORM as an USER VARIABLE:
Querying Prometheus Instance And Pushing Aggregated Data
Log ${ENV_QUERY}
${rsp}= RW.Prometheus.Query Instant
... api_url=${ENV_PROMETHEUS_HOST}
... query=${ENV_QUERY}
... step=${STEP}
... target_service=${CURL_SERVICE}
${data}= Set Variable ${rsp["data"]}
${metric}= RW.Prometheus.Transform Data
... data=${data}
... *** method=${TRANSFORM} *** <------ commented out TRANSFORM
... no_result_overwrite=${NO_RESULT_OVERWRITE}
... no_result_value=${NO_RESULT_VALUE}
RW.Core.Push Metric ${metric}
then RW.Prometheus.Transform Data call defaults to transform: Last, as seen here:
RW.Core.Import User Variable TRANSFORM
... type=string
... enum=[Raw,Max,Average,Minimum,Sum,First,Last]
... description=What transform method to apply to the column data. First and Last are position relative, so Last is the most recent value. Use Raw to skip transform.
... default=Last
... example=Last
While this can be controlled by the developer of sli.robot, the current logic creates an edge case where all transforms that only shuld apply to result.values:[][], can also be mistakenly called for result.value:[], resulting in the following error:
Objective: Run
RW.Prometheus
based codebundle against a Prometheus endpoint with defaulttransform
Codebundle / Robot Script: Infracloudio/ifc-rw-codecollection/.../runbook.robotTest Procedure:
Note: Here we are not supplying the type of transform with
-e TRANSFORM=Raw
and, in the corresponding
sli.robot
, if we do not inputTRANSFORM
as an USER VARIABLE:then
RW.Prometheus.Transform Data
call defaults totransform: Last
, as seen here:While this can be controlled by the developer of sli.robot, the current logic creates an edge case where all transforms that only shuld apply to
result.values:[][]
, can also be mistakenly called forresult.value:[]
, resulting in the following error:This is because all transforms other than
Raw
can only apply to 2D matrices of[float][float]
, but here it gets applied to[float]
.This PR intends to fix this issue, by only allowing non-Raw transforms on
result.values[float][float]