Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Add b3 text map extractor #23

Merged
merged 3 commits into from
Jan 7, 2019
Merged

Conversation

achandras
Copy link
Contributor

There was no extractor for B3TextMapCodec when requests do not come in through Rack. The particular case I ran into was with AWS Lambdas in Ruby, which may be a pretty common use case.

Please let me know what you think

Copy link
Member

@indrekj indrekj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you also integrating with some languages beside ruby? I don't think I've seen B3TextMapCodec injector in other jaeger tracer gems, but that's maybe because other traces don't have to worry about HTTP_ prefix that rack adds.


class B3CodecCommon
def self.extract(carrier, keys)
trace_id = TraceId.base16_hex_id_to_uint64(carrier[keys[0]])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keys[0] etc are hard to understand. Rather create a map instead of an array and do something like keys::TRACE_ID

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the keys into a class with constants

@achandras
Copy link
Contributor Author

It works fine between languages, like from Go to Ruby, when the received request is usually through Rack. But something like AWS Lambdas do not necessarily have to get request headers through Rack, so I thought it might be useful to have a plain text map extractor.

@indrekj
Copy link
Member

indrekj commented Jan 5, 2019

One more request: please add specs for the new extractor. You can basically copy https://github.com/salemove/jaeger-client-ruby/blob/299ad0bc4ec355aa71d3031c8db7437e7b012991/spec/jaeger/extractors/b3_rack_codec_spec.rb and change keys and descriptions.

@indrekj indrekj merged commit 5d81b3a into salemove:master Jan 7, 2019
@achandras
Copy link
Contributor Author

Thanks!

@achandras achandras deleted the b3_text_map_extractor branch January 8, 2019 13:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants