wangrzneu commented on pull request #87:
URL:
https://github.com/apache/skywalking-nginx-lua/pull/87#issuecomment-922476671
> I mean who could run the change? LUA script is already hot-load supported
by lua engine. From my understanding, only case requiring this is something
similar with SkyWalking other language agents, which implemented DCS, but it is
not implemented in Lua.
Our service is deployed in K8s, we use a sidecar in the same pod to set the
config. The nginx config is like,
```
http {
lua_package_path "/Path/to/.../skywalking-nginx-lua/lib/?.lua;;";
lua_shared_dict tracing_buffer 100m;
init_worker_by_lua_block {
local metadata_buffer = ngx.shared.tracing_buffer
metadata_buffer:set('serviceName', 'User Service Name')
metadata_buffer:set('serviceInstanceName', 'User Service Instance
Name')
metadata_buffer:set('includeHostInEntrySpan', false)
require("skywalking.util").set_randomseed()
require("skywalking.client"):startBackendTimer("http://127.0.0.1:8080")
skywalking_tracer = require("skywalking.tracer")
}
server {
listen 8090;
location /ingress {
default_type text/html;
rewrite_by_lua_block {
skywalking_tracer:start("upstream service")
}
proxy_pass http://127.0.0.1:8080/backend;
body_filter_by_lua_block {
if ngx.arg[2] then
skywalking_tracer:finish()
end
}
log_by_lua_block {
skywalking_tracer:prepareForReport()
}
}
}
server {
listen 9090;
location /config {
content_by_lua_block {
ngx.req.read_body()
local data = ngx.req.get_body_data()
local config = cjson.decode(data)
local metadata_buffer = ngx.shared.tracing_buffer
metadata_buffer:set('backendHttpUri',
config.skywalking_oap_address)
}
}
}
}
```
The config can be sent to `/config` interface in the 9090 port.
The pod design diagram is like:

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]