Get the dependency tree for a given CompoundMetric

#1

I have a set of metrics with many compounds one that depend on each other and on other simple metrics.
Is there a way (other than manual with: copy/paste/grep) to find for a given CompoundMetric all the metrics it depends on (i.e. the dependency tree)?

0 Likes

#2

Checkout the CompoundMetric Type with c3ShowType(), do the getDescendants(), listSimpleMetrics(), or dependentMetrics() functions work for you?

1 Like

#3

Cool, this works for me:

CompoundMetric.listSimpleMetrics('RootMetric', TargetType)
0 Likes

#4

To follow-up on this you can also set the flag explain to be true in EvalMetricsSpec as follows:

var t = AircraftEngine.evalMetrics({ids: [“A0001_23000_1”], expressions: [“LogOfSumOfFlightSinceLastAircraftStatusIsInDepot”, “LogOfSumOfFlightHoursSinceLastAircraftStatusIsInDepot”], start: “2009-01-01”, end: “2018-01-01”, interval: “DAY”, explain: true, options: {evalPlanInclude: “expr, rewrittenExpr, srcTypeFetchSpec, hierarchies, simpleMetrics, evalInstrumentation, tsEvalInstrumentation”}})

c3Grid(t)

It will give you tons of information on each metric part of the expressions.

Does anyone know the list of possible fields that we can put in the evalPlanInclude?

0 Likes

#5

evalPlanInclude does not even show up when looking to EvalMetricsSpec documentation!

0 Likes

#6

Yes it does… EvalMetricsSpec.options is defined as type ExprCompileOptions, which has:

evalPlanInclude: string
Include spec for eval plan. It is a set of comma separated values for fields in EvalPlan. DEFAULT : time and iotime are included by default. For all others, use the following e.g “expr, rewrittenExpr, srcTypeFetchSpec, hierarchies, simpleMetrics, evalInstrumentation, tsEvalInstrumentation”

1 Like

#7

If you want to get a hierarchical view of the metrics, as suggested above, use:

CompoundMetric.getDescendants

1 Like