func()

in appinsights/contracts/metricdata.go [39:61]


func (data *MetricData) Sanitize() []string {
	var warnings []string

	for _, ptr := range data.Metrics {
		warnings = append(warnings, ptr.Sanitize()...)
	}

	if data.Properties != nil {
		for k, v := range data.Properties {
			if len(v) > 8192 {
				data.Properties[k] = v[:8192]
				warnings = append(warnings, "MetricData.Properties has value with length exceeding max of 8192: "+k)
			}
			if len(k) > 150 {
				data.Properties[k[:150]] = data.Properties[k]
				delete(data.Properties, k)
				warnings = append(warnings, "MetricData.Properties has key with length exceeding max of 150: "+k)
			}
		}
	}

	return warnings
}