Conversation
README.md
Outdated
- `kong.preread`, `start` / `finish`, `<timestamp>` | ||
- `kong.header_filter`, `start` / `finish`, `<timestamp>` | ||
- `kong.body_filter`, `start` / `finish`, `<timestamp>` | ||
- `kong.try_[n]`, `start` / `finish`, `<timestamp>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the try_n annotation is a nice thing for the top-level span, but each load balancer try should be a sub-span with a different span ID, as you don't want to repeat the same span ID in multiple places. each LB try is a different http request, in other words. Also the tag encoding will affect search in a bad way whereas kong.try_1 will not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, I have reverted everything involving the try_[n]
tags. Each load balancer try is a new span.
README.md
Outdated
- `kong.balancer.try` | ||
- `kong.balancer.state`: see [here](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md#get_last_failure) for possible values | ||
- `kong.balancer.code` | ||
- `kong.try_[n].ipv4` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of this should become a child span with kind=CLIENT
assuming there is always at least one http "try", each of these subspans should be a CLIENT span and the parent span should not. The encoding done here will make search unusable, but that's not the only reason subspans should be used. This style also breaks dependency graph linking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did as requested. Notice that previously the load balancer spans were children of the proxy span, which was of kind=CLIENT. I have made them children of the request span now, which is the only span of kind "not CLIENT" (it is a SERVER span).
I also tried to find an example of where a parent span added a "tryN" annotation.. I thought google did that in one of their cloud SDKs, but either it was deleted, or I can't find it. Most typically, a simple parent span for logical in-process work, and a separate child span per attempt is all instrumentation do. This allows graph processing, which never looks at logs/annotations, to understand the success/error properties of in ingress->egress flow. While up to you, I think the cleanest change would be to unfold the LB tries into sub-spans, with normal tag names, especially "error" and "http.status_code" etc. and the rest looks good. |
7dfd9e4
to
7b55528
Compare
This makes several changes in the tests in order to run them from Travis-CI as well as making them more similar to Kong tests for other plugins. * The tests for the deprecated API objects have been eliminated * The `TIMEOUT` variable was increased to avoid certain flakyness in some tests * Kong's `spec.helpers` have been used to start/stop kong * Kong's db is initialized using `helpers.get_db_utils` * The initial service, routes and plugins are created via blueprints
* Replace ; by , for delimiting table items * Add vertical spacing between functions * Fix some horizontal spacing issues due to removing tabs
7b55528
to
919f773
Compare
Previously, each kong phase had a span. This changes them to logs (annotations in zipkin) with start and finish timestamps inside the proxy span and the request span. Each balancer try still is represented by a span, but these spans are now children of the request span instead of the proxy span. Their tags have been slightly modified too: `error` is now always present, and set to `true` or `false`. The span names for http traffic have been changed to: * `GET http://host:port` for the request span * `GET http://host:port (proxy)` for the proxy span * `GET http://host:port (balancer try n)` for each balancer try span
This change exercises the changes included in the previous commits: * Three types of spans: request, proxy & balancer * Kong phases are now encoded as annotations instead of sub-spans * Empty tags aren't sent * The component tag is renamed `lc` * The request name of http requests is like `GET http://host:port` Incidentally it creates an extra test for a situation which was not tested for at all in the past (error mode behavior was only tested in the context of the traceId tags).
919f773
to
38d66e0
Compare
@adriancole did as requested, and also added a more extensive description on the PR. Thanks for the review! |
I think overall this is positive. thanks! |
component = "kong", | ||
["span.kind"] = "server", | ||
["http.method"] = method, | ||
["http.url"] = url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I am late for this. We usually don't record http.url
, instead we record http.path
because url
can leak some private information like tokens or api-key. I can open a PR for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, we haven't released a new official version of the plugin yet, so there's still time for this. If you feel confident, please open a PR. If not, I will give it a try.
local request_span = tracer:start_span("kong.request", { | ||
child_of = wire_context; | ||
|
||
local request_span = tracer:start_span(method .. " " .. url, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another one: calling a span name GET /something/123abc
is a high cardinality source. In http servers we use GET /something/{id}
but since kong is an api-gateway it is maybe easier to call it just GET
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, will do. Thanks!
We name spans for http traffic `GET` instead of `GET http://foo.bar/baz` in order to avoid high cardinality. See #52 (review)
Hi @jcchavezs both changes are done in #57 |
Awesome, thanks!
|
We name spans for http traffic `GET` instead of `GET http://foo.bar/baz` in order to avoid high cardinality. See #52 (review)
We name spans for http traffic `GET` instead of `GET http://foo.bar/baz` in order to avoid high cardinality. See #52 (review)
We name spans for http traffic `GET` instead of `GET http://foo.bar/baz` in order to avoid high cardinality. See Kong/kong-plugin-zipkin#52 (review)
Fixes #49
It is highly recommended to review this PR commit-by-commit, but notice that github's UI does not list them in the appropriate order.
The initial commits (on
git log
, not on github's UI) deal with the fact that the current specs were not included on the CI environment (only the linter was called) and they were run in a non-standard way (i.e. Kong was run in production mode, not in test mode).The
feat
commits detail the new changes:component
tag is renamed tolc
for zipkinerror
tag, set totrue
orfalse
.GET http://host:port
for the request spanGET http://host:port (proxy)
for the proxy spanGET http://host:port (balancer try n)
for each balancer tryAll these changes are tested on the last commit.