Add Plug request ID to telemetry
This commit is contained in:
parent
89a60a858c
commit
4c107eb27c
|
@ -2,6 +2,7 @@ defmodule TuskerPushWeb.HealthcheckController do
|
|||
use TuskerPushWeb, :controller
|
||||
|
||||
def healthcheck(conn, _params) do
|
||||
OpenTelemetry.Tracer.set_attribute(:request_id, conn.assigns.request_id)
|
||||
send_resp(conn, 200, "ok")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,6 +5,8 @@ defmodule TuskerPushWeb.PushController do
|
|||
require Logger
|
||||
|
||||
def push(conn, %{"env" => env, "apns_device_token" => apns_device_token, "ctx" => context}) do
|
||||
OpenTelemetry.Tracer.set_attribute(:request_id, conn.assigns.request_id)
|
||||
|
||||
with {:apns_env, apns_env} <- {:apns_env, get_apns_env(env)},
|
||||
{:encoding, ["aesgcm"]} <- {:encoding, get_req_header(conn, "content-encoding")},
|
||||
{:body, {:ok, body, conn}} <- {:body, read_body(conn)},
|
||||
|
|
|
@ -31,7 +31,7 @@ defmodule TuskerPushWeb.Endpoint do
|
|||
plug Phoenix.CodeReloader
|
||||
end
|
||||
|
||||
plug Plug.RequestId
|
||||
plug Plug.RequestId, assign_as: :request_id
|
||||
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
|
||||
|
||||
plug Plug.Parsers,
|
||||
|
|
Loading…
Reference in New Issue