refreshAnalytics returns metric not found error

I have the following types.

entity type MyType mixes BaseType{
  ...
}

type MyTypeAnalytic mixes Analytic<MyType, MyTypeDFE>

entity type DifferentType mixes BaseType{
  ...
}

type DifferentTypeAnalytic mixes Analytic<DifferentType, DifferentTypeDFE>

When I try to run

MyType.refreshAnalytics({
  analyticWhitelist: ["MyTypeAnalytic"],
  ...
}

I receive the following error:
C3RunTimeException: MetricEngine error: Metric with name "MetricForDifferentType" for type "MyType" not found! Check seed data!

When I remove DifferentTypeAnalytic from my package, I am able to run refreshAnalytics successfully. What is causing this error, and what is the way to resolve it?
Server version is 7.8.8.44

1 Like

your Analytic<MyType, MyTypeDFE> seems suspicious. Analytic expects DFE not Source type.
what is MyTypeDFE definition.

I now see that my type definitions were misleading - I will update them. Here are more fleshed out definitions of the types:

type MyTypeAnalytic mixes RiskAnalyticProcessor<MyTypeModel, MyTypeDFE>

type RiskAnalyticProcessor<M, I> mixes Analytic<I, Void> {
  ...
}

entity type MyTypeModel extends RiskModel type key 'XXX' {
  model: PythonMachineLearningClassifierInterpretable
}

@DFE(period='DAY', flattenWindows='true')
type MyTypeDFE mixes CompoundDataFlowEvent<MyType> {
  MyTypeMetric: MyTypeSimpleDFE1,
  ...
}

Seems to like a bug. can you repro locally/docker and create a ticket.

The issue is CompoundDfe MyTypeDFE is using a simple dfe on BaseType and that same simple dfe is used in CompoindDfe for DifferentTypeDFE. So when the dfe is generated, it calculating all impacted analytics and calling them on same source. Workaround to this is avoid shared simple dfe.

see PLAT-18285

1 Like