How to overwrite a metric used in multiple places in UI

Scenario: You want to do a small change to a metric that already exists in a package you have as a dependency in package.json, but you don’t want to create a new metric as you have different UI components that depends on that metric.

Package A depends from Package B
Package A (package.json)
“name”: “packageA”,
“description”: “package A”,
“dependencies”: [“packageB”]
metricName: WidelyUsedMetric.json on package B

Solution: You can overwrite the metric logic that is on the json file by creating a new metric in your current package with same name.
Then you can provision and validate on the environment if it is reflecting latest changes by SimpleMetric.fetch()

metricName: WidelyUsedMetric.json on package A with changes.