Being lazy while trying to clean a package from unused metrics


I am trying to get rid of unused metrics (not called elsewhere in the package)
I have two issues:

Ask directly for a list of metrics defined by the developer.
I tried
But there is no flag to differentiate C3 metrics from app metrics. So it didn’t help. Any alternative ?

Second issue, based on the results got earlier; I can filter on my C3 app types this way: (sm){
if([‘BillingAccount’].indexOf(sm.split(’’)[1]) != -1 )
return {‘metric’:sm.split(’
’)[1], ‘type’:sm.split(’_’)[0]}
}).filter(function(e){return e});

Then I can’t differentiate between base metric types and defined ones.
then the next step, is to find calls in respective C3 types using some JS language reflection tools
If nothing helps, I would put my hands on files, and iterateover dozens.

Thank’s in advance.


I don’t know a way to directly achieve what you want.
I would suggest two options:

  • Make sure you call your metrics defined in the package with a specific prefix / suffix so that you can easily filter them.
  • Use the API MyType.listMetricsByKind() which will return all the simple + compound metrics that can be run on a specific type.


Thank you Romain, I will see how to deal with this , then share any advance.