Skip to content

Tracing: revamp extract/inject span context#444

Merged
RomanDzhabarov merged 13 commits intomasterfrom
extract_inject
Feb 13, 2017
Merged

Tracing: revamp extract/inject span context#444
RomanDzhabarov merged 13 commits intomasterfrom
extract_inject

Conversation

@RomanDzhabarov
Copy link
Member

@RomanDzhabarov RomanDzhabarov commented Feb 8, 2017

Mostly this change is the same as 21dbbaf

It's different in:

  1. Encode and Decode x-ot-span-context properly with Base64
  2. Moved logic of span tags population based on request/response parameters right before span finalization (to avoid filing data on HC requests, for example)
  3. Allow at most 128 chars in :path when save to tags


if (request_headers.OtSpanContext()) {
// Extract downstream context from HTTP carrier.
std::string parent_context = Base64::decode(request_headers.OtSpanContext()->value().c_str());
Copy link
Member

Choose a reason for hiding this comment

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

What happens if the header is invalid or ParseFromString below fails? Do we handle that?

Copy link
Member Author

@RomanDzhabarov RomanDzhabarov Feb 9, 2017

Choose a reason for hiding this comment

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

if header is invalid CarrierStruct will not be populated properly and we'll get spans joined in a single trace by x-request-id, not a big deal

Copy link
Member

Choose a reason for hiding this comment

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

Can you add comment that this code is safe if Base64::decode returns empty string or the data is invalid.

Copy link
Member Author

Choose a reason for hiding this comment

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

ParseFromString in the worst case will leave CarrierStruct empty, that'll not crash or anything

Copy link
Member Author

Choose a reason for hiding this comment

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

i'll add comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

added comment.

lightstep::envoy::CarrierStruct ctx;
tracer.Inject(active_span->context(), lightstep::CarrierFormat::EnvoyProtoCarrier,
lightstep::envoy::ProtoWriter(&ctx));
Buffer::OwnedImpl buffer(ctx.SerializeAsString());
Copy link
Member

Choose a reason for hiding this comment

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

Instead of copying this just to call the function, can you have a version of Base64::encode that just takes memory and length directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

let me look here, should be doable but will schedule encode change on a separate PR first than.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

updated, will post update on this PR soon

@RomanDzhabarov RomanDzhabarov merged commit 7e360cb into master Feb 13, 2017
@RomanDzhabarov RomanDzhabarov deleted the extract_inject branch February 13, 2017 22:09
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
* remove private repo/branches

follow up on envoyproxy#404 missing (ah!) code review updates

* review comments/reverting unecessary changes
@douglas-reid
Copy link
Contributor

Curious: what drove the change from 256 -> 128? This is causing issues with some users now and I'd like to understand the reasoning behind the change.

jplevyak pushed a commit to jplevyak/envoy that referenced this pull request Apr 13, 2020
wolfguoliang pushed a commit to wolfguoliang/envoy that referenced this pull request Jan 23, 2021
…k_filter.rst (envoyproxy#444)

* Update health_check_filter.rst

* Update health_check_filter.rst

has some translate bug
jpsim pushed a commit that referenced this pull request Nov 28, 2022
This is required for us to update to Xcode 11

Signed-off-by: Keith Smiley <keithbsmiley@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
This is required for us to update to Xcode 11

Signed-off-by: Keith Smiley <keithbsmiley@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
mathetake pushed a commit that referenced this pull request Mar 3, 2026
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

Successfully merging this pull request may close these issues.

3 participants