Skip to content

Commit 4fa4df6

Browse files
committed
improving some logs
Signed-off-by: alanprot <[email protected]>
1 parent 46e3114 commit 4fa4df6

File tree

7 files changed

+23
-120
lines changed

7 files changed

+23
-120
lines changed

go.sum

+1-1
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ
15341534
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
15351535
github.com/opentracing-contrib/go-grpc v0.1.0 h1:9JHDtQXv6UL0tFF8KJB/4ApJgeOcaHp1h07d0PJjESc=
15361536
github.com/opentracing-contrib/go-grpc v0.1.0/go.mod h1:i3/jx/TvJZ/HKidtT4XGIi/NosUEpzS9xjVJctbKZzI=
1537-
github.com/opentracing-contrib/go-stdlib v1.1.0 h1:hSJ8yYaiAO/k2YZUeWJWpQCPE2wRCDtxRnir0gU6wbA=
1537+
github.com/opentracing-contrib/go-stdlib v1.1.0 h1:cZBWc4pA4e65tqTJddbflK435S0tDImj6c9BMvkdUH0=
15381538
github.com/opentracing-contrib/go-stdlib v1.1.0/go.mod h1:S0p+X9p6dcBkoMTL+Qq2VOvxKs9ys5PpYWXWqlCS0bQ=
15391539
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
15401540
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=

pkg/parquetconverter/converter.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,16 @@ func (c *Converter) running(ctx context.Context) error {
179179

180180
owned, err := c.ownUser(ring, userID)
181181
if err != nil {
182-
level.Error(userLogger).Log("msg", "failed to check if user is owned by the user", "user", userID, "err", err)
182+
level.Error(userLogger).Log("msg", "failed to check if user is owned by the user", "err", err)
183183
continue
184184
}
185185
if !owned {
186-
level.Info(userLogger).Log("msg", "user not owned", "user", userID)
187186
continue
188187
}
189-
level.Info(userLogger).Log("msg", "scanned user", "user", userID)
190188

191189
err = c.convertUser(ctx, userLogger, ring, userID)
192190
if err != nil {
193-
level.Error(userLogger).Log("msg", "failed to convert user", "user", userID, "err", err)
191+
level.Error(userLogger).Log("msg", "failed to convert user", "err", err)
194192
}
195193
}
196194
}
@@ -217,6 +215,8 @@ func (c *Converter) discoverUsers(ctx context.Context) ([]string, error) {
217215
}
218216

219217
func (c *Converter) convertUser(ctx context.Context, logger log.Logger, ring ring.ReadRing, userID string) error {
218+
level.Info(logger).Log("msg", "start converting user")
219+
220220
uBucket := bucket.NewUserBucketClient(userID, c.bkt, c.limits)
221221

222222
var blockLister block.Lister
@@ -290,6 +290,7 @@ func (c *Converter) convertUser(ctx context.Context, logger log.Logger, ring rin
290290

291291
if err := os.RemoveAll(c.compactRootDir()); err != nil {
292292
level.Error(logger).Log("msg", "failed to remove work directory", "path", c.compactRootDir(), "err", err)
293+
continue
293294
}
294295

295296
bdir := filepath.Join(c.compactDirForUser(userID), b.ULID.String())

pkg/parquetconverter/converter_ring.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import (
55
"os"
66
"time"
77

8-
"github.com/cortexproject/cortex/pkg/ring"
9-
"github.com/cortexproject/cortex/pkg/util/flagext"
10-
util_log "github.com/cortexproject/cortex/pkg/util/log"
118
"github.com/go-kit/log/level"
129

10+
"github.com/cortexproject/cortex/pkg/ring"
1311
"github.com/cortexproject/cortex/pkg/ring/kv"
12+
"github.com/cortexproject/cortex/pkg/util/flagext"
13+
util_log "github.com/cortexproject/cortex/pkg/util/log"
1414
)
1515

1616
type RingConfig struct {

pkg/parquetconverter/converter_test.go

+13-11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ import (
77
"testing"
88
"time"
99

10+
"github.com/go-kit/log"
11+
"github.com/oklog/ulid"
12+
"github.com/prometheus/client_golang/prometheus"
13+
"github.com/prometheus/prometheus/model/labels"
14+
"github.com/prometheus/prometheus/tsdb"
15+
"github.com/stretchr/testify/assert"
16+
"github.com/stretchr/testify/require"
17+
"github.com/thanos-io/objstore"
18+
"github.com/thanos-io/thanos/pkg/block"
19+
"github.com/thanos-io/thanos/pkg/block/metadata"
20+
1021
"github.com/cortexproject/cortex/integration/e2e"
1122
"github.com/cortexproject/cortex/pkg/ring"
1223
"github.com/cortexproject/cortex/pkg/ring/kv/consul"
@@ -18,16 +29,6 @@ import (
1829
"github.com/cortexproject/cortex/pkg/util/services"
1930
"github.com/cortexproject/cortex/pkg/util/test"
2031
"github.com/cortexproject/cortex/pkg/util/validation"
21-
"github.com/go-kit/log"
22-
"github.com/oklog/ulid"
23-
"github.com/prometheus/client_golang/prometheus"
24-
"github.com/prometheus/prometheus/model/labels"
25-
"github.com/prometheus/prometheus/tsdb"
26-
"github.com/stretchr/testify/assert"
27-
"github.com/stretchr/testify/require"
28-
"github.com/thanos-io/objstore"
29-
"github.com/thanos-io/thanos/pkg/block"
30-
"github.com/thanos-io/thanos/pkg/block/metadata"
3132
)
3233

3334
func TestConverter(t *testing.T) {
@@ -37,7 +38,7 @@ func TestConverter(t *testing.T) {
3738
t.Cleanup(func() { assert.NoError(t, closer.Close()) })
3839
dir := t.TempDir()
3940

40-
cfg.Ring.InstanceID = "compactor-1"
41+
cfg.Ring.InstanceID = "parquet-converter-1"
4142
cfg.Ring.InstanceAddr = "1.2.3.4"
4243
cfg.Ring.KVStore.Mock = ringStore
4344
bucketClient := objstore.NewInMemBucket()
@@ -73,6 +74,7 @@ func TestConverter(t *testing.T) {
7374
// Try to start the compactor with a bad consul kv-store. The
7475
err := services.StartAndAwaitRunning(context.Background(), c)
7576
require.NoError(t, err)
77+
defer services.StopAndAwaitTerminated(ctx, c) // nolint:errcheck
7678

7779
blocksConverted := []ulid.ULID{}
7880

pkg/storage/tsdb/bucketindex/markers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package bucketindex
33
import (
44
"context"
55
"fmt"
6-
"github.com/cortexproject/cortex/pkg/storage/parquet"
76
"path"
87
"path/filepath"
98
"strings"
@@ -16,6 +15,7 @@ import (
1615
"github.com/thanos-io/thanos/pkg/block/metadata"
1716

1817
"github.com/cortexproject/cortex/pkg/storage/bucket"
18+
"github.com/cortexproject/cortex/pkg/storage/parquet"
1919
)
2020

2121
const (

vendor/github.com/prometheus/prometheus/util/teststorage/storage.go

-99
This file was deleted.

vendor/modules.txt

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)