"Exception iterating requests" with Opencensus Python gRPC

540 Views Asked by At

I'm trying to send OpenCensus spans via gRPC to an OpenCensus collector with python as follows:

from opencensus.proto.agent.trace.v1.trace_service_pb2 import ExportTraceServiceRequest
from opencensus.proto.agent.trace.v1.trace_service_pb2_grpc import TraceServiceStub
import grpc


def export(spans, endpoint):
    channel = grpc.insecure_channel(endpoint)
    client = TraceServiceStub(channel=channel)
    rq = ExportTraceServiceRequest(spans = spans)
    responses = client.Export(rq)
    print(list(responses))

The spans argument contains a list of type opencensus.proto.trace.v1.trace_pb2.Span. I expected this to export all spans in the list to the opencensus collector listening at endpoint. However, I don't see any data arriving and the response object contains

<_MultiThreadedRendezvous of RPC that terminated with:
    status = StatusCode.UNKNOWN
    details = "Exception iterating requests!"
    debug_error_string = "None"
>
0

There are 0 best solutions below