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

feat: Use prefixed WAL storage path in Object Storage #13377

Merged
merged 4 commits into from
Jul 3, 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: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ require (
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
github.com/ncw/swift v1.0.53
github.com/oklog/run v1.1.0
github.com/oklog/ulid v1.3.1 // indirect
github.com/oklog/ulid v1.3.1
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e
github.com/opentracing-contrib/go-stdlib v1.0.0
github.com/opentracing/opentracing-go v1.2.0
Expand Down
6 changes: 5 additions & 1 deletion pkg/storage/chunk/client/object_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package client
import (
"bytes"
"context"
"crypto/rand"
"encoding/base64"
"io"
"strings"
"time"

"github.com/oklog/ulid"
"github.com/pkg/errors"

"github.com/grafana/loki/v3/pkg/storage/chunk"
Expand Down Expand Up @@ -114,7 +116,9 @@ func (o *client) PutWal(ctx context.Context, segment *wal.SegmentWriter) error {
defer func(reader io.ReadSeekCloser) {
_ = reader.Close()
}(reader)
return o.store.PutObject(ctx, "wal-segment-"+time.Now().UTC().Format(time.RFC3339Nano), reader)

newUlid := ulid.MustNew(ulid.Timestamp(time.Now()), rand.Reader)
return o.store.PutObject(ctx, "loki-v2/wal/anon/"+newUlid.String(), reader)
}

// PutChunks stores the provided chunks in the configured backend. If multiple errors are
Expand Down
Loading