Skip to content

Commit 973aa2d

Browse files
authored
feat: Use prefixed WAL storage path in Object Storage (#13377)
1 parent 33bd390 commit 973aa2d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ require (
7575
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
7676
github.com/ncw/swift v1.0.53
7777
github.com/oklog/run v1.1.0
78-
github.com/oklog/ulid v1.3.1 // indirect
78+
github.com/oklog/ulid v1.3.1
7979
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e
8080
github.com/opentracing-contrib/go-stdlib v1.0.0
8181
github.com/opentracing/opentracing-go v1.2.0

‎pkg/storage/chunk/client/object_client.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ package client
33
import (
44
"bytes"
55
"context"
6+
"crypto/rand"
67
"encoding/base64"
78
"io"
89
"strings"
910
"time"
1011

12+
"github.com/oklog/ulid"
1113
"github.com/pkg/errors"
1214

1315
"github.com/grafana/loki/v3/pkg/storage/chunk"
@@ -114,7 +116,9 @@ func (o *client) PutWal(ctx context.Context, segment *wal.SegmentWriter) error {
114116
defer func(reader io.ReadSeekCloser) {
115117
_ = reader.Close()
116118
}(reader)
117-
return o.store.PutObject(ctx, "wal-segment-"+time.Now().UTC().Format(time.RFC3339Nano), reader)
119+
120+
newUlid := ulid.MustNew(ulid.Timestamp(time.Now()), rand.Reader)
121+
return o.store.PutObject(ctx, "loki-v2/wal/anon/"+newUlid.String(), reader)
118122
}
119123

120124
// PutChunks stores the provided chunks in the configured backend. If multiple errors are

0 commit comments

Comments
 (0)