sentry-elixir
sentry-elixir copied to clipboard
Support client reports
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
Just talked strategy with @savhappy, notes:
- Send client reports every 30 seconds (if enabled)
- Support an option to have client reports on/off (
:send_client_reports) - (Probably) add
Sentry.Envelope.from_client_report/1 - Support
type: :client_reportinSentry.Envelope, propagates toSentry.Envelope.item_to_binary/2helper function
A 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 💟