diff --git a/lib/appsignal/plug.ex b/lib/appsignal/plug.ex index a2a0d4cd4..b1bdad7b1 100644 --- a/lib/appsignal/plug.ex +++ b/lib/appsignal/plug.ex @@ -141,7 +141,7 @@ if Appsignal.plug?() do |> Enum.into(%{}) end - def extract_meta_data(%Plug.Conn{method: method, request_path: path} = conn) do + def extract_meta_data(%Plug.Conn{method: method, request_path: path, status: status} = conn) do request_id = conn |> Plug.Conn.get_resp_header("x-request-id") @@ -150,7 +150,8 @@ if Appsignal.plug?() do %{ "method" => method, "path" => path, - "request_id" => request_id + "request_id" => request_id, + "status" => status } end diff --git a/test/appsignal/plug_test.exs b/test/appsignal/plug_test.exs index e13f98ef1..3249e55b4 100644 --- a/test/appsignal/plug_test.exs +++ b/test/appsignal/plug_test.exs @@ -324,11 +324,13 @@ defmodule Appsignal.PlugTest do assert Appsignal.Plug.extract_meta_data(%Plug.Conn{ method: "GET", request_path: "/foo", - resp_headers: [{"x-request-id", "kk4hk5sis7c3b56t683nnmdig632c9ot"}] + resp_headers: [{"x-request-id", "kk4hk5sis7c3b56t683nnmdig632c9ot"}], + status: 200 }) == %{ "method" => "GET", "path" => "/foo", - "request_id" => "kk4hk5sis7c3b56t683nnmdig632c9ot" + "request_id" => "kk4hk5sis7c3b56t683nnmdig632c9ot", + "status" => 200 } end end