Skip to content
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

Mirror requests are not propagated correctly #81

Open
rogueai opened this issue Jan 14, 2019 · 1 comment
Open

Mirror requests are not propagated correctly #81

rogueai opened this issue Jan 14, 2019 · 1 comment

Comments

@rogueai
Copy link

rogueai commented Jan 14, 2019

I have a nginx config with a proxy_pass to an upstream server, along with a mirror directive to another upstream server in the same location. I'm trying to configure tracing to zipkin for both the proxied and mirrored request, but it seems if I enable the opentracing_propagate_context on the /mirror location, the resulting trace is wrong, with zipkin displaying the mirrored request and the proxied one as part of the same span.

I tried different directives from the reference guide, such as changing the location name, but to no avail.

Here's a sample of my config:

...
location /events {
          opentracing on;
          opentracing_propagate_context;

          proxy_set_header Host $http_host;
          proxy_pass http://$trk_rest_backend;

          mirror /mirror;
          mirror_request_body on;
        }

        location = /mirror {
          internal;
          proxy_pass_request_body on;
          proxy_set_header Host $http_host;
          proxy_set_header X-Original-URI $request_uri;

          opentracing on;
          opentracing_propagate_context;

          proxy_pass http://trk_raw_request_store$request_uri;
        }
...

And this is what I see in Zipkin:
screenshot 2019-01-14 at 10 10 18
As you can see, there's no /mirror location traced, and the trk-raw-request-store trace, which should be child of the mirror, it's instead listed as child of the proxied upstream trace.

Any ideas or suggestions as to why this might be happening?

Thanks.

@rogueai
Copy link
Author

rogueai commented Jan 29, 2019

An update on this issue: I was able to correctly propagate the TraceId for subrequests, but had to make a couple of changes:

  • upgrade nginx-opentracing to v0.8.0
  • enable log_subrequest on; in the server block
    After these changes, zipkin was correctly reporting parent-child relationships in the trace. I'm still confused as to why I'd need log_subrequest. Perhaps there still is an underlying issue, or just an undocumented requirement for subrequests.

Hope this helps!

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

No branches or pull requests

1 participant