Skip to content

Commit 7a384c5

Browse files
committed
Cleaning out agent protocol
1 parent c87d31d commit 7a384c5

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

newrelic/core/agent_protocol.py

+1-16
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def _to_http(self, method, payload=()):
603603
for event in event_data:
604604
event_info, event_attrs = event
605605
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()]
607607
ml_attrs = [key_value for key_value in ml_attrs if key_value]
608608
ml_events.append(
609609
{
@@ -615,18 +615,3 @@ def _to_http(self, method, payload=()):
615615
payload = LogsData(resource_logs=[ResourceLogs(scope_logs=[ScopeLogs(log_records=ml_events)])])
616616
return params, self._headers, payload.SerializeToString()
617617
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

Comments
 (0)