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

Missing Traces for Method based routing (requests that are not redirectced to another location) #174

Open
maria-farooq opened this issue Jul 2, 2021 · 1 comment

Comments

@maria-farooq
Copy link

maria-farooq commented Jul 2, 2021

Hi,

Versions

  • nginx-plus version: r24
  • We are configuring nginx using nginx-ansible-role: 0.17.4
  • with Datadog Opentracing C++ Plugin version: v1.3.0

Use Case

We have an endpoint where on same URL: request are routed depending on the http METHOD.

For example on this URL: https://usstaging.restcomm.com/restcomm/2012-04-24/Accounts/AC123/Calls

  • GET is routed an accounting service.
  • PUT|POST is routed a sessionHandling service.

How we implement it

    location ~ (?:/restcomm|/api)(?:/2012-04-24)*(/Accounts.*/.+/Calls.*) {
        log_subrequest on;
        error_page 418 = @accountingapi;
        if ($request_method !~ (POST|PUT) ) {
         return 418;
        }
        include "inc/incSessionHandlingApi.conf";
    }
    location @accountingapi {
        include "inc/incAccountingApi.conf";
    }

incSessionHandlingApi.conf

if ($http_authorization ~* (^Bearer)) {
    return 400 "Unsupported Authorization Type";
}
proxy_pass http://connect_lb;
        opentracing_propagate_context;
rewrite (?:/api)+(/2012-04-24.*) /restcomm$1 break;
proxy_set_header Host connect-lb.dev-us-east-1-restcomm-internals.com;
proxy_set_header X-Forwarded-Host $host;

inc/incAccountingApi.conf

proxy_pass https://api_gateway/dev/accounting$uri$is_args$args;
        opentracing_propagate_context;
rewrite (/2012-04-24.*) /accounting$1 break;
proxy_set_header Host abc.execute-api.us-east-1.amazonaws.com;
proxy_set_header X-Forwarded-Host $host;
proxy_ssl_server_name on;

Result of this config

  • using above mentioned config we are able to see the traces for accountingapi (GET requests).
  • however we are not able to see the traces for PUT|POST SessionHandlingApi.

Reverse Config

  • we tried a reverse config where we reverse the if_condition and started to redirected PUT|POST SessionHandlingApi requests instead of accounting api.
    location ~ (?:/restcomm)*(?:/api)*(?:/2012-04-24)*(/Accounts.*/.+/Calls.*) {
        log_subrequest on;
        error_page 418 = @sessionhandlingapi;
        if ($request_method ~ (POST|PUT) ) {
         return 418;
        }
        include "inc/incAccountingApi.conf";
    }

Result of this config

  • result is reversed.
  • using above mentioned config we are able to see the traces for PUT|POST SessionHandlingApi.
  • however we are not able to see the traces for accountingapi (GET requests).

Conclusion

  • we are able to see the traces for requests that are redirected to another location
  • and missing the traces for those which are not redirected to another location
@sriemer
Copy link
Contributor

sriemer commented Jul 12, 2021

Should be raised with Datadog. nginx-opentracing lacks subrequest support. Authentication creates subrequests. The tracer is blind and lacking configuration in that case. Our Instana tracer that I'm developing is always on and tracing by default. So we capture those traces. Trace continuity is broken though.
We are working on subrequest support right now. If the dogs want to team up, then that would increase the chance that we won't keep this feature for ourselves. 😉

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

2 participants