from __future__ import absolute_import

from sentry.api.serializers import Serializer, register
from sentry.models import GroupTagValue


@register(GroupTagValue)
class GroupTagValueSerializer(Serializer):
    def serialize(self, obj, attrs, user):
        d = {
            'key': obj.key,
            'value': obj.value,
            'count': obj.times_seen,
            'lastSeen': obj.last_seen,
            'firstSeen': obj.first_seen,
        }
        return d

@@ -128,16 +128,26 @@
 TagValue
+, TagValue
 %0A%0A%0A@regi
@@ -205,24 +205,558 @@
 erializer):%0A
+    def get_attrs(self, item_list, user):%0A        assert len(set(i.key for i in item_list)) %3C 2%0A%0A        tagvalues = dict(%0A            (t.value, t)%0A            for t in TagValue.objects.filter(%0A                project=item_list%5B0%5D.project,%0A                key=item_list%5B0%5D.key,%0A                value__in=%5Bi.value for i in item_list%5D%0A            )%0A        )%0A%0A        result = %7B%7D%0A        for item in item_list:%0A            result%5Bitem%5D = %7B%0A                'name': tagvalues%5Bitem.value%5D.get_label(),%0A            %7D%0A        return result%0A%0A
     def seri
@@ -796,24 +796,59 @@
       d = %7B%0A
+            'name': attrs%5B'name'%5D,%0A
             

Implement labels on group tag values