func (m Aggregation) ConvertToAppOpticsEvents() (events []interface{}) {
	for key, value := range m {
		events = append(events, map[string]interface{}{
			"name":       "platform.sketches-internal.bytes-requests",
			"time":       key.Minute,
			"attributes": map[string]bool{"aggregate": true},
			"period":     60,
			"sum":        value.TotalBytes,
			"count":      value.Count,
			"tags": map[string]string{
				"alb-name": key.AlbName,
				"host":     key.Host,
			},
		})
		events = append(events, map[string]interface{}{
			"name":   "platform.sketches-internal.error-rate",
			"time":   key.Minute,
			"period": 60,
			"value":  value.GetErrorRate(),
			"tags": map[string]string{
				"alb-name": key.AlbName,
				"host":     key.Host,
			},
		})
		responseTimes := value.SortedResponseTimes()
		if len(responseTimes) > 100 {
			for _, percentile := range []int{50, 75, 90, 95, 99} {
				events = append(events, map[string]interface{}{
					"name":       "platform.sketches-internal.percentile",
					"time":       key.Minute,
					"attributes": map[string]bool{"aggregate": true},
					"period":     60,
					"value":      responseTimes.GetPercentile(percentile),
					"tags": map[string]string{
						"alb-name":   key.AlbName,
						"host":       key.Host,
						"percentile": strconv.Itoa(percentile),
					},
				})
			}
		}
	}
	return
}
// ConvertToAppOpticsEvents convert the aggregation to events
// FIXME: Test this
ConvertToAppOpticsEvents convert the aggregation to events
FIXME: Test this
// ConvertToAppOpticsEvents convert the aggregation to events // FIXME : Test this
func (m Aggregation) ConvertToAppOpticsEvents() (events []interface{}) {
	for key, value := range m {
		events = append(events, map[string]interface{}{
			"name":       "platform.sketches-internal.bytes-requests",
			"time":       key.Minute,
			"attributes": map[string]bool{"aggregate": true},
			"period":     60,
			"sum":        value.TotalBytes,
			"count":      value.Count,
			"tags": map[string]string{
				"alb-name": key.AlbName,
				"host":     key.Host,
			},
		})
		events = append(events, map[string]interface{}{
			"name":   "platform.sketches-internal.error-rate",
			"time":   key.Minute,
			"period": 60,
			"value":  value.GetErrorRate(),
			"tags": map[string]string{
				"alb-name": key.AlbName,
				"host":     key.Host,
			},
		})
		responseTimes := value.SortedResponseTimes()
		if len(responseTimes) > 100 {
			for _, percentile := range []int{50, 75, 90, 95, 99} {
				events = append(events, map[string]interface{}{
					"name":       "platform.sketches-internal.percentile",
					"time":       key.Minute,
					"attributes": map[string]bool{"aggregate": true},
					"period":     60,
					"value":      responseTimes.GetPercentile(percentile),
					"tags": map[string]string{
						"alb-name":   key.AlbName,
						"host":       key.Host,
						"percentile": strconv.Itoa(percentile),
					},
				})
			}
		}
	}
	return
}
func ( m Aggregation ) ConvertToAppOpticsEvents ( ) ( events [ ] interface { } ) { for key , value := range m { events = append ( events , map [ string ] interface { } { " " : " " , " " : key . Minute , " " : map [ string ] bool { " " : true } , " " : 60 , " " : value . TotalBytes , " " : value . Count , " " : map [ string ] string { " " : key . AlbName , " " : key . Host , } , } ) events = append ( events , map [ string ] interface { } { " " : " " , " " : key . Minute , " " : 60 , " " : value . GetErrorRate ( ) , " " : map [ string ] string { " " : key . AlbName , " " : key . Host , } , } ) responseTimes := value . SortedResponseTimes ( ) if len ( responseTimes ) > 100 { for _ , percentile := range [ ] int { 50 , 75 , 90 , 95 , 99 } { events = append ( events , map [ string ] interface { } { " " : " " , " " : key . Minute , " " : map [ string ] bool { " " : true } , " " : 60 , " " : responseTimes . GetPercentile ( percentile ) , " " : map [ string ] string { " " : key . AlbName , " " : key . Host , " " : strconv . Itoa ( percentile ) , } , } ) } } } return }
ConvertToAppOpticsEvents convert the aggregation to events
FIXME: Test this
ConvertToAppOpticsEvents convert the aggregation to events FIXME : Test this