Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple spans and kafka collectors #979

Closed
codefromthecrypt opened this issue Feb 15, 2016 · 1 comment
Closed

multiple spans and kafka collectors #979

codefromthecrypt opened this issue Feb 15, 2016 · 1 comment

Comments

@codefromthecrypt
Copy link
Member

SpanStore.apply is invoked by collectors to store spans in bulk (even if not in the same trace). The kafka receiver only sends a single span to this method. That means if optimizations are made on span stores (such as #961 for cassandra), kafka users won't necessarily benefit.

Options to consider

The kafka transport encodes a span in a single KV message (key is null) at the moment. Let's see if there's a way to leverage the bulk storage api: SpanStore.apply.

Send multiple spans per message and adjust kafka decoding

Kafka messages are currently single-span, and a single-entry list is not the same thrift bytes as a single-entry. To support multiple-span messages, we need to either peek at the bytes or vary on message key (adjusting collectors accordingly)

separate out reading off kafka from writing to the span store

@yurishkuro mentions that reading from kafka into a local queue might help. For example, a span store reader could consume N spans off that queue. #961 (comment)

How other transports work

Scribe

The scribe transport encodes a span in a single log entry. However the scribe api allows you to log multiple entries, which means that the scribe receiver can handle a bunch of spans at the same time (same network request).

Http

The http transport encodes a list of spans in json or thrift format, these are passed directly to the span store.

TChannel

TChannel-based communication between clients and central collectors batch multiple spans into one request.

@codefromthecrypt codefromthecrypt changed the title Allow reading multiple spans per kafka message multiple spans in kafka collectors Feb 15, 2016
@codefromthecrypt codefromthecrypt changed the title multiple spans in kafka collectors multiple spans and kafka collectors Feb 15, 2016
@codefromthecrypt
Copy link
Member Author

from @prat0318

i would go with Send multiple spans per message option just because of simplicity and not adding another point of failure (local queue)

codefromthecrypt pushed a commit that referenced this issue Feb 23, 2016
Kafka messages have binary payloads and no key. The binary contents are
serialized TBinaryProtocol thrift messages. This change peeks at thei
first bytes to see if it is a List of structs or not, reading
accordingly.

This approach would need a revision if we ever add a Struct field to
Span. However, that is unlikely. At the point we change the structure of
Span, we'd likely change other aspects which would make it a different
struct completely (see #939). In such case, we'd add a key to the kafka
message of the span version, and not hit the code affected in this
change.

Fixes #979
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant