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

feat: add support for email triggers #174

Merged

Conversation

Schniz
Copy link
Contributor

@Schniz Schniz commented Sep 30, 2024

What this PR solves / how to test:

Ain't much but it's honest work ;D
This PR adds support for email handlers in Cloudflare Workers:

export default {
  async email(message, env, ctx) {
    // this is running in a trace!
  },
};

This PR does not instrument email.reply etc. It's out of scope of this PR. It's only for creating a span/trace for receiving the emails.

Added support for email triggers. The `createEmailHandler` function is used to create an email handler that can be used to instrument email triggers. The `isEmailMessage` function is used to check if a trigger is an email message. The `instrument` function has been updated to support email handlers.

Marked `cloudflare:email` as external
@jahands
Copy link
Collaborator

jahands commented Sep 30, 2024

SO excited for this!!

@evanderkoogh
Copy link
Owner

Oh this is great! And I have completely missed it.. Thanks Github for letting me know!

I'll try to get this merged over the next couple of days.. cheers!

@evanderkoogh evanderkoogh merged commit 0f2b9c6 into evanderkoogh:main Dec 2, 2024
1 check passed
@evanderkoogh
Copy link
Owner

I am so sorry it took so long to get around to this, but I have merged it :)

Thanks for this.. and never let perfection stand in the way of making progress.. in this case, email.reply is an entirely different can of worms. Just getting a span for an email coming in is already infinitely better than not having any spans :)

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.

3 participants