-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
opentelemetry_propagate do not work with auth endpoints #9811
Comments
This issue is currently awaiting triage. If Ingress contributors determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @esigo |
I'm not sure what you mean with opentracing headers. If you mean the context propagation, at the moment only w3s tracing context is supported. It's possible to support b3 context propagation here by changing it to |
Let me explain a little bit more. When i make a request to the application behind nginx, if the request have to be authorized using auth-url, the opentracing headers (w3s) are propagated only to the app and not to the authorizer. Request:
headers on auth service
headers on app
ingress configuration:
The idea to use the opentelemetry module on the ingress is to create the trace on nginx and propagate the |
Maybe its necessary to force the header using something like:
Is there a way to get the traceparent as a variable? |
I tried the following configuration:
and i'm able to see the header on the authorized service:
The problem is when i try to use the variable |
This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach |
Here is an example to reproduce the issue: The expected result is to see the service-c span inside the trace generated by Nginx. Regards! |
this works with the following config: daemon off;
error_log /dev/stdout info;
load_module /modules_mount/etc/nginx/modules/otel/otel_ngx_module.so;
events {
worker_connections 1024;
}
http {
opentelemetry on;
opentelemetry_operation_name "http";
opentelemetry_config /conf/otel-nginx.toml;
access_log /dev/stdout;
opentelemetry_capture_headers on;
add_header Server-Timing "traceparent;desc=\"$opentelemetry_context_traceparent\"";
opentelemetry_operation_name my_example_backend_root;
server {
listen 80;
server_name localhost;
location / {
opentelemetry on;
opentelemetry_operation_name my_example_backend;
opentelemetry_propagate;
opentelemetry_trust_incoming_spans on;
proxy_pass http://service-a:80/;
auth_request /auth;
set $dummy_val "$opentelemetry_context_traceparent";
}
location = /auth {
opentelemetry_operation_name my_example_auth;
opentelemetry on;
opentelemetry_propagate;
opentelemetry_trust_incoming_spans on;
internal;
proxy_pass http://service-c:80/auth;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
}
} It should be possible to achieve the same config using annotations I think, I haven't tested though. |
@esigo from your example, I would expect |
@eguzki yes, it's service-c in the snapshot I attached. But this span is actually coming from the service not from nginx. And auth span (service-c) is a child to the span that nginx created. |
I confirmed that the example posted earlier by @esigo works, in particular adding I was able to do it with a snippet, as well:
Thanks, @esigo! |
I'll note that there's a similar issue with propagating to gRPC backend services in #10319. |
I confirmed that this snipped actually works, but can someone explain why and is there any plan to fix it and make it work out of the box?
|
Hi, do you have any updates on this? |
I asked Copilot to explain that workaround:
Is that accurate? The workaround worked for us though, so thanks! |
Esigo and other comments seems to be conclusive on the topic of this issue. So there is no action item on the project for this issue hence closing it. /clsoe |
/close |
@longwuyuan: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
I tried to use the workaround today with the following results:
Any ideas how to get it working when using keepalive? Edit: it starts to work when |
@longwuyuan: I think we have a regression (vs. opentracing) here. Distributed tracing should work out of the box for auth requests as it worked before. If some additional configuration is needed, it should be documented. The suggested workaround was expressed in plain nginx config, not as a ready-to-use solution for ingress-nginx. We experience the same thing and we consider it a blocker. Because of this issue, we can't switch to OpenTelemetry in nginx easily, so we can't update ingress-nginx, which in turn blocks further Kubernetes updates. It's already quite big undertaking to support W3c header extraction everywhere and to adjust configuration of all ingress resources, so it would be beneficial for many people if it's not more difficult than necessary. I've attached screenshots from the same kind of request, one with opentracing and another with opentelemetry enabled. This issue was also reported here: open-telemetry/opentelemetry-cpp-contrib#143, open-telemetry/opentelemetry-cpp-contrib#270. Please consider reopening. |
What happened:
Enabling the open telemetry module, the traces are created by nginx and then propagated to the application behind.
But when the backend is the authorization endpoint, the opentracing headers are not present.
Here is an example of the auth-url configuration.
When the auth endpoint its called, there are no opentracing headers.
What you expected to happen:
Maybe when the location its
internal
the header are not injected when the location its internal.NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):
Kubernetes version (use
kubectl version
):Environment:
AWS EKS 1.24
How to reproduce this issue:
Install the latest version.
Enable the opentelemetry
Set any backend with /auth-url
The text was updated successfully, but these errors were encountered: