Skip to content

Add decorator to route to provide additional information, including t…#1632

Merged
RomanDzhabarov merged 3 commits intoenvoyproxy:masterfrom
objectiser:tracing
Sep 18, 2017
Merged

Add decorator to route to provide additional information, including t…#1632
RomanDzhabarov merged 3 commits intoenvoyproxy:masterfrom
objectiser:tracing

Conversation

@objectiser
Copy link
Copy Markdown
Contributor

@objectiser objectiser commented Sep 13, 2017

…he operation for use with the tracing span.

Related to new Decorator message in envoyproxy/data-plane-api#171

htuch
htuch previously approved these changes Sep 13, 2017
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread include/envoy/router/router.h Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The convention in Envoy is DecoratorConstSharedPtr for shared const ptr type name. Maybe add a comment explaining these are created on the main thread at config ingest time and then shared with worked threads as spans come and go.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Curious why this changes..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In HttpTracerImpl::startSpan I removed the initialisation of the span name based on the operationName(), as it was not being used in the ZipkinTracer (it was overriding the span name to use the host). I need to check with someone from LightStep to see if it has an impact on their tracer - from initial inspection it seems like the span name is just passed through to the tracer, so I'm guessing Igress/Egress would just appear as the span names in their UI. However this is not that meaningful, as the span.kind can be used to indicate direction.

However this is something that needs to be checked before this PR is merged.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any update on this? PR looks LGTM otherwise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've been in contact with a couple of people at LightStep who said they would try to look at it, but not sure when.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cc @bhs @tedsuo @rnburn Any thoughts appreciated - would ideally like to get this PR merged, so just need to understand if a change in the operation name provided to the LightStep tracer would have any impact on your users?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Per other comment and per @RomanDzhabarov yes it effects the UI. I'm not sure why we need to change the default behavior. If no operation name is specified, do what we do today. If operation name is specified, override it. If tracer wants to override that, no problem.

Also nit: Times(1) is redundant.

Comment thread include/envoy/router/router.h Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove const

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

decorator seems to be pretty generic name, should it be tracing_decorator. And also we need doc update on this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Using the more general decorator term was @mattklein123 's idea: envoyproxy/data-plane-api#171 (comment)

Will sort out docs soon.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fair enough

Comment thread source/common/router/config_impl.cc Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

isEmpty

Comment thread include/envoy/router/router.h Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this included?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Its required for the apply(Tracing::Span&) on Decorator.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what is the span name we are going to report for the ingress?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For zipkin tracer, this was not set - so only change is that the Ingress value would not be provided to LightStep's tracer - so before this PR is merged this needs to be checked with them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bhs Could you provide some guidance here?

Prior to this PR, this code was building a span_name based on the 'OperationName` (misleading) which essentially just represents the direction of the request (Ingress or Egress), and if Egress, then it appends the host. However the Zipkin tracer code was ignoring this value, and instead using the host for Egress requests and empty span name for Ingress.

It appears that the span_name is just being passed through to the LightStep tracer and not doing any kind of interpretation of the value to determine span kind. So assume this value is just being included in the LightStep spans and displayed via your UI?

If so, do you have any objections to the changed values (i.e. blank on Ingress and host for Egress), or would you prefer different default values? With this PR, if the configuration includes a specified operation for the route, then this would be used instread.

Copy link
Copy Markdown
Member

@RomanDzhabarov RomanDzhabarov Sep 14, 2017

Choose a reason for hiding this comment

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

LS does not care about operation name, but if affects Saved Searches if there are any. And yes that's going to affect UI. Do we really need to change this behavior?
It seems like if there is a decorator on a route, span name will be overwritten and if not, that this default one is going to be used.

Copy link
Copy Markdown
Contributor Author

@objectiser objectiser Sep 14, 2017

Choose a reason for hiding this comment

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

That is the problem - the default behaviour is different between the two tracers. LS uses the default value passed in, but the Zipkin tracer overrides the supplied value and just uses the Host for Egress routes.

So not sure how to allow both tracers to maintain their current default behaviour, while at the same time enabling the Decorator to override the span name in both.

Seems better to have one default behaviour across both (all) tracers which is then overridden by the Decorator if defined.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Got it, if there are no common names for spans for LS and Zipkin spans, I'd push the logic of assigning specific span names to the specific tracer (ls and zipkin tracers).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO the LS current behavior makes more sense. Meaning, if no operation is set, base operation name off of egress/ingress + host, etc. If the tracer wants to override (as you do inside Zipkin) that seems fine? It doesn't make much sense to me to push this logic entirely into each tracer, but I suppose we could do that. Maybe I'm not fully following the issue here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mattklein123 @RomanDzhabarov You are correct - I was still thinking about the previous way I had implemented it, where the tracing config provided operation was passed in when the span was started - whereas now it is set after the span has been created within the Decorator - so all good, I can return the default behaviour to previous versions.

@htuch
Copy link
Copy Markdown
Member

htuch commented Sep 14, 2017

@objectiser I'm going to fix it so we consume your envoy-api change now to unblock this PR (and help with one I'm putting together), so should be done Real Soon.

htuch added a commit to htuch/envoy that referenced this pull request Sep 14, 2017
This brings in a bunch of ADS changes, route decorators and the response nonce.

This will also unblock envoyproxy#1632.
mattklein123 pushed a commit that referenced this pull request Sep 14, 2017
This brings in a bunch of ADS changes, route decorators and the response nonce.

This will also unblock #1632.
htuch added a commit to htuch/envoy that referenced this pull request Sep 14, 2017
This brings in a bunch of ADS changes, route decorators and the response nonce.

This will also unblock envoyproxy#1632.
@objectiser
Copy link
Copy Markdown
Contributor Author

@htuch @mattklein123 rebased off envoy master to make use of the latest data-plane-api.

Comment thread include/envoy/router/router.h Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should be able to store the decorator in a unique_ptr.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO the LS current behavior makes more sense. Meaning, if no operation is set, base operation name off of egress/ingress + host, etc. If the tracer wants to override (as you do inside Zipkin) that seems fine? It doesn't make much sense to me to push this logic entirely into each tracer, but I suppose we could do that. Maybe I'm not fully following the issue here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Per other comment and per @RomanDzhabarov yes it effects the UI. I'm not sure why we need to change the default behavior. If no operation name is specified, do what we do today. If operation name is specified, override it. If tracer wants to override that, no problem.

Also nit: Times(1) is redundant.

Copy link
Copy Markdown
Member

@RomanDzhabarov RomanDzhabarov left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: will be used as a span name?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fair enough

@objectiser
Copy link
Copy Markdown
Contributor Author

@htuch @mattklein123 As the CLA approach has been changed to use the git commit sign off approach, should I squash the commits and just sign the single commit?

@mattklein123
Copy link
Copy Markdown
Member

@objectiser yeah sorry for trouble just squash/rebase/push with DCO.

…he operation for use with the tracing span.

Signed-off-by: Gary Brown <gary@brownuk.com>
@objectiser
Copy link
Copy Markdown
Contributor Author

objectiser commented Sep 16, 2017

@mattklein123 No problem, we're doing the same change in Jaeger.

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 just needs some test coverage.

Comment thread source/common/router/config_impl.cc Outdated
DecoratorConstPtr RouteEntryImplBase::parseDecorator(const envoy::api::v2::Route& route) {
DecoratorConstPtr ret;
if (route.has_decorator()) {
ret = std::unique_ptr<Decorator>(new DecoratorImpl(route.decorator()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: DecoratorConstPtr(...

if (tracing_decision.is_tracing) {
active_span_ = connection_manager_.tracer_.startSpan(*this, *request_headers_, request_info_);
if (cached_route_.value() && cached_route_.value()->decorator()) {
cached_route_.value()->decorator()->apply(*active_span_);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you will need a conn_manager_impl_test to get test coverage for this line.

}

void LightStepSpan::setOperation(const std::string& operation) {
span_.SetOperationName(operation);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need coverage in lightstep tracer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure best way to test this - the current lightstep tests don't check the operation names passed in via the startSpan method, and there are no accessors for the operation name. Any suggestions welcome.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it's not easy to verify it's fine just skip it. I would at least make sure it's called just to have basic crash avoidance testing. (It might already be called not sure).

Signed-off-by: Gary Brown <gary@brownuk.com>
Signed-off-by: Gary Brown <gary@brownuk.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.

@mattklein123
Copy link
Copy Markdown
Member

@RomanDzhabarov any final comments?

Copy link
Copy Markdown
Member

@RomanDzhabarov RomanDzhabarov left a comment

Choose a reason for hiding this comment

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

great!

jpsim pushed a commit that referenced this pull request Nov 28, 2022
Description: Adds a wrapper script that calls Envoy's comp db generation script suitable for envoy-mobile for use with VS Code. This will create a compile_commands.json file in the root of the repo, allowing for the clangd plugin to pick this up and provide intelisense for native code.

Signed-off-by: Snow Pettersen <snowp@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Description: Adds a wrapper script that calls Envoy's comp db generation script suitable for envoy-mobile for use with VS Code. This will create a compile_commands.json file in the root of the repo, allowing for the clangd plugin to pick this up and provide intelisense for native code.

Signed-off-by: Snow Pettersen <snowp@lyft.com>
Signed-off-by: JP Simard <jp@jpsim.com>
mathetake pushed a commit that referenced this pull request Mar 3, 2026
**Description**

Removes unused files and unskips a couple tests in the AIGW CLI e2e that
were skipped.

**Related Issues/PRs (if applicable)**

N/A

**Special notes for reviewers (if applicable)**

N/A

---------

Signed-off-by: Ignasi Barrera <nacx@apache.org>
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.

4 participants