Add decorator to route to provide additional information, including t…#1632
Add decorator to route to provide additional information, including t…#1632RomanDzhabarov merged 3 commits intoenvoyproxy:masterfrom
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Any update on this? PR looks LGTM otherwise.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
decorator seems to be pretty generic name, should it be tracing_decorator. And also we need doc update on this.
There was a problem hiding this comment.
Using the more general decorator term was @mattklein123 's idea: envoyproxy/data-plane-api#171 (comment)
Will sort out docs soon.
There was a problem hiding this comment.
Its required for the apply(Tracing::Span&) on Decorator.
There was a problem hiding this comment.
what is the span name we are going to report for the ingress?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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.
|
@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. |
This brings in a bunch of ADS changes, route decorators and the response nonce. This will also unblock envoyproxy#1632.
This brings in a bunch of ADS changes, route decorators and the response nonce. This will also unblock #1632.
This brings in a bunch of ADS changes, route decorators and the response nonce. This will also unblock envoyproxy#1632.
|
@htuch @mattklein123 rebased off envoy master to make use of the latest data-plane-api. |
There was a problem hiding this comment.
You should be able to store the decorator in a unique_ptr.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
nit: will be used as a span name?
|
@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? |
|
@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>
|
@mattklein123 No problem, we're doing the same change in Jaeger. |
mattklein123
left a comment
There was a problem hiding this comment.
LGTM just needs some test coverage.
| DecoratorConstPtr RouteEntryImplBase::parseDecorator(const envoy::api::v2::Route& route) { | ||
| DecoratorConstPtr ret; | ||
| if (route.has_decorator()) { | ||
| ret = std::unique_ptr<Decorator>(new DecoratorImpl(route.decorator())); |
There was a problem hiding this comment.
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_); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Does this need coverage in lightstep tracer?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
|
@RomanDzhabarov any final comments? |
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>
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>
**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>
…he operation for use with the tracing span.
Related to new Decorator message in envoyproxy/data-plane-api#171