Skip to content

Zipkin end to end example#993

Merged
htuch merged 16 commits intoenvoyproxy:masterfrom
amalgam8:zipkin_example
May 23, 2017
Merged

Zipkin end to end example#993
htuch merged 16 commits intoenvoyproxy:masterfrom
amalgam8:zipkin_example

Conversation

@rshriram
Copy link
Copy Markdown
Member

This PR describes how to setup Zipkin tracing in Envoy with a simple end to end example (reuses the front proxy sandbox). PR #962 and the current one address #628

@rshriram
Copy link
Copy Markdown
Member Author

cc @adriancole @timperrett @fabolive

@mattklein123
Copy link
Copy Markdown
Member

💯 thanks @rshriram for doing this. @RomanDzhabarov @junr03 @ccaraman can you also take a look.

Comment thread docs/install/sandboxes.rst Outdated
needed to correlate the span with other related spans (e.g., the trace ID).

One of the most important benefits of tracing from Envoy is that it will take care of
propagating the traces to to the Zipkin service cluster. However, in order to fully take advantage
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: duplicate to

for header in TRACE_HEADERS_TO_PROPAGATE:
if header in request.headers:
headers[header] = request.headers[header]
ret = requests.get("http://localhost:9000/trace/2", headers=headers)
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.

do you want to use service_number from within the get instead of 2?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You mean service_number + 1 ? Because the entire code is specialized to service version == 1

ccaraman
ccaraman previously approved these changes May 18, 2017
Copy link
Copy Markdown
Contributor

@ccaraman ccaraman 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 a few nits

Comment thread docs/install/sandboxes.rst Outdated
fulfilled by them, information about http ingress, and a plethora of other useful
stats.

Zipkin Tracing
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: This page is absolutely huge. Can we potentially break this into multiple pages, one for each example? You didn't cause this problem but would be great to fix now.

@rshriram
Copy link
Copy Markdown
Member Author

rshriram commented May 18, 2017 via email

Comment thread docs/install/sandboxes.rst Outdated
--------------

The Zipkin tracing demonstrates Envoy's :ref:`request tracing <arch_overview_tracing>`
capabilities using `Zipkin <http://zipkin.io/>`_ as the trace provider. This sandbox
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: tracing provider.

Comment thread examples/front-proxy/service.py Outdated
'X-B3-ParentSpanId',
'X-B3-Sampled',
'X-B3-Flags',
'X-B3-Envoy'
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.

is X-B3-Envoy required?

Comment thread examples/front-proxy/service.py Outdated
app = Flask(__name__)

TRACE_HEADERS_TO_PROPAGATE = [
'X-Client-Trace-Id',
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.

that's not required to propagate, essentially it's only used on the first hop so that client traces can be merged with the backend traces

@codefromthecrypt
Copy link
Copy Markdown
Contributor

codefromthecrypt commented May 18, 2017 via email

Comment thread docs/install/sandboxes.rst Outdated
Zipkin Tracing
--------------

The Zipkin tracing demonstrates Envoy's :ref:`request tracing <arch_overview_tracing>`
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.

can you reference this as an example of zipkin tracing configuration from https://lyft.github.io/envoy/docs/operations/faq/overview.html ?

if int(os.environ['SERVICE_NAME']) == 1 :
for header in TRACE_HEADERS_TO_PROPAGATE:
if header in request.headers:
headers[header] = request.headers[header]
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.

Normally in zipkin apps, the client creates a new span that is a child of the current span and changes the headers appropriately before making requests to another service.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That is true in the normal case. The idea behind Envoy doing the tracing for you is that the application does not have to do any tracing nor does it have to spend resources propagating the traces to a collector server. It eliminates the complexity of adding additional libraries for the purpose of tracing and dealing with all the additional code.

Secondly, the idea is that Envoy's presence is transparent to the application. The amount of time spent in Envoy should be minuscule (if its sizeable, then there is something wrong with Envoy design :) ).

This is the Envoy model btw. I am just adding examples to go with the model. :).

@devinsba
Copy link
Copy Markdown
Contributor

devinsba commented May 19, 2017

From a zipkin devs point of view, the traces this example creates are not what I would expect to see.

I would expect to see server spans for the envoy parts of these requests, maybe I'm in the minority on this though. I would want to see how much of the request time could be attributed to envoy and how much of it is the apps themselves

EDIT: To clarify, in my opinoin hitting the example endpoint should produce 4 spans in the trace that ends up in zipkin, not the 2 it currently does

@RomanDzhabarov
Copy link
Copy Markdown
Member

RomanDzhabarov commented May 22, 2017

@rshriram there are some pending comments on this one
I'll do another pass once it's addressed and let's merge it.

@rshriram
Copy link
Copy Markdown
Member Author

@RomanDzhabarov @goaway the last two commits address your nits. I also split the sandbox file into smaller files as per @mattklein123 's suggestion.

@RomanDzhabarov
Copy link
Copy Markdown
Member

that's awesome, thanks @rshriram

@htuch ready for final pass

RomanDzhabarov
RomanDzhabarov previously approved these changes May 22, 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.

Thanks @rshriram, this reads well. One thing I did wonder about is whether the setup steps have been independently carried out by someone to ensure that there were no local environment dependencies that crept in. Otherwise, this looks good to ship after the last few nits are taken care of.

Comment thread docs/install/sandboxes/grpc_bridge.rst Outdated

The gRPC bridge sandbox is an example usage of Envoy's
:ref:`gRPC bridge filter <config_http_filters_grpc_bridge>`.
Included in the sandbox is a gRPC in memory Key/Value store with a Python HTTP
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: in-memory

Comment thread docs/install/sandboxes/grpc_bridge.rst Outdated
Sending requests to the Key/Value store
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To use the python service and sent gRPC requests::
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: "To use the Python service and send"

Comment thread docs/install/sandboxes/grpc_bridge.rst Outdated
$ docker-compose exec python /client/client.py get foo
bar

Locally building a docker image with an envoy binary
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: Docker, Envoy

Comment thread docs/install/sandboxes/grpc_bridge.rst Outdated
Locally building a docker image with an envoy binary
----------------------------------------------------

The following steps guide you through building your own envoy binary, and
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: prefer Envoy and Ubuntu everywhere, proper nouns and all.

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.

Docker everywhere too, unless referring to the literal docker command.

Comment thread docs/install/sandboxes/grpc_bridge.rst Outdated

$ pwd
src/envoy
$ ./ci/run_envoy_docker.sh './ci/do_ci.sh bazel.dev'
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.

Do you really want to use bazel.dev here? I think this is generally only useful for developer iteration productivity. In general you want either bazel.release or bazel.debug, depending on whether performance matters. That way you get symbols for sure.


$ pwd
src/envoy/
$ docker build -f ci/Dockerfile-envoy-image -t envoy .
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.

This seems to be dupe of the above file suffix, can you de-dupe?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh shux.. good catch.. removed that stuff from grpc_bridge.rst

@rshriram
Copy link
Copy Markdown
Member Author

rshriram commented May 23, 2017 via email

@rshriram
Copy link
Copy Markdown
Member Author

@htuch addressed nits. With regard to validating docker build/gRPC/front-proxy, these examples were already present. I just added the zipkin_tracing.rst.

@htuch htuch merged commit 115434a into envoyproxy:master May 23, 2017
@rshriram rshriram mentioned this pull request Jun 8, 2017
3 tasks
@rshriram rshriram deleted the zipkin_example branch August 14, 2017 18:11
rshriram added a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Automatic merge from submit-queue.

make mixer cluster name configurable

Please see istio/api#358 for context.
Essentially remove hardcoded "mixer_server" and allow users to override the name, in addition to allowing separate clusters for check vs reports so that it makes it easier to load balance/manage the system.
mathetake pushed a commit that referenced this pull request Mar 3, 2026
**Description**

according to the openai openai spec, there should be an index in the
chat completions chunk data. This fixes it and avoids serializing nested
empty structs.

See https://github.com/openai/openai-openapi/tree/manual_spec

---------

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
Co-authored-by: Adrian Cole <adrian@tetrate.io>
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.

8 participants