Skip to content

Commit

Permalink
fix: small UI issue and victoriametrics best efforts (#2747)
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored Dec 3, 2024
1 parent f810f54 commit 0f66534
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
7 changes: 3 additions & 4 deletions keep-ui/app/(keep)/alerts/alert-table-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ export const useAlertTableCols = (
columnHelper.accessor("status", {
id: "status",
header: "Status",
maxSize: 80,
size: 80,
maxSize: 100,
size: 100,
cell: (context) => (
<span className="flex items-center gap-1 capitalize">
<Icon
Expand All @@ -335,8 +335,7 @@ export const useAlertTableCols = (
id: "lastReceived",
header: "Last Received",
filterFn: isDateWithinRange,
maxSize: 80,
size: 80,
minSize: 100,
cell: (context) => (
<span title={context.getValue().toISOString()}>
{getAlertLastReceieved(context.getValue())}
Expand Down
6 changes: 1 addition & 5 deletions keep/providers/teams_provider/teams_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,7 @@ def _notify(
)

self.logger.debug("Alert message notified to Teams")
try:
return response.json()
except requests.exceptions.JSONDecodeError as e:
self.logger.error(f"Failed to decode response from Teams: {response.text}")
raise ProviderException("Response from Teams is invalid") from e
return {"response_text": response.text}


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class VictoriametricsProviderAuthConfig:
default=8880,
)

VMAlertURL: AnyHttpUrl | None = dataclasses.field(
VMAlertURL: AnyHttpUrl | None = dataclasses.field(
metadata={
"required": False,
"description": "The full URL to the VMAlert instance. For example: http://vmalert.mydomain.com:8880",
Expand Down Expand Up @@ -195,21 +195,24 @@ def _format_alert(
) -> AlertDto | list[AlertDto]:
alerts = []
for alert in event["alerts"]:
annotations = alert.get("annotations", {})
labels = alert.get("labels", {})
fingerprint = alert.get("fingerprint")
alerts.append(
AlertDto(
name=alert["labels"]["alertname"],
fingerprint=alert["fingerprint"],
id=alert["fingerprint"],
description=alert["annotations"]["description"],
message=alert["annotations"]["summary"],
name=labels.get("alertname", ""),
fingerprint=fingerprint,
id=fingerprint,
description=annotations.get("description"),
message=annotations.get("summary"),
status=VictoriametricsProvider.STATUS_MAP[alert["status"]],
severity=VictoriametricsProvider.SEVERITIES_MAP[
alert.get("labels", {}).get("severity", "info")
],
startedAt=alert["startsAt"],
url=alert["generatorURL"],
startedAt=alert.get("startsAt"),
url=alert.get("generatorURL"),
source=["victoriametrics"],
labels=alert["labels"],
labels=labels,
lastReceived=datetime.datetime.now(
tz=datetime.timezone.utc
).isoformat(),
Expand Down

0 comments on commit 0f66534

Please sign in to comment.