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

Miscellaneous fixes - add more alerting for maintainpull, fix lag graph function #2263

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading