Skip to content

Commit

Permalink
Rename the path and method transaction metadata (#1275)
Browse files Browse the repository at this point in the history
The `path` and `method` metadata naming was a bit confusing. Add the
`request_` prefix to make clear it's about the request.

We can remove the old context in the next major/minor version.
  • Loading branch information
tombruijn authored Sep 2, 2024
1 parent a5baade commit fa314b5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changesets/rename-path-and-method-transaction-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: patch
type: change
---

Rename the `path` and `method` transaction metadata to `request_path` and `request_method` to make it more clear what context this metadata is from. The `path` and `method` metadata will continue to be reported until the next major/minor version.
11 changes: 9 additions & 2 deletions lib/appsignal/rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ def initialize(request, options = {})
end

def apply_to(transaction)
transaction.set_metadata("path", request.path)
request_path = request.path
transaction.set_metadata("request_path", request_path)
# TODO: Remove in next major/minor version
transaction.set_metadata("path", request_path)

request_method = request_method_for(request)
transaction.set_metadata("method", request_method) if request_method
if request_method
transaction.set_metadata("request_method", request_method)
# TODO: Remove in next major/minor version
transaction.set_metadata("method", request_method)
end

transaction.add_params { params_for(request) }
transaction.add_session_data { session_data_for(request) }
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/appsignal/integrations/puma_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def lowlevel_error(error, env, status = nil)
lowlevel_error(error, env)

expect(last_transaction).to include_metadata(
"request_method" => "GET",
"method" => "GET",
"request_path" => "/some/path",
"path" => "/some/path"
)
expect(last_transaction).to include_environment(
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/appsignal/rack/abstract_middleware_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def make_request_with_error(error_class, error_message)
make_request

expect(last_transaction).to include_metadata(
"request_method" => "GET",
"method" => "GET",
"request_path" => "/some/path",
"path" => "/some/path"
)
expect(last_transaction).to include_environment(
Expand Down

0 comments on commit fa314b5

Please sign in to comment.