opentelemetry_bandit: fix errors due to missing fields
This commit is contained in:
parent
c2cb6bc86c
commit
5d4782c06b
|
@ -52,10 +52,10 @@ defmodule OpentelemetryBandit do
|
|||
if Map.has_key?(meta, :error) do
|
||||
%{
|
||||
Trace.http_url() => url,
|
||||
Trace.http_method() => meta.method,
|
||||
Trace.http_method() => conn.method,
|
||||
Trace.net_transport() => :"IP.TCP",
|
||||
Trace.http_response_content_length() => measurements.resp_body_bytes,
|
||||
Trace.http_status_code() => meta.status
|
||||
Trace.http_response_content_length() => Map.get(measurements, :resp_body_bytes),
|
||||
Trace.http_status_code() => conn.status
|
||||
}
|
||||
else
|
||||
%{
|
||||
|
@ -65,9 +65,9 @@ defmodule OpentelemetryBandit do
|
|||
Trace.net_peer_name() => conn.host,
|
||||
Trace.net_peer_port() => conn.port,
|
||||
Trace.http_target() => conn.request_path,
|
||||
Trace.http_method() => meta.method,
|
||||
Trace.http_status_code() => meta.status,
|
||||
Trace.http_response_content_length() => measurements.resp_body_bytes,
|
||||
Trace.http_method() => conn.method,
|
||||
Trace.http_status_code() => conn.status,
|
||||
Trace.http_response_content_length() => Map.get(measurements, :resp_body_bytes),
|
||||
Trace.net_transport() => :"IP.TCP",
|
||||
Trace.http_user_agent() => user_agent(conn)
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ defmodule OpentelemetryBandit do
|
|||
|
||||
span_kind = if Map.has_key?(meta, :error), do: :error, else: :server
|
||||
|
||||
span_id = "HTTP #{meta.method} #{request_path}" |> String.trim()
|
||||
span_id = "HTTP #{conn.method} #{request_path}" |> String.trim()
|
||||
|
||||
OpenTelemetry.Tracer.start_span(span_id, %{
|
||||
attributes: attributes,
|
||||
|
|
Loading…
Reference in New Issue