Skip to content

Commit

Permalink
fix: dereferencing nil variable (#47)
Browse files Browse the repository at this point in the history
Fix regression introduced in #44
  • Loading branch information
dmehala committed Apr 2, 2024
1 parent 419a613 commit bfc0dce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kong/plugins/ddtrace/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ function DatadogTraceHandler:log_p(conf) -- luacheck: ignore 212
request_span:set_http_header_tags(header_tags, kong.request.get_header, kong.response.get_header)
end
end
request_span:set_tag("kong.consumer", ngx_ctx.authenticated_consumer.id)
if ngx_ctx.authenticated_consumer then
request_span:set_tag("kong.consumer", ngx_ctx.authenticated_consumer.id)
end
if conf and conf.include_credential and ngx_ctx.authenticated_credential then
request_span:set_tag("kong.credential", ngx_ctx.authenticated_credential.id)
end
Expand Down

0 comments on commit bfc0dce

Please sign in to comment.