def log_span( span_id, parent_span_id, trace_id, span_name, annotations, binary_annotations, registry_settings, ): """Creates a span and logs it. Uses the required registry setting of `zipkin.transport_handler` to log the span. """ span = create_span( span_id, parent_span_id, trace_id, span_name, annotations, binary_annotations, ) message = thrift_obj_in_bytes(span) scribe_stream = registry_settings.get('zipkin.stream_name', 'zipkin') if 'zipkin.transport_handler' in registry_settings: return registry_settings['zipkin.transport_handler'](scribe_stream, message) else: raise ZipkinError( "`zipkin.transport_handler` is a required config property, which" " is missing. It is a callback method which takes stream_name and" " a message as the params and logs message via scribe/kafka." )
def log_span(zipkin_attrs, span_name, registry_settings, annotations, binary_annotations, is_client): """Creates a span and logs it. If `zipkin.transport_handler` config is set, it is used to act as a callback and log message is sent as a parameter. """ span = create_span( zipkin_attrs, span_name, annotations, binary_annotations, is_client) message = thrift_obj_in_bytes(span) scribe_stream = registry_settings.get('zipkin.stream_name', 'zipkin') if 'zipkin.transport_handler' in registry_settings: return registry_settings['zipkin.transport_handler'](scribe_stream, message) else: raise ZipkinError( "`zipkin.transport_handler` is a required config property, which" " is missing. It is a callback method which takes stream_name and" " a message as the params and logs message via scribe/kafka.")