Skip to content

Commit

Permalink
Miscellaneous fixes - add more alerting for maintainpull, fix lag gra…
Browse files Browse the repository at this point in the history
…ph function (#2263)

- Account for NaN values in LSN function
- Add alerts for failure to get postgres connector in maintainpull 
- Fix <= sign in slack alert log

---------

Co-authored-by: Kevin Biju <[email protected]>
  • Loading branch information
Amogh-Bharadwaj and heavycrystal authored Nov 21, 2024
1 parent 3facb2d commit 136a283
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,13 @@ func (a *FlowableActivity) MaintainPull(
ctx = context.WithValue(ctx, shared.FlowNameKey, config.FlowJobName)
srcConn, err := connectors.GetByNameAs[connectors.CDCPullConnector](ctx, config.Env, a.CatalogPool, config.SourceName)
if err != nil {
a.Alerter.LogFlowError(ctx, config.FlowJobName, err)
return err
}
defer connectors.CloseConnector(ctx, srcConn)

if err := srcConn.SetupReplConn(ctx); err != nil {
a.Alerter.LogFlowError(ctx, config.FlowJobName, err)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion flow/alerting/alerting.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (a *Alerter) checkAndAddAlertToCatalog(ctx context.Context, alertConfigId i
return true
}

logger.Info(fmt.Sprintf("Skipped sending alerts: last alert was sent at %s, which was >=%s ago", createdTimestamp.String(), dur.String()))
logger.Info(fmt.Sprintf("Skipped sending alerts: last alert was sent at %s, which was <=%s ago", createdTimestamp.String(), dur.String()))
return false
}

Expand Down
7 changes: 4 additions & 3 deletions ui/app/peers/[peerName]/lagGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ type LagGraphProps = {
function parseLSN(lsn: string): number {
if (!lsn) return 0;
const [lsn1, lsn2] = lsn.split('/');
return Number(
(BigInt(parseInt(lsn1, 16)) << BigInt(32)) | BigInt(parseInt(lsn2, 16))
);
const parsedLsn1 = parseInt(lsn1, 16);
const parsedLsn2 = parseInt(lsn2, 16);
if (isNaN(parsedLsn1) || isNaN(parsedLsn2)) return 0;
return Number((BigInt(parsedLsn1) << BigInt(32)) | BigInt(parsedLsn2));
}

export default function LagGraph({ peerName }: LagGraphProps) {
Expand Down

0 comments on commit 136a283

Please sign in to comment.