Skip to content

Commit

Permalink
Merge pull request #5 from danifbento/nginx-sender-improvements
Browse files Browse the repository at this point in the history
Add more information into ngx raven sender.
  • Loading branch information
cycomachead authored Jul 3, 2022
2 parents 6a5a622 + c8c436f commit 98de782
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion raven/senders/ngx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,33 @@ function _M.get_request_data()
url = ngx.var.request_uri or nil,
query_string = ngx.var.query_string or nil,
env = {
-- some information can be only accessed if the request is at log phase
HOSTNAME = ngx.var.hostname,
METHOD = ngx.var.request_method or nil,
BODY_BYTES_SENT = ngx.var.body_bytes_sent or nil,
BYTES_RECEIVED = ngx.var.bytes_received or nil,
BYTES_SENT = ngx.var.bytes_sent or nil,
NGINX_VERSION = ngx.var.nginx_version or nil,
REMOTE_ADDR = ngx.var.remote_addr or nil,
},
REMOTE_PORT = ngx.var.remote_port or nil,
REQUEST_TIME = ngx.var.request_time or nil,
STATUS = ngx.var.status or nil,
USER_AGENT = ngx.var.http_user_agent or nil,
CONTENT_TYPE = ngx.var.http_content_type or nil,
CONTENT_LENGTH = ngx.var.http_content_length or nil,
-- proxy related information
PROXY_ADD_X_FORWARDED_FOR = ngx.var.proxy_add_x_forwarded_for or nil,
UPSTREAM_ADDR = ngx.var.upstream_add or nil,
UPSTREAM_BYTES_RECEIVED = ngx.var.upstream_bytes_received or nil,
UPSTREAM_BYTES_SENT = ngx.var.upstream_bytes_sent or nil,
UPSTREAM_CACHE_STATUS = ngx.var.upstream_cache_status or nil,
UPSTREAM_CONNECT_TIME = ngx.var.upstream_connect_time or nil,
UPSTREAM_FIRST_BYTE_TIME = ngx.var.upstream_first_byte_time or nil,
UPSTREAM_HEADER_TIME = ngx.var.upstream_header_time or nil,
UPSTREAM_RESPONSE_LENGTH = ngx.var.upstream_response_length or nil,
UPSTREAM_RESPONSE_TIME = ngx.var.upstream_response_time or nil,
UPSTREAM_STATUS = ngx.var.upstream_status or nil,
},
}
end
return {
Expand Down

0 comments on commit 98de782

Please sign in to comment.