def push()

in src/metrics.py [0:0]


    def push(self, name, unit, value, metrics_info):
        """
        Pushes metrics to CloudWatch Metrics.

        Args:
            name: the name of the metric
            unit: the metric unit
            value: the metric value
            metrics_info: additional dimensions for the metric
        """

        dimensions = [{"Name": "BuildContext", "Value": self.context}]

        for key in metrics_info:
            dimensions.append({"Name": key, "Value": metrics_info[key]})

        try:
            response = self.client.put_metric_data(
                MetricData=[
                    {
                        "MetricName": name,
                        "Dimensions": dimensions,
                        "Unit": unit,
                        "Value": value,
                    },
                ],
                Namespace=self.namespace,
            )
        except Exception as e:
            raise Exception(str(e))

        return response