Skip to content

Commit

Permalink
capture http status code if
Browse files Browse the repository at this point in the history
middleware instrumentation is disabled
  • Loading branch information
tannalynn committed Aug 17, 2023
1 parent 8b2b965 commit 8cfb9d0
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions lib/new_relic/rack/agent_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,17 @@ def build_transaction_name
"#{prefix}#{self.class.name}/call"
end

# If middleware tracing is disabled, we'll still inject our agent-specific
# middlewares, and still trace those, but we don't want to capture HTTP
# response codes, since middleware that's outside of ours might change the
# response code before it goes back to the client.
def capture_http_response_code(state, result)
return if NewRelic::Agent.config[:disable_middleware_instrumentation]

super
end

def capture_response_content_type(state, result)
return if NewRelic::Agent.config[:disable_middleware_instrumentation]

super
end
# # If middleware tracing is disabled, we'll still inject our agent-specific
# # middlewares, and still trace those, but the http response code might be
# # changed by middleware outside of ours. We will still capute the response
# # code, but it is not guaranteed to be the final response code.
# def capture_http_response_code(state, result)
# super
# end

# def capture_response_content_type(state, result)
# super
# end
end
end
end

0 comments on commit 8cfb9d0

Please sign in to comment.