Skip to content

Expose span context to filters#894

Merged
mattklein123 merged 10 commits intoenvoyproxy:masterfrom
amalgam8:expose_span_to_filters
May 6, 2017
Merged

Expose span context to filters#894
mattklein123 merged 10 commits intoenvoyproxy:masterfrom
amalgam8:expose_span_to_filters

Conversation

@rshriram
Copy link
Copy Markdown
Member

@rshriram rshriram commented May 4, 2017

fixes #890

cc @goaway (I hope this doesn't conflict with what you are working on).
cc @fabolive @kyessenov

@rshriram
Copy link
Copy Markdown
Member Author

rshriram commented May 4, 2017

@mattklein123 / @htuch . I am not sure if you want elaborate tests for this PR. If you do, any thoughts on where I could plug in a test for the function introduced in this PR, given that there are no consumers in the Envoy code base? [The filter we are using in Istio will be using this feature.]

@mattklein123
Copy link
Copy Markdown
Member

@rshriram we do need to talk about this. This is related to #888 and some other work that @goaway is doing. I'm in an all day meeting tomorrow and will be busy most of the day Friday also but perhaps you and @goaway can chat offline/VC (please find each other on Gitter).

@goaway I think this is a very reasonable change and a use case that I had not previously considered. It makes me somewhat rethink what you are working on. What if the span interface was changed so that you could create a child span from it (and the driver details were hidden)? If this were done, it would also work for what you are doing. Furthermore, if we passed the span inside the tracing context that is passed to gRPC AsyncClient calls, it could be fed into AsyncClient also fairly easily.

@rshriram I don't want to hold you up, and I think this change is reasonable, but I do want to consider the implications of this interface change in the face of other requirements that we are working on in parallel, so let's get a firm plan in place. @goaway should be able to drive.

@rshriram
Copy link
Copy Markdown
Member Author

rshriram commented May 4, 2017 via email

@mattklein123
Copy link
Copy Markdown
Member

@rshriram yes I understand your use case and it makes sense, and my feeling is to go with this PR (since this is actually an approach I had originally discussed with @goaway), but I still want to make sure we understand how it fits in with the bigger picture.


// Tracing::Span
void setTag(const std::string&, const std::string&) override { NOT_IMPLEMENTED; }
void finishSpan() override { NOT_IMPLEMENTED; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd suggest moving NullSpan over into the Tracing namespace, and making these no-ops, rather than PANICs.

That way, a NullTracer and/or NullDriver can return a NullSpan instead of a nullptr, and this becomes somewhat safer to use.

@goaway
Copy link
Copy Markdown
Contributor

goaway commented May 4, 2017

Overall I think this is a pretty clean approach, and likely something I can hook into to allow the generation of child Spans off of an existing span. This would obviate the need for me to plumb
Tracers through everywhere: instead a function can be exposed on the Span interface to spawn a child, and the necessary internals can be embedded.

@mattklein123
Copy link
Copy Markdown
Member

@goaway +1, I think we should review and merge this PR, and build from there. I will add a few review comments later.

@mattklein123
Copy link
Copy Markdown
Member

@rshriram this does need a test. I would probably just add to here: https://github.com/lyft/envoy/blob/master/test/common/http/conn_manager_impl_test.cc#L241

If you actually EXPECT_CALL on the mock filter callbacks, from within a callback, you could verify that the span you get is what you expect. See other examples towards the end of the file.

virtual AccessLog::RequestInfo& requestInfo() PURE;

/**
* @return span context used for tracing purposes. Individual filters may add or modify
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit formatting: Have the word "information" start at the same space as "context" Ex:
https://github.com/lyft/envoy/blob/master/include/envoy/http/conn_pool.h#L58

std::function<void()> reset_callback_;
Event::MockDispatcher dispatcher_;
testing::NiceMock<AccessLog::MockRequestInfo> request_info_;
std::shared_ptr<Tracing::MockSpan> active_span_;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: is this used in any of the tests?

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.

LGTM modulo @ccaraman nits

@rshriram
Copy link
Copy Markdown
Member Author

rshriram commented May 6, 2017

addressed the nits.

@mattklein123 mattklein123 merged commit 7c0d640 into envoyproxy:master May 6, 2017
@rshriram rshriram deleted the expose_span_to_filters branch August 14, 2017 18:11
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Patches need to be referenced using the workspace alias

Signed-off-by: Alan Chiu <achiu@lyft.com>

For an explanation of how to fill out the fields, please see the relevant section
in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/master/PULL_REQUESTS.md)

Description: bazel: fixup patches
Risk Level: low
Testing: ci
Docs Changes: n/a
Release Notes: n/a
[Optional Fixes #Issue]
[Optional Deprecated:]

Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Patches need to be referenced using the workspace alias

Signed-off-by: Alan Chiu <achiu@lyft.com>

For an explanation of how to fill out the fields, please see the relevant section
in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/master/PULL_REQUESTS.md)

Description: bazel: fixup patches
Risk Level: low
Testing: ci
Docs Changes: n/a
Release Notes: n/a
[Optional Fixes #Issue]
[Optional Deprecated:]

Signed-off-by: JP Simard <jp@jpsim.com>
nezdolik pushed a commit to nezdolik/envoy that referenced this pull request May 4, 2024
Like _free_base, _free_dbg is called by CRT internal functions or
operator delete in Debug mode.

This closes envoyproxy#719 and closes envoyproxy#894.

[alkondratenko@gmail.com: trivial formatting fixes]
[alkondratenko@gmail.com: build free_dbg even in release builds]
mathetake pushed a commit that referenced this pull request Mar 3, 2026
**Description**

This PR adds clearroutecache to dataplane flow. clearroutecache is an
important functionality that envoy ai gw relies on.

Signed-off-by: bitliu <bitliu@tencent.com>
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.

Tracing: Allow filters to add/overwrite span information

4 participants