velodrome/transform/plugins/state.go
func (s *StatePlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point {
	label := ""
	if event.Label != nil {
		label = *event.Label
	}

	if !s.states.ReceiveEvent(event.IssueID, event.Event, label, event.EventCreatedAt) {
		return nil
	}

	total, sum := s.states.Total(event.EventCreatedAt)
	values := map[string]interface{}{
		"count": total,
		"sum":   int(sum),
	}
	for _, percentile := range s.percentiles {
		values[fmt.Sprintf("%d%%", percentile)] = int(s.states.Percentile(event.EventCreatedAt, percentile))
	}

	return []Point{
		{
			Values: values,
			Date:   event.EventCreatedAt,
		},
	}
}
func (s *StatePlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point {
	label := ""
	if event.Label != nil {
		label = *event.Label
	}

	if !s.states.ReceiveEvent(event.IssueID, event.Event, label, event.EventCreatedAt) {
		return nil
	}

	total, sum := s.states.Total(event.EventCreatedAt)
	values := map[string]interface{}{
		"count": total,
		"sum":   int(sum),
	}
	for _, percentile := range s.percentiles {
		values[fmt.Sprintf("%d%%", percentile)] = int(s.states.Percentile(event.EventCreatedAt, percentile))
	}

	return []Point{
		{
			Values: values,
			Date:   event.EventCreatedAt,
		},
	}
}
// ReceiveIssueEvent computes age percentiles and saves them to InfluxDB