| 1 | package Sentry::Envelope; | ||
| 2 | use Mojo::Base -base, -signatures; | ||
| 3 | |||
| 4 | use Mojo::JSON qw(encode_json); | ||
| 5 | |||
| 6 | has event_id => undef; | ||
| 7 | has headers => sub ($self) { { event_id => $self->event_id } }; | ||
| 8 | has body => sub { {} }; | ||
| 9 | has sample_rates => sub { [{ id => "client_rate", rate => "1" }] }; # FIXME | ||
| 10 | has type => 'transaction'; | ||
| 11 | has item_headers => | ||
| 12 | sub ($self) { { type => $self->type, sample_rates => $self->sample_rates } }; | ||
| 13 | |||
| 14 | sub serialize ($self) { | ||
| 15 | my @lines = ($self->headers, $self->item_headers, $self->body); | ||
| 16 | return join("\n", map { encode_json($_) } @lines); | ||
| 17 | } | ||
| 18 | |||
| 19 | 1; |