Skip to content

Commit ffcd41b

Browse files
committed
refactor: rename internal module to avoid conflict with aws sdk cloudwatchlogs -> cwlogs
1 parent 9b04317 commit ffcd41b

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

cmd/cli/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/aws/aws-sdk-go-v2/config"
1111

1212
"github.com/batovpasha/aws-cw-log-sampler/internal/cli"
13-
"github.com/batovpasha/aws-cw-log-sampler/internal/cloudwatchlogs"
13+
"github.com/batovpasha/aws-cw-log-sampler/internal/cwlogs"
1414
"github.com/batovpasha/aws-cw-log-sampler/internal/logger"
1515
"github.com/batovpasha/aws-cw-log-sampler/internal/sample"
1616
)
@@ -38,7 +38,7 @@ func main() {
3838
fmt.Fprintln(os.Stderr, err)
3939
os.Exit(1)
4040
}
41-
client := cloudwatchlogs.NewFromConfig(cfg)
41+
client := cwlogs.NewFromConfig(cfg)
4242

4343
cutoff := time.Now().Add(-time.Duration(*lookbackHours) * time.Hour).UnixMilli()
4444

cmd/service/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/robfig/cron/v3"
1515

1616
"github.com/batovpasha/aws-cw-log-sampler/internal/cli"
17-
"github.com/batovpasha/aws-cw-log-sampler/internal/cloudwatchlogs"
17+
"github.com/batovpasha/aws-cw-log-sampler/internal/cwlogs"
1818
"github.com/batovpasha/aws-cw-log-sampler/internal/logger"
1919
"github.com/batovpasha/aws-cw-log-sampler/internal/sample"
2020
)
@@ -49,7 +49,7 @@ func main() {
4949
fmt.Fprintln(os.Stderr, err)
5050
os.Exit(1)
5151
}
52-
client := cloudwatchlogs.NewFromConfig(cfg)
52+
client := cwlogs.NewFromConfig(cfg)
5353

5454
now := time.Now()
5555
next1 := sched.Next(now)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cloudwatchlogs
1+
package cwlogs
22

33
import (
44
"context"

internal/sample/rand_log_streams.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
1313
"golang.org/x/sync/errgroup"
1414

15-
"github.com/batovpasha/aws-cw-log-sampler/internal/cloudwatchlogs"
15+
"github.com/batovpasha/aws-cw-log-sampler/internal/cwlogs"
1616
)
1717

1818
// GetLogEvents has the lowest TPS - 10, and it's a bottleneck.
@@ -21,7 +21,7 @@ const concurrencyLimit = 10
2121

2222
func SampleByRandLogStreams(
2323
ctx context.Context,
24-
client *cloudwatchlogs.Client,
24+
client *cwlogs.Client,
2525
cutoff int64,
2626
srcGroups []string,
2727
dstGroup string,
@@ -50,12 +50,12 @@ func SampleByRandLogStreams(
5050

5151
func processLogGroup(
5252
ctx context.Context,
53-
client *cloudwatchlogs.Client,
53+
client *cwlogs.Client,
5454
cutoff int64,
5555
srcGroup, dstGroup string,
5656
randLogStreamsNumber int,
5757
) (processed int64, err error) {
58-
allStreams, err := cloudwatchlogs.DescribeLogStreamsUntilCutoff(ctx, client, srcGroup, cutoff)
58+
allStreams, err := cwlogs.DescribeLogStreamsUntilCutoff(ctx, client, srcGroup, cutoff)
5959
if err != nil {
6060
return processed, fmt.Errorf("describe log streams: %w", err)
6161
}
@@ -82,7 +82,7 @@ func processLogGroup(
8282
)
8383

8484
slog.InfoContext(ctx, "copy log streams", "src_stream", srcStreamName, "dst_stream", dstStreamName)
85-
err = cloudwatchlogs.CopyLogStream(
85+
err = cwlogs.CopyLogStream(
8686
ctx,
8787
client,
8888
srcGroup,

internal/sample/sample.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"log/slog"
77

8-
"github.com/batovpasha/aws-cw-log-sampler/internal/cloudwatchlogs"
8+
"github.com/batovpasha/aws-cw-log-sampler/internal/cwlogs"
99
)
1010

1111
type Config struct {
@@ -22,8 +22,8 @@ const (
2222
TypeRandLogStreams = "rand-log-streams"
2323
)
2424

25-
func Sample(ctx context.Context, client *cloudwatchlogs.Client, cfg *Config) error {
26-
srcGroups, err := cloudwatchlogs.ListLogGroupNames(ctx, client, cfg.LogGroupNamePattern)
25+
func Sample(ctx context.Context, client *cwlogs.Client, cfg *Config) error {
26+
srcGroups, err := cwlogs.ListLogGroupNames(ctx, client, cfg.LogGroupNamePattern)
2727
if err != nil {
2828
return fmt.Errorf("list log groups: %w", err)
2929
}

0 commit comments

Comments
 (0)