@@ -603,7 +603,7 @@ def _to_http(self, method, payload=()):
603
603
for event in event_data :
604
604
event_info , event_attrs = event
605
605
event_attrs .update ({"event.domain" : "newrelic.ml_events" , "event.name" : event_info ["type" ]})
606
- ml_attrs = [self . _create_key_value (key , value ) for key , value in event_attrs .items ()]
606
+ ml_attrs = [create_key_value (key , value ) for key , value in event_attrs .items ()]
607
607
ml_attrs = [key_value for key_value in ml_attrs if key_value ]
608
608
ml_events .append (
609
609
{
@@ -615,18 +615,3 @@ def _to_http(self, method, payload=()):
615
615
payload = LogsData (resource_logs = [ResourceLogs (scope_logs = [ScopeLogs (log_records = ml_events )])])
616
616
return params , self ._headers , payload .SerializeToString ()
617
617
return params , self ._headers , json_encode (payload ).encode ("utf-8" )
618
-
619
- def _create_key_value (self , key , value ):
620
- if isinstance (value , bool ):
621
- return KeyValue (key = key , value = AnyValue (bool_value = value ))
622
- elif isinstance (value , int ):
623
- return KeyValue (key = key , value = AnyValue (int_value = value ))
624
- elif isinstance (value , float ):
625
- return KeyValue (key = key , value = AnyValue (double_value = value ))
626
- elif isinstance (value , str ):
627
- return KeyValue (key = key , value = AnyValue (string_value = value ))
628
- # Techincally AnyValue accepts array, kvlist, and bytes however, since
629
- # those are not valid custom attribute types according to our api spec,
630
- # we will not bother to support them here either.
631
- else :
632
- _logger .warn ("Unsupported ML event attribute value type %s: %s." % (key , value ))
0 commit comments