def _get_settings_from_request(request):
settings = request.registry.settings<EOL>if '<STR_LIT>' in settings:<EOL><INDENT>zipkin_attrs = settings['<STR_LIT>'](request)<EOL><DEDENT>else:<EOL><INDENT>zipkin_attrs = create_zipkin_attr(request)<EOL><DEDENT>if '<STR_LIT>' in settings:<EOL><INDENT>transport_handler = settings['<STR_LIT>']<EOL>if not isinstance(transport_handler, BaseTransportHandler):<EOL><INDENT>warnings.warn(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>DeprecationWarning,<EOL>)<EOL>stream_name = settings.get('<STR_LIT>', '<STR_LIT>')<EOL>transport_handler = functools.partial(transport_handler, stream_name)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ZipkinError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>context_stack = _getattr_path(request, settings.get('<STR_LIT>'))<EOL>service_name = settings.get('<STR_LIT>', '<STR_LIT>')<EOL>span_name = '<STR_LIT>'.format(request.method, request.path)<EOL>add_logging_annotation = settings.get(<EOL>'<STR_LIT>',<EOL>False,<EOL>)<EOL>if '<STR_LIT>' in settings:<EOL><INDENT>report_root_timestamp = settings['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>report_root_timestamp = '<STR_LIT>' not in request.headers<EOL><DEDENT>zipkin_host = settings.get('<STR_LIT>')<EOL>zipkin_port = settings.get('<STR_LIT>', request.server_port)<EOL>firehose_handler = settings.get('<STR_LIT>')<EOL>post_handler_hook = settings.get('<STR_LIT>')<EOL>max_span_batch_size = settings.get('<STR_LIT>')<EOL>use_pattern_as_span_name = bool(<EOL>settings.get('<STR_LIT>', False),<EOL>)<EOL>encoding = settings.get('<STR_LIT>', Encoding.V1_THRIFT)<EOL>return _ZipkinSettings(<EOL>zipkin_attrs,<EOL>transport_handler,<EOL>service_name,<EOL>span_name,<EOL>add_logging_annotation,<EOL>report_root_timestamp,<EOL>zipkin_host,<EOL>zipkin_port,<EOL>context_stack,<EOL>firehose_handler,<EOL>post_handler_hook,<EOL>max_span_batch_size,<EOL>use_pattern_as_span_name,<EOL>encoding=encoding,<EOL>)<EOL>
Extracts Zipkin attributes and configuration from request attributes.
    See the `zipkin_span` context in py-zipkin for more detaied information on
    all the settings.

    Here are the supported Pyramid registry settings:

    zipkin.create_zipkin_attr: allows the service to override the creation of
        Zipkin attributes. For example, if you want to deterministically
        calculate trace ID from some service-specific attributes.
    zipkin.transport_handler: how py-zipkin will log the spans it generates.
    zipkin.stream_name: an additional parameter to be used as the first arg
        to the transport_handler function. A good example is a Kafka topic.
    zipkin.add_logging_annotation: if true, the outermost span in this service
        will have an annotation set when py-zipkin begins its logging.
    zipkin.report_root_timestamp: if true, the outermost span in this service
        will set its timestamp and duration attributes. Use this only if this
        service is not going to have a corresponding client span. See
        https://github.com/Yelp/pyramid_zipkin/issues/68
    zipkin.firehose_handler: [EXPERIMENTAL] this enables "firehose tracing",
        which will log 100% of the spans to this handler, regardless of
        sampling decision. This is experimental and may change or be removed
        at any time without warning.
    zipkin.use_pattern_as_span_name: if true, we'll use the pyramid route pattern
        as span name. If false (default) we'll keep using the raw url path.