def merge()

in lib/metric-config-parser/metric_config_parser/monitoring.py [0:0]


    def merge(self, other: Optional["DefinitionSpecSub"]):
        """Merge another monitoring spec into the current one."""
        from metric_config_parser.definition import DefinitionSpec

        if other:
            if isinstance(other, MonitoringSpec):
                self.project.merge(other.project)
            if isinstance(other, MonitoringSpec) or isinstance(other, DefinitionSpec):
                self.dimensions.merge(other.dimensions)
            if isinstance(other, MonitoringSpec) or isinstance(other, DefinitionSpec):
                self.alerts.merge(other.alerts)
            self.data_sources.merge(other.data_sources)
            self.metrics.merge(other.metrics)