Parametric metrics?

#1

Is there a way to create a parametric compound metric? Something like this:

{
    id: "HypotenuseLength",
    name: "HypotenuseLength",
    expression: "sqrt(pow(A, 2) + pow(B, 2))",
    params: [
        "A",
        "B"
    ]
}

which can be used in a regular compound metric expression:

{
    id: "DistanceToAirplane",
    name: "DistanceToAirplane",
    expression: "HypotenuseLength(AirplaneAltitude, GroundDistanceToAirplane)"
}

(ignoring the curvature of the earth in this contrived example :wink:)

0 Likes

#2

Not sure… I know you can write a MetricFunctionLibrary function in js or py called ‘hypotenuseLength’ which will have the same effect…

e.g.

type TriangleLibrary mixes MetricFunctionLibrary {
  hypotenuseLength: function(Timeseries a, Timeseries b): Timeseries js server
}

and then write the compound metric in the same way you did

0 Likes

Building a custom normalizer on top of default normalizer
#3

Riley is correct, that would be the easiest.

You can also provide the “variables” as you have defined and then provide the values at run time using bindings

0 Likes