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(temporal): Added posthog client to temporal to enable exceptions capture #26583

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Gilbert09
Copy link
Member

Problem

  • I wanna get exceptions from temporal workers into PostHog error tracking product

Changes

  • Add an interceptor to init the PostHog Client and enable exception auto-capture
  • Boilerplate code is taken from the Sentry interceptor


workflow_result = await super().execute_workflow(input)

ph_client.flush()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this call blocking? Should we send it to a thread with asyncio.to_thread?


class _PostHogClientWorkflowInterceptor(WorkflowInboundInterceptor):
async def execute_workflow(self, input: ExecuteWorkflowInput) -> Any:
ph_client = Client(api_key="sTMFPsFhdP1Ssg", enable_exception_autocapture=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, is this api key public?

async def execute_workflow(self, input: ExecuteWorkflowInput) -> Any:
ph_client = Client(api_key="sTMFPsFhdP1Ssg", enable_exception_autocapture=True)

workflow_result = await super().execute_workflow(input)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we wrap this call in a try, except? Otherwise we won't be calling ph_client.flush() if anything is raised.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

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

Successfully merging this pull request may close these issues.

4 participants