-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record tags inconditionally at server receive #144
Conversation
@@ -39,8 +39,6 @@ def initialize(app, config_hash) | |||
if @sampled_as_boolean | |||
@logger && @logger.warn("Using a boolean in the Sampled header is deprecated. Consider setting sampled_as_boolean to false") | |||
end | |||
# Record the given tags on server receive, even if the zipkin headers were present in the incoming request? | |||
@record_on_server_receive = parse_tags(config[:record_on_server_receive]) |
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.
you can remove :record_on_server_receive
on line 11
tags.each { |annotation_key, env_key| span.record_tag(annotation_key, zipkin_env.env[env_key]) } | ||
def trace_server_information(span, zipkin_env, status) | ||
span.kind = Trace::Span::Kind::SERVER | ||
span.record_tag(Trace::Span::Tag::STATUS, status) |
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.
you can consider doubling this as error so the span appears red
ex from java
// 1xx, 2xx, and 3xx codes are not all valid, but the math is good enough vs drift and opinion
// about individual codes in the range.
if (httpStatusInt < 100 || httpStatusInt > 399) {
customizer.tag("error", String.valueOf(httpStatusInt));
}
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.
Here is how we are doing it in client spans:
span.record_tag(Trace::Span::Tag::ERROR, status) if STATUS_ERROR_REGEXP.match(status) |
Maybe we can have a method like this in the Span class:
STATUS_ERROR_REGEXP = /\A(4.*|5.*)\z/.freeze
def record_status(status)
record_tag(Tag::STATUS, status)
record_tag(Tag::ERROR, status) if STATUS_ERROR_REGEXP.match(status)
end
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.
Done
shibbit
…On Sat, Mar 30, 2019, 6:16 AM Jordi Polo Carres ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/zipkin-tracer/rack/zipkin-tracer.rb
<#144 (comment)>
:
> annotate_plugin(span, zipkin_env.env, status, headers, body)
end
- def trace_request_information(span, zipkin_env)
- tags = if ***@***.***_on_server_receive.empty?
- # if the user specified tags to record on server receive, use these no matter what
- @config.record_on_server_receive
- elsif !zipkin_env.called_with_zipkin_headers?
- # if the request comes from a non zipkin-enabled source record the default tags
- DEFAULT_SERVER_RECV_TAGS
- end
- return if tags.nil?
- tags.each { |annotation_key, env_key| span.record_tag(annotation_key, zipkin_env.env[env_key]) }
+ def trace_server_information(span, zipkin_env, status)
+ span.kind = Trace::Span::Kind::SERVER
+ span.record_tag(Trace::Span::Tag::STATUS, status)
Done
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#144 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD616TvJPciS8O5a39D2lCs4ge9F590ks5vbp7JgaJpZM4cRihJ>
.
|
This removes the possibility of constraining the tags recorded at server receive. It was always half-baked and pretty useless.
We originally created the feature of optionally setting tags in server because:
I do not think any of these hold anymore.
Also, by our own experience using zipkin more often than not we want more info not less.
This PR also adds
status_code
andmethod
alongside thepath
info to server spans so that info is available when for some reason the client spans do not have it.@adriancole @ykitamura-mdsol @jfeltesse-mdsol