question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

py_zipkin span is not accepted by the openzipkin collector.

See original GitHub issue
  1. Run docker run -d --net host openzipkin/zipkin

  2. Install py-zipkin pip install py-zipkin==0.8.3

  3. Run the following python script:

#!/usr/bin/env python

import requests

from py_zipkin.zipkin import zipkin_span

def http_transport(encoded_span):
    # The collector expects a thrift-encoded list of spans.
    requests.post(
        'http://localhost:9411/api/v1/spans',
        data=encoded_span,
        headers={'Content-Type': 'application/x-thrift'},
    )

if __name__ == '__main__':
    with zipkin_span(
        service_name='test_service',
        transport_handler=http_transport,
        sample_rate=100.0,
    ):
        print "Work"

I see the following log line in the collector and get a 400 responce

2017-08-07 00:43:04.851  WARN 7 --- [nio-9411-exec-7] zipkin.server.ZipkinHttpCollector        : [Malformed reading List<Span> from TBinary]([url](url))

java.lang.IllegalArgumentException: Malformed reading List<Span> from TBinary
	at zipkin.internal.ThriftCodec.exceptionReading(ThriftCodec.java:600) ~[zipkin-1.29.1.jar!/:na]
	at zipkin.internal.ThriftCodec.readList(ThriftCodec.java:564) ~[zipkin-1.29.1.jar!/:na]
	at zipkin.internal.ThriftCodec.readSpans(ThriftCodec.java:88) ~[zipkin-1.29.1.jar!/:na]
	at zipkin.collector.Collector.acceptSpans(Collector.java:93) ~[zipkin-1.29.1.jar!/:na]
	at zipkin.server.ZipkinHttpCollector.validateAndStoreSpans(ZipkinHttpCollector.java:88) [classes/:na]
	at zipkin.server.ZipkinHttpCollector.uploadSpansThrift(ZipkinHttpCollector.java:73) [classes/:na]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cybergrindcommented, Aug 29, 2017

I believe the core difference is the https://github.com/Yelp/py_zipkin/blob/master/py_zipkin/thrift/__init__.py#L181

My issue was caused by using old http transport code, that basically was:

def http_transport(encoded_span):
    # copypasted from: https://github.com/Yelp/py_zipkin#transport
    # The collector expects a thrift-encoded list of spans. Instead of
    # decoding and re-encoding the already thrift-encoded message, we can just
    # add header bytes that specify that what follows is a list of length 1.
    body = b'\x0c\x00\x00\x00\x01' + encoded_span
    requests.post(
        'http://{}/api/v1/spans'.format(ZIPKIN),
        data=body,
        headers={'Content-Type': 'application/x-thrift'},
    )

As I understand: b’\x0c\x00\x00\x00\x01’ - stands for list with length 1 and 0.9.0 already encodes everything as a list so it doesn’t required anymore.

0reactions
bplotnickcommented, Aug 29, 2017

@cybergrind Thanks for posting this. We should’ve been clearer about that backwards incompatibility. Glad you got it resolved.

I’m going to go ahead and close this. Others can open a new issue or reach out on the zipkin gitter if they run into similar problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

openzipkin/zipkin - Gitter
Change sampler to never sample and see if zipkin is still creating a span. If not, it means zipkin isn't receiving the trace...
Read more >
Server extensions and choices · OpenZipkin
Zipkin server bundles extension for span collection and storage. By default spans can be collected over http, Kafka or RabbitMQ transports and stored ......
Read more >
OpenTelemetry to Zipkin Transformation
Zipkin service name MUST be set to the value of the resource attribute: service.name . If no service.name is contained in a Span's...
Read more >
Using Spring Cloud Sleuth
The project comes with OpenZipkin Brave implementation. ... span is recorded) and, if the span is sampled, it is eligible for collection (e.g....
Read more >
Zipkin Tutorial: Get Started Easily With Distributed Tracing
Zipkin is an open source distributed tracing system based on Dapper's ... as a single span asynchronously to the collector (keep reading to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found