-
Notifications
You must be signed in to change notification settings - Fork 170
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
OpenTracing support #669
OpenTracing support #669
Conversation
update fork
gateway/conf/nginx.conf.liquid
Outdated
@@ -5,12 +5,16 @@ env RESOLVER; | |||
env BACKEND_ENDPOINT_OVERRIDE; | |||
env OPENSSL_VERIFY; | |||
|
|||
{% if jaeger_enabled %} | |||
load_module /opt/app-root/src/nginx-modules/ngx_http_opentracing_module.so; | |||
load_module /opt/app-root/src/nginx-modules/ngx_http_jaeger_module.so; |
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.
This will not work on macOS or any local machine. We have to make this relative somehow.
gateway/conf/nginx.conf.liquid
Outdated
@@ -61,37 +67,38 @@ http { | |||
{% include file %} | |||
{% endfor %} | |||
|
|||
|
|||
{% if jaeger_enabled %} | |||
{% include "conf.d/jaeger.conf" %} |
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.
We can have a opentracing
subfolder there and do:
{% include "conf.d/opentracing" | append opentracing_tracer | append ".conf" %}
So we have a conf file for each supported tracer.
gateway/conf/nginx.conf.liquid
Outdated
daemon {{ daemon | default: 'off' }}; | ||
master_process {{ master_process | default: 'on' }}; | ||
worker_processes {{ worker_processes | default: 'auto' }}; | ||
pcre_jit on; | ||
pid {{ pid | default: 'nginx.pid' }}; | ||
timer_resolution {{ timer_resolution | default: '100ms' }}; |
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.
This should be disabled only when opentracing is enabled. Or the timer_resolution should be set to 0
(if that works).
gateway/conf.d/echo.conf
Outdated
|
||
echo_read_request_body; | ||
location / { |
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.
We probably don't need to rewrite this right? The echo module behaves ok.
gateway/conf.d/backend.conf
Outdated
@@ -1,4 +1,11 @@ | |||
{% if jaeger_enabled %} |
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.
No liquid in this template (it would need to have .liquid
extension). This will neeed to be in the main nginx.conf.liquid.
gateway/conf.d/apicast.conf
Outdated
@@ -9,6 +11,12 @@ set_by_lua_block $deployment { | |||
# ssl_session_fetch_by_lua_block { require('apicast.executor').call() } | |||
# ssl_session_store_by_lua_block { require('apicast.executor').call() } | |||
|
|||
{% if jaeger_enabled %} |
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.
This is trouble. There is no liquid templating in this file. This global definition can be in the nginx.conf.liquid.
gateway/conf.d/apicast.conf
Outdated
proxy_pass_request_headers off; | ||
|
||
{% if jaeger_enabled %} |
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.
This is impossible to do. This file has to stay plain nginx file without liquid templating because of our test suite.
gateway/conf.d/jaeger.conf
Outdated
@@ -0,0 +1,4 @@ | |||
jaeger_reporter_local_agent_host_port {{ jaeger_addr | default: '127.0.0.1' }}:{{ jaeger_port | default: 6831 }}; |
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.
We should add .liquid
extension to files that are processed by liquid so it is more obvious liquid is available there.
@@ -108,7 +108,10 @@ _M.default_config = { | |||
proxy_ssl_certificate_key = env_value_ref('APICAST_PROXY_HTTPS_CERTIFICATE_KEY'), | |||
proxy_ssl_session_reuse = env_value_ref('APICAST_PROXY_HTTPS_SESSION_REUSE'), | |||
proxy_ssl_password_file = env_value_ref('APICAST_PROXY_HTTPS_PASSWORD_FILE'), | |||
|
|||
jaeger_enabled = env_value_ref('JAEGER_ENABLED'), |
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.
I'd rather try to make this "opentracing" support rather than just jaeger.
IMO we should be open to support more than jaeger tracker and that the configuration should be designed like that.
So for example jaeger_enabled
IMO should be opentracing_enabled
and then there should be opentracing_tracer
that says jaeger|...|...|...
.
The common denominator of the configuration should be defined as "opentracing" and then the specifics can be named with the tracer name.
c458cf6
to
b3f904a
Compare
gateway/conf.d/apicast.conf
Outdated
@@ -35,6 +35,7 @@ location = /___http_call { | |||
proxy_set_header User-Agent $user_agent; | |||
proxy_set_header X-3scale-OAuth2-Grant-Type $grant_type; | |||
proxy_set_header 3scale-options $options; | |||
proxy_set_header uber-trace-id $http_uber_trace_id; |
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.
e10da83
to
f1090fd
Compare
daemon {{ daemon | default: 'off' }}; | ||
master_process {{ master_process | default: 'on' }}; | ||
worker_processes {{ worker_processes | default: 'auto' }}; | ||
pcre_jit on; | ||
pid {{ pid | default: 'nginx.pid' }}; | ||
|
||
{% unless opentracing_tracer != empty %} |
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.
I think this should be if
.
CHANGELOG.md
Outdated
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
### Added | |||
|
|||
- Rate Limit policy [PR #648](https://github.com/3scale/apicast/pull/648) | |||
- Opentracing support [PR #669](https://github.com/3scale/apicast/pull/669) |
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.
👀 OpenTracing?
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.
"fixed"
--- error_code: 200 | ||
--- no_error_log | ||
[error] | ||
--- udp_listen: 6831 |
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.
That's openresty? cool.
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.
Thats the Test::Nginx testing framework: http://search.cpan.org/~agent/Test-Nginx/lib/Test/Nginx/Socket.pm#udp_listen
…he server part in nginx.conf.liquid
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.
👍 sweet
We got OpenTracing support on Linux and macOS.
Homebrew formulas provided in our tap: 3scale-archive/homebrew-opentracing#1
Adds basic opentracing jaeger support to apicast
Requires 3scale/s2i-openresty#56, 3scale/s2i-openresty#57