Get the dependency tree for a given CompoundMetric


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)?



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

1 Like


Cool, this works for me:

CompoundMetric.listSimpleMetrics('RootMetric', TargetType)


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”}})


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?



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



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


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


1 Like