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