Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Add app_id in ULS response
Browse files Browse the repository at this point in the history
Change-Id: Ica76169b389d9ab8b952f5ad9284d8eb97211f0c
  • Loading branch information
Anfernee Gui committed Jul 31, 2012
1 parent ff5d2fa commit 8a3d41b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ext/nginx/uls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ULS_STATS_LATENCY = "response_latency"
ULS_STATS_SAMPLES = "response_samples"
ULS_STATS_CODES = "response_codes"
ULS_STICKY_SESSION = "sticky_session"
ULS_APP_ID = "app_id"
-- For both diretion
-- When ULS_BACKEND_ADDR sent from nginx to uls, it means sticky address
ULS_BACKEND_ADDR = "backend_addr"
Expand Down Expand Up @@ -67,7 +68,8 @@ ULS_ROUTER_IP = "router_ip"
{
"backend_addr": xxx,
"request_tags": xxx,
"router_ip": xxx
"router_ip": xxx,
"app_id": xxx,
}
--]]

Expand Down Expand Up @@ -236,6 +238,7 @@ function post_process_subrequest(ngx, res)
ngx.var.uls_req_tags = msg[ULS_REQEST_TAGS]
ngx.var.router_ip = msg[ULS_ROUTER_IP]
ngx.var.sticky = msg[ULS_STICKY_SESSION]
ngx.var.app_id = msg[ULS_APP_ID]

ngx.log(ngx.DEBUG, "route "..ngx.var.http_host.." to "..ngx.var.backend_addr)
end
Expand Down
1 change: 1 addition & 0 deletions lib/router/const.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ULS_BACKEND_ADDR = :"backend_addr"
ULS_ROUTER_IP = :"router_ip"
ULS_STICKY_SESSION = :"sticky_session"
ULS_APP_ID = :"app_id"

# Max Connections to Pool
MAX_POOL = 32
Expand Down
3 changes: 2 additions & 1 deletion lib/router/router_uls_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class ParserError < StandardError; end
ULS_STICKY_SESSION => new_sticky,
ULS_BACKEND_ADDR => "#{droplet[:host]}:#{droplet[:port]}",
ULS_REQUEST_TAGS => uls_req_tags,
ULS_ROUTER_IP => Router.inet
ULS_ROUTER_IP => Router.inet,
ULS_APP_ID => droplet[:app] || 0,
}
end

Expand Down

2 comments on commit 8a3d41b

@lukebakken
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi ... I just found that "app_id" is missing in the nginx_router.conf file ...

http://reviews.cloudfoundry.org/#/c/8221/

Thanks!

@anfernee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also noticed that and submitted the same patch and merged it. thanks for the patch anyway! ;)

Please sign in to comment.