-
Notifications
You must be signed in to change notification settings - Fork 535
apache_beam + beam integration not sending exceptions in GCP #4203
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
Comments
Hey @gshoultz42 ! What you also can do:
Hope this helps |
I just fed your question into our bot in our discord server, and it has these suggestions: https://discord.com/channels/621778831602221064/1354782809020960779/1354782809020960779 (its not super helpful I have to admit, but it is a nice experiment) |
Sentry Init sentry_sdk.init(
dsn=sentry_dsn,
environment=env,
integrations=[BeamIntegration()],
) Exception call class ParseEvent(beam.DoFn):
def process(self, element: bytes, *args, **kwargs):
try:
event_json = json.loads(element)
event_name = event_json["message"]["payload"]["eventName"]
model = get_model(event_name)
event = model.model_validate_json(element)
yield event
except (ValidationError, KeyError, JSONDecodeError, TypeError) as error:
logging.exception("Error parsing event: %r", element)
error_output = {
"error": repr(error),
"payload": (
event_json
if not isinstance(error, JSONDecodeError)
else element.decode()
),
}
yield TaggedOutput("parse_errors", json.dumps(error_output).encode()) |
Thanks for the follow up! The line logging.exception("Error parsing event: %r", element) should send an error if the logging integration is enabled (which the sentry SDK enables by default.) If you want to have your Because you handle the exception yourself, it never bubbles up for Sentry to capture it. You could also add a simple |
Wanted to provide an update. I am still looking into this. I added debug to sentry but did not get the log. Working with our admin to make sure the logging is setup correctly in our GCP |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.23.1
Steps to Reproduce
Expected Result
Error exception is sent to Sentry
Actual Result
Sentry does not get an exception.
The text was updated successfully, but these errors were encountered: