Skip to content

Commit 5349248

Browse files
committed
protobuf serializes floats into ints on old python, yay
1 parent 5081cd8 commit 5349248

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

riemann_client/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def emit(self, record):
2626

2727
import riemann_client.riemann_pb2
2828
import riemann_client.transport
29+
import google.protobuf.descriptor
2930

3031

3132
logger = logging.getLogger(__name__)
@@ -152,7 +153,7 @@ def create_dict(event):
152153
value = list(value)
153154
elif descriptor.name == 'attributes':
154155
value = dict(((a.key, a.value) for a in value))
155-
elif isinstance(value, float):
156+
elif descriptor.type == google.protobuf.descriptor.FieldDescriptor.TYPE_FLOAT:
156157
value = round(value, 1)
157158
data[descriptor.name] = value
158159

0 commit comments

Comments
 (0)