{"action":"created","issue":{"url":"https://api.github.com/repos/envoyproxy/envoy/issues/2787","repository_url":"https://api.github.com/repos/envoyproxy/envoy","labels_url":"https://api.github.com/repos/envoyproxy/envoy/issues/2787/labels{/name}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/issues/2787/comments","events_url":"https://api.github.com/repos/envoyproxy/envoy/issues/2787/events","html_url":"https://github.com/envoyproxy/envoy/pull/2787","id":304812115,"number":2787,"title":"tracing: Delegate envoy tracing decision to tracer to determine if should override sampling","user":{"login":"objectiser","id":164562,"avatar_url":"https://avatars3.githubusercontent.com/u/164562?v=4","gravatar_id":"","url":"https://api.github.com/users/objectiser","html_url":"https://github.com/objectiser","followers_url":"https://api.github.com/users/objectiser/followers","following_url":"https://api.github.com/users/objectiser/following{/other_user}","gists_url":"https://api.github.com/users/objectiser/gists{/gist_id}","starred_url":"https://api.github.com/users/objectiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/objectiser/subscriptions","organizations_url":"https://api.github.com/users/objectiser/orgs","repos_url":"https://api.github.com/users/objectiser/repos","events_url":"https://api.github.com/users/objectiser/events{/privacy}","received_events_url":"https://api.github.com/users/objectiser/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-13T15:24:55Z","updated_at":"2018-03-17T20:52:21Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/2787","html_url":"https://github.com/envoyproxy/envoy/pull/2787","diff_url":"https://github.com/envoyproxy/envoy/pull/2787.diff","patch_url":"https://github.com/envoyproxy/envoy/pull/2787.patch"},"body":"**This PR is currently based (and therefore dependent) upon the B3 sampled header propagation code in #2764**\r\n\r\nThe sampling decision is currently used to determine whether a span should be created/started. The decision is propagated to downstream services via the `x-trace-id` header.\r\n\r\nThe problem is that, if the `x-trace-id` is not propagated along with other trace context (e.g. the service does not propagate it due to using a zipkin compatible tracer in the service that does not know about this header), then the decision is lost in the downstream service and it will make its own sampling decision. This will lead to inconsistent fragmented traces.\r\n\r\nThe other problem is that, if/when #2764 is merged, any B3-sampled header received with a request will be ignored by the local sampling decision.\r\n\r\nThis PR deals with the situation by delegating the envoy proxy's tracing (sampling) decision down to the tracers themselves. There are essentially three tracers, which handle the decision in different ways:\r\n\r\n1) LightStep - this tracer only creates/starts a span if the tracing decision indicates it should - otherwise no span is created - as now. It is the responsibility of any proxied services to propagate the `x-trace-id` to ensure that decision is passed to downstream services.\r\n\r\n2) Zipkin - this tracer propagates its own sampling decision via the `X-B3-Sampled` header. If that header is not present, such as when creating the root span or it hasn't been propagated with the trace context, then the proxy's tracing (sampling) decision will be used to set the `X-B3-Sampled` header which will subsequently be passed to downstream services (once #2764 is merged).\r\n\r\n3) Other OpenTracing compatible tracers - the only way to influence the sampling of a trace instance in the OpenTracing standard is through the use of the `sampling.priority` tag - so in this situation if the proxy sampling decision is false, the `sampling.priority` tag will be set to 0 when creating the span. It is then the tracer's responsibility to use or ignore that *hint*.\r\n\r\n*Risk Level*: Medium\r\n\r\n*Testing*: unit tests\r\n\r\n*Docs Changes*:\r\nnone\r\n\r\n*Release Notes*:\r\nThis change delegates the sampling decision to the tracer, which may have additional context that needs to be taken into account when determining the actual sampling state. If no such state already exists for a trace instance, then the sampling decision supplied by the Envoy proxy will be used.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/envoyproxy/envoy/issues/comments/373951717","html_url":"https://github.com/envoyproxy/envoy/pull/2787#issuecomment-373951717","issue_url":"https://api.github.com/repos/envoyproxy/envoy/issues/2787","id":373951717,"user":{"login":"objectiser","id":164562,"avatar_url":"https://avatars3.githubusercontent.com/u/164562?v=4","gravatar_id":"","url":"https://api.github.com/users/objectiser","html_url":"https://github.com/objectiser","followers_url":"https://api.github.com/users/objectiser/followers","following_url":"https://api.github.com/users/objectiser/following{/other_user}","gists_url":"https://api.github.com/users/objectiser/gists{/gist_id}","starred_url":"https://api.github.com/users/objectiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/objectiser/subscriptions","organizations_url":"https://api.github.com/users/objectiser/orgs","repos_url":"https://api.github.com/users/objectiser/repos","events_url":"https://api.github.com/users/objectiser/events{/privacy}","received_events_url":"https://api.github.com/users/objectiser/received_events","type":"User","site_admin":false},"created_at":"2018-03-17T20:52:21Z","updated_at":"2018-03-17T20:52:21Z","author_association":"MEMBER","body":"@rnburn Would you be able to have a look at this PR, as it impacts the LightStep and OpenTracing drivers?\r\n"}}
{"actor":{"display_login":"objectiser"}}