Skip to content

Support for transactions#842

Merged
whatyouhide merged 19 commits into
masterfrom
solnic/support-for-transactions
Jan 26, 2025
Merged

Support for transactions#842
whatyouhide merged 19 commits into
masterfrom
solnic/support-for-transactions

Conversation

@solnic

@solnic solnic commented Dec 27, 2024

Copy link
Copy Markdown
Collaborator

This was extracted from #784

@solnic solnic force-pushed the solnic/support-for-transactions branch from db95d53 to 78c75f0 Compare December 27, 2024 12:45
@solnic solnic force-pushed the solnic/support-for-transactions branch from 795d4b4 to 11d2662 Compare December 27, 2024 13:57
@solnic solnic marked this pull request as ready for review December 27, 2024 13:57
@solnic solnic requested a review from whatyouhide December 27, 2024 13:57

@whatyouhide whatyouhide left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of comments, sorry 😄

Comment thread lib/sentry/envelope.ex Outdated
Comment thread lib/sentry/envelope.ex Outdated
Comment thread lib/sentry/envelope.ex Outdated
Comment thread lib/sentry/options.ex Outdated
Comment thread lib/sentry/options.ex Outdated
@moduledoc false

@send_event_opts_schema_as_keyword [
@common_opts_schema_as_keyword [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link to the docs that say that sample rate and before_send callbacks don't applly to transactions?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@solnic this is still pending.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whatyouhide sorry but link to what docs? Are you asking to write these docs and link to them?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I’m asking where you found the information that sample_rate and before_send callbacks don't apply to transactions. As in, docs on the Sentry website that I can go read 😄

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whatyouhide oh, so I just didn't initially add support for these options. Transaction sampling is a thing in Sentry, so we should support it; and for consistency and feature-completion we should also support callbacks.

I just added support for all three options. One thing we might want to consider is deprecating after_send_event in favor of after_send though.

Comment thread lib/sentry/transaction.ex Outdated
Comment thread lib/sentry/transaction.ex Outdated
Comment thread lib/sentry/transaction.ex
Comment thread lib/sentry/transaction.ex Outdated
Comment thread lib/sentry/transaction.ex Outdated
@solnic solnic force-pushed the solnic/support-for-transactions branch 2 times, most recently from 649a6be to ef59c6f Compare January 7, 2025 14:23
@solnic solnic requested a review from whatyouhide January 7, 2025 14:35

@whatyouhide whatyouhide left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more comments.

Comment thread lib/sentry/transaction.ex Outdated
Comment thread lib/sentry/transaction.ex
data: map(),

# Interfaces
spans: [Span.t()],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A transaction without spans is ok?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whatyouhide yes! the only really required piece of span information is meant to go to context.trace which is why I defined it as a required map in the type spec. spans list is only needed when you have child spans, and that's not always the case.

Comment thread lib/sentry/client.ex
Comment on lines +289 to +303
|> Map.merge(%{
platform: "elixir",
sdk: %{
name: "sentry.elixir",
version: Application.spec(:sentry, :vsn)
}
})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on why this is necessary?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whatyouhide I just followed what we do for events, and since a transaction is an event + span info, then I thought it's a good idea to add platform and sdk information too. I'm not sure if it's strictly required though - I'll double check it.

@solnic solnic force-pushed the solnic/support-for-transactions branch from cbf325f to 97d2349 Compare January 22, 2025 13:25
@solnic solnic requested a review from whatyouhide January 22, 2025 13:25
@whatyouhide whatyouhide merged commit c5dd1fc into master Jan 26, 2025
@whatyouhide whatyouhide deleted the solnic/support-for-transactions branch January 26, 2025 09:11
@solnic solnic mentioned this pull request Jan 27, 2025
6 tasks
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

Successfully merging this pull request may close these issues.

2 participants