Skip to content

Commit

Permalink
fix(issue summary) Make breadcrumb fields optional to prevent validat…
Browse files Browse the repository at this point in the history
…ion errors (#1111)

Some issues don't have all the breadcrumbs fields, so we make them
optional now.
  • Loading branch information
roaga committed Sep 4, 2024
1 parent 4915fa5 commit 7986fce
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/seer/automation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ def validate_stacktrace(cls, sentry_stacktrace: SentryStacktrace | Stacktrace |


class BreadcrumbsDetails(BaseModel):
type: str
type: Optional[str] = None
message: Optional[str] = None
category: str
category: Optional[str] = None
data: Optional[dict] = None
level: str
level: Optional[str] = None


class EventDetails(BaseModel):
Expand Down Expand Up @@ -419,13 +419,15 @@ def format_breadcrumbs(self):
return "\n".join(
textwrap.dedent(
"""\
<event_log_{i} type="{breadcrumb_type}" category="{breadcrumb_category}" level="{level}">
<event_log_{i}{breadcrumb_type}{breadcrumb_category}{level}>
{content}
</event_log_{i}>"""
).format(
i=i,
breadcrumb_type=breadcrumb.type,
breadcrumb_category=breadcrumb.category,
breadcrumb_type=f' type="{breadcrumb.type}"' if breadcrumb.type else "",
breadcrumb_category=(
f' category="{breadcrumb.category}"' if breadcrumb.category else ""
),
content="\n".join(
filter(
None,
Expand All @@ -439,7 +441,7 @@ def format_breadcrumbs(self):
],
)
),
level=breadcrumb.level,
level=f' level="{breadcrumb.level}"' if breadcrumb.level else "",
)
for i, breadcrumb in enumerate(self.breadcrumbs)
)
Expand Down

0 comments on commit 7986fce

Please sign in to comment.