Closed stephanie-anderson closed 1 month ago
Just talked strategy with @savhappy, notes:
:send_client_reports
)Sentry.Envelope.from_client_report/1
type: :client_report
in Sentry.Envelope
, propagates to Sentry.Envelope.item_to_binary/2
helper functionA client report should be a struct typed as:
@type client_report() :: %Sentry.ClientReport{
timestamp: timestamp(),
discarded_events: %{
optional({type :: atom(), reason :: atom()}) => pos_integer()
}
}
# Example:
%ClientReport{
timestamp: ...,
discarded_events: %{
{"error", "rate_limiting"} => 3,
{"transaction", "queue_overflow"} => 324,
{"error", "queue_overflow"} => 1
}
}
We don't have {type, reason}
tuples in there if the count is 0
, which is why it's pos_integer()
. We can just add them on the fly:
def add_discarded_event(client_report, type, reason) do
Map.update(client_report.discarded_events, {type, reason}, 1, &(&1 + 1))
end
Closed in #801, thanks @savhappy 💟
Support https://develop.sentry.dev/sdk/client-reports/
If tracing is supported by the time this issue is handled, we would also want to report dropped spans: https://github.com/getsentry/projects/issues/70