Skip to content

router: add more upstream request metadata to tracing spans#8289

Merged
mattklein123 merged 16 commits intoenvoyproxy:masterfrom
nareddyt:router-spans-tags
Sep 27, 2019
Merged

router: add more upstream request metadata to tracing spans#8289
mattklein123 merged 16 commits intoenvoyproxy:masterfrom
nareddyt:router-spans-tags

Conversation

@nareddyt
Copy link
Copy Markdown
Contributor

@nareddyt nareddyt commented Sep 18, 2019

Description: Adds more metadata to spans created by the router for upstream requests. Additional metadata added includes response codes, reset reasons, retries, etc.

Risk Level: Low

Testing: Modified existing tests to check for this span metadata. Added new tests for all branches.

Docs Changes: None

Release Notes: None. Please let me know if this change should have release notes.

@nareddyt
Copy link
Copy Markdown
Contributor Author

Hi @lizan, I'm having trouble with check_format.py. I ran the following command and was able to push (all the commit hooks passed, including format check) but CircleCI is complaining.

./tools/check_format.py fix && ./tools/format_python_tools.sh fix

@nareddyt
Copy link
Copy Markdown
Contributor Author

I don't understand this build error either. CLion did not complain. I tried looking at my files but I don't see anything obvious:

d.lld: error: undefined symbol: Envoy::Grpc::Common::responseToGrpcStatus(Envoy::StreamInfo::StreamInfo const&, Envoy::Http::HeaderMap const&, Envoy::Http::HeaderMap const&)
>>> referenced by router.cc
>>>               bazel-out/k8-fastbuild/bin/source/common/router/_objs/router_lib/router.pic.o:(Envoy::Router::Filter::UpstreamRequest::~UpstreamRequest())

ld.lld: error: undefined symbol: Envoy::Grpc::Common::responseToGrpcStatus(Envoy::StreamInfo::StreamInfo const&, Envoy::Http::HeaderMap const&, Envoy::Http::HeaderMap const&)
>>> referenced by access_log_impl.cc
>>>               bazel-out/k8-fastbuild/bin/source/common/access_log/_objs/access_log_lib/access_log_impl.pic.o:(Envoy::AccessLog::GrpcStatusFilter::evaluate(Envoy::StreamInfo::StreamInfo const&, Envoy::Http::HeaderMap const&, Envoy::Http::HeaderMap const&, Envoy::Http::HeaderMap const&))
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@mattklein123 mattklein123 self-assigned this Sep 19, 2019
@nareddyt
Copy link
Copy Markdown
Contributor Author

Was able to fix format issues by running the formatter via the docker image and then pushing with --no-verify.

./ci/run_envoy_docker.sh './ci/do_ci.sh fix_format'

@nareddyt
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #8289 (comment) was created by @nareddyt.

see: more, trace.

@nareddyt
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🐴 hold your horses - no failures detected, yet.

🐱

Caused by: a #8289 (comment) was created by @nareddyt.

see: more, trace.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Generally LGTM with some small comments.

I'm a bit concerned in general about the overall perf of tracing and whether these extra tags should be added in all cases or potentially opt-in. @lizan @jmarantz any thoughts?

Also, you will need full coverage of all of the extra tags you added. Thank you!

/wait

@nareddyt
Copy link
Copy Markdown
Contributor Author

I actually found a static function that adds all these tags and takes care of nullptr values for the response headers and trailers. I think I should refactor my changes to just use this function...

https://github.com/envoyproxy/envoy/blob/master/source/common/tracing/http_tracer_impl.cc#L141

@objectiser
Copy link
Copy Markdown
Contributor

objectiser commented Sep 20, 2019

@nareddyt +1 sounds like a good idea - sorry I had forgotten about the tracing_config.verbose(), which serves the purpose of conditionally adding more detailed information.

@nareddyt
Copy link
Copy Markdown
Contributor Author

nareddyt commented Sep 20, 2019

Can you take a look at the logic now? Specifically for source/common/tracing/http_tracer_impl.cc. I did not understand why finalizeSpan was structured the way it was with all the if (request_headers), so I just made another method and extracted the common tags out.

I still need to add tests. Will add if this structure looks good.

@nareddyt
Copy link
Copy Markdown
Contributor Author

Working on adding tests, will let you know when ready :)

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks, this looks really good. Nice consolidation and cleanup. One test request.

/wait

Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
@nareddyt
Copy link
Copy Markdown
Contributor Author

Ready for review! Sorry about the force push, I was trying to rebase with master

@nareddyt
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #8289 (comment) was created by @nareddyt.

see: more, trace.

Signed-off-by: Teju Nareddy <nareddyt@google.com>
Signed-off-by: Teju Nareddy <nareddyt@google.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

Copy link
Copy Markdown
Contributor

@objectiser objectiser left a comment

Choose a reason for hiding this comment

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

Thanks!

@mattklein123 mattklein123 merged commit 4606bc1 into envoyproxy:master Sep 27, 2019
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
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.

5 participants