// SetMetricIntervalUpperBound sets the MetricIntervalUpperBound field's value.
348043
func (s *StepAdjustment) SetMetricIntervalUpperBound(v float64) *StepAdjustment {
	s.MetricIntervalUpperBound = &v
	return s
}
816722
func (s *MetricAlarm) SetMetricName(v string) *MetricAlarm {
	s.MetricName = &v
	return s
}
1119599
func (s *SubscribedRuleGroupSummary) SetMetricName(v string) *SubscribedRuleGroupSummary {
	s.MetricName = &v
	return s
}
1342273
func SaveMetricsForInterval(p *redis.Pool, agg AggregationInterval, name string, metrics MetricsRecord) error {
	if len(metrics.Metrics) == 0 {
		return nil
	}

	c := p.Get()
	defer c.Close()
	var exp int64

	// handle aggregation
	ts := metrics.Time.In(timeLocation)
	switch agg {
	case AggregationMinute:
		// truncate timestamp to minute precision
		ts = time.Date(ts.Year(), ts.Month(), ts.Day(), ts.Hour(), ts.Minute(), 0, 0, timeLocation)
		exp = int64(metricsMinuteTTL) / int64(time.Millisecond)
	case AggregationHour:
		// truncate timestamp to hour precision
		ts = time.Date(ts.Year(), ts.Month(), ts.Day(), ts.Hour(), 0, 0, 0, timeLocation)
		exp = int64(metricsHourTTL) / int64(time.Millisecond)
	case AggregationDay:
		// truncate timestamp to day precision
		ts = time.Date(ts.Year(), ts.Month(), ts.Day(), 0, 0, 0, 0, timeLocation)
		exp = int64(metricsDayTTL) / int64(time.Millisecond)
	case AggregationMonth:
		// truncate timestamp to month precision
		ts = time.Date(ts.Year(), ts.Month(), 1, 0, 0, 0, 0, timeLocation)
		exp = int64(metricsMonthTTL) / int64(time.Millisecond)
	default:
		return fmt.Errorf("unexepcted aggregation interval: %s", agg)
	}

	key := fmt.Sprintf(metricsKeyTempl, name, agg, ts.Unix())

	c.Send("MULTI")
	for k, v := range metrics.Metrics {
		c.Send("HINCRBYFLOAT", key, k, v)
	}
	c.Send("PEXPIRE", key, exp)

	if _, err := c.Do("EXEC"); err != nil {
		return errors.Wrap(err, "exec error")
	}

	log.WithFields(log.Fields{
		"name":        name,
		"aggregation": agg,
	}).Debug("metrics saved")

	return nil
}
401596
func (s *CloudwatchMetricAction) SetMetricUnit(v string) *CloudwatchMetricAction {
	s.MetricUnit = &v
	return s
}
100119
func (s *CloudwatchMetricAction) SetMetricTimestamp(v string) *CloudwatchMetricAction {
	s.MetricTimestamp = &v
	return s
}
894739
func (s *CloudWatchAlarmDefinition) SetMetricName(v string) *CloudWatchAlarmDefinition {
	s.MetricName = &v
	return s
}
1124494
func (s *MetricStat) SetMetric(v *Metric) *MetricStat {
	s.Metric = v
	return s
}
77940
func (s *CreateRateBasedRuleInput) SetMetricName(v string) *CreateRateBasedRuleInput {
	s.MetricName = &v
	return s
}
958317
func (s *PublicEndpoint) SetMetrics(v map[string]*float64) *PublicEndpoint {
	s.Metrics = v
	return s
}
148090
func (s *HyperParameterTuningJobObjective) SetMetricName(v string) *HyperParameterTuningJobObjective {
	s.MetricName = &v
	return s
}
348360
func (s *PutMetricAlarmInput) SetMetricName(v string) *PutMetricAlarmInput {
	s.MetricName = &v
	return s
}
52394
func (s *ExecutePolicyInput) SetMetricValue(v float64) *ExecutePolicyInput {
	s.MetricValue = &v
	return s
}
208929
func (s *MonitoringConfigurationUpdate) SetMetricsLevelUpdate(v string) *MonitoringConfigurationUpdate {
	s.MetricsLevelUpdate = &v
	return s
}
667176
func (s *TargetTrackingScalingPolicyConfiguration) SetCustomizedMetricSpecification(v *CustomizedMetricSpecification) *TargetTrackingScalingPolicyConfiguration {
	s.CustomizedMetricSpecification = v
	return s
}
542930
func (s *GetInstanceMetricDataOutput) SetMetricData(v []*MetricDatapoint) *GetInstanceMetricDataOutput {
	s.MetricData = v
	return s
}
557943
func (s *GetCostAndUsageInput) SetMetrics(v []*string) *GetCostAndUsageInput {
	s.Metrics = v
	return s
}