Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support client reports #783

Closed
stephanie-anderson opened this issue Sep 4, 2024 · 2 comments
Closed

Support client reports #783

stephanie-anderson opened this issue Sep 4, 2024 · 2 comments
Assignees

Comments

@stephanie-anderson
Copy link
Contributor

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

@savhappy savhappy self-assigned this Sep 6, 2024
@whatyouhide
Copy link
Collaborator

whatyouhide commented Sep 24, 2024

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_report in Sentry.Envelope, propagates to Sentry.Envelope.item_to_binary/2 helper 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

@whatyouhide
Copy link
Collaborator

Closed in #801, thanks @savhappy 💟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants