Skip to content

Commit

Permalink
chore: linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iamKunalGupta committed Mar 1, 2024
1 parent 209f47f commit 6463891
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions flow/activities/snapshot_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (a *SnapshotActivity) CloseSlotKeepAlive(ctx context.Context, flowJobName s
connectors.CloseConnector(ctx, s.connector)
delete(a.SnapshotConnections, flowJobName)
}
a.Alerter.LogFlowEvent(ctx, flowJobName, fmt.Sprintf("Ended Snapshot Flow Job - %s", flowJobName))
a.Alerter.LogFlowEvent(ctx, flowJobName, "Ended Snapshot Flow Job - "+flowJobName)

return nil
}
Expand All @@ -50,7 +50,7 @@ func (a *SnapshotActivity) SetupReplication(
return nil, nil
}

a.Alerter.LogFlowEvent(ctx, config.FlowJobName, fmt.Sprintf("Started Snapshot Flow Job - %s", config.FlowJobName))
a.Alerter.LogFlowEvent(ctx, config.FlowJobName, "Started Snapshot Flow Job - "+config.FlowJobName)

conn, err := connectors.GetCDCPullConnector(ctx, config.PeerConnectionConfig)
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions flow/shared/alerting/alerting.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/PeerDB-io/peer-flow/shared/telemetry"
"log/slog"
"os"
"time"
Expand All @@ -17,6 +16,7 @@ import (
"github.com/PeerDB-io/peer-flow/generated/protos"
"github.com/PeerDB-io/peer-flow/logger"
"github.com/PeerDB-io/peer-flow/peerdbenv"
"github.com/PeerDB-io/peer-flow/shared/telemetry"
)

// alerting service, no cool name :(
Expand Down Expand Up @@ -249,7 +249,4 @@ func (a *Alerter) LogFlowInfo(ctx context.Context, flowName string, info string)
logger.LoggerFromCtx(ctx).Warn("failed to insert flow info", slog.Any("error", err))
return
}
// TODO Maybe too much noise here
//a.sendTelemetryMessage(ctx, flowName, info, INFO)

}
6 changes: 3 additions & 3 deletions flow/shared/telemetry/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Level string

const (
INFO Level = "INFO"
WARN = "WARN"
ERROR = "ERROR"
CRITICAL = "CRITICAL"
WARN Level = "WARN"
ERROR Level = "ERROR"
CRITICAL Level = "CRITICAL"
)
15 changes: 8 additions & 7 deletions flow/shared/telemetry/sns_message_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package telemetry

import (
"context"
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/sns"
"github.com/aws/aws-sdk-go-v2/service/sns/types"
"strings"
)

type SNSMessageSender interface {
Expand All @@ -22,8 +23,8 @@ type SNSMessageSenderConfig struct {
Topic string `json:"topic"`
}

func (S *SNSMessageSenderImpl) SendMessage(ctx context.Context, subject string, body string, attributes Attributes) (*string, error) {
publish, err := S.client.Publish(ctx, &sns.PublishInput{
func (s *SNSMessageSenderImpl) SendMessage(ctx context.Context, subject string, body string, attributes Attributes) (*string, error) {
publish, err := s.client.Publish(ctx, &sns.PublishInput{
Message: aws.String(body),
MessageAttributes: map[string]types.MessageAttributeValue{
"level": {
Expand All @@ -36,19 +37,19 @@ func (S *SNSMessageSenderImpl) SendMessage(ctx context.Context, subject string,
},
"deploymentUUID": {
DataType: aws.String("String"),
StringValue: aws.String(string(attributes.DeploymentUID)),
StringValue: aws.String(attributes.DeploymentUID),
},
"entity": {
DataType: aws.String("String"),
StringValue: aws.String(string(attributes.DeploymentUID)),
StringValue: aws.String(attributes.DeploymentUID),
},
"type": {
DataType: aws.String("String"),
StringValue: aws.String(string(attributes.Type)),
StringValue: aws.String(attributes.Type),
},
},
Subject: aws.String(subject),
TopicArn: aws.String(S.topic),
TopicArn: aws.String(s.topic),
})
if err != nil {
return nil, err
Expand Down

0 comments on commit 6463891

Please sign in to comment.