Skip to content

Commit 9f18c3a

Browse files
committed
pr comments
1 parent ba8022f commit 9f18c3a

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

‎cmd/profilecli/output.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ import (
44
"encoding/json"
55
"os"
66

7-
"github.com/grafana/pyroscope/api/gen/proto/go/types/v1"
7+
typesv1 "github.com/grafana/pyroscope/api/gen/proto/go/types/v1"
88
)
99

1010
func outputSeries(result []*typesv1.Labels) error {
1111
enc := json.NewEncoder(os.Stdout)
1212
m := make(map[string]interface{})
1313
for _, s := range result {
14-
for k := range m {
15-
delete(m, k)
16-
}
14+
clear(m)
1715
for _, l := range s.Labels {
1816
m[l.Name] = l.Value
1917
}

‎cmd/profilecli/query-blocks.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type queryBlocksParams struct {
2121
LocalPath string
2222
BucketName string
2323
BlockIds []string
24-
TenanId string
24+
TenantID string
2525
ObjectStoreType string
2626
Query string
2727
}
@@ -37,7 +37,7 @@ func addQueryBlocksParams(queryCmd commander) *queryBlocksParams {
3737
queryCmd.Flag("bucket-name", "The name of the object storage bucket.").StringVar(&params.BucketName)
3838
queryCmd.Flag("object-store-type", "The type of the object storage (e.g., gcs).").Default("gcs").StringVar(&params.ObjectStoreType)
3939
queryCmd.Flag("block-ids", "List of blocks ids to query on").StringsVar(&params.BlockIds)
40-
queryCmd.Flag("tenant-id", "Tenant id of the queried block for remote bucket").StringVar(&params.TenanId)
40+
queryCmd.Flag("tenant-id", "Tenant id of the queried block for remote bucket").StringVar(&params.TenantID)
4141
queryCmd.Flag("query", "Label selector to query.").Default("{}").StringVar(&params.Query)
4242
return params
4343
}
@@ -51,7 +51,7 @@ func addQueryBlocksSeriesParams(queryCmd commander) *queryBlocksSeriesParams {
5151

5252
func queryBlocksSeries(ctx context.Context, params *queryBlocksSeriesParams) error {
5353
level.Info(logger).Log("msg", "query-block series", "labelNames", fmt.Sprintf("%v", params.LabelNames),
54-
"blockIds", fmt.Sprintf("%v", params.BlockIds), "localPath", params.LocalPath, "bucketName", params.BucketName, "tenantId", params.TenanId)
54+
"blockIds", fmt.Sprintf("%v", params.BlockIds), "localPath", params.LocalPath, "bucketName", params.BucketName, "tenantId", params.TenantID)
5555

5656
bucket, err := getBucket(ctx, params)
5757
if err != nil {
@@ -97,7 +97,7 @@ func getBucket(ctx context.Context, params *queryBlocksSeriesParams) (objstore.B
9797
}
9898

9999
func getRemoteBucket(ctx context.Context, params *queryBlocksSeriesParams) (objstore.Bucket, error) {
100-
if params.TenanId == "" {
100+
if params.TenantID == "" {
101101
return nil, errors.New("specify tenant id for remote bucket")
102102
}
103103
return objstoreclient.NewBucket(ctx, objstoreclient.Config{
@@ -107,6 +107,6 @@ func getRemoteBucket(ctx context.Context, params *queryBlocksSeriesParams) (objs
107107
BucketName: params.BucketName,
108108
},
109109
},
110-
StoragePrefix: fmt.Sprintf("%s/phlaredb", params.TenanId),
110+
StoragePrefix: fmt.Sprintf("%s/phlaredb", params.TenantID),
111111
}, params.BucketName)
112112
}

‎pkg/phlaredb/block_querier_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,7 @@ func TestBlockMeta_loadsMetasIndividually(t *testing.T) {
13981398
blockQuerier := NewBlockQuerier(ctx, bucket)
13991399
metas, err := blockQuerier.BlockMetas(ctx)
14001400
require.NoError(t, err)
1401+
require.NotEmpty(t, metas)
14011402

14021403
for _, meta := range metas {
14031404
singleMeta, err := blockQuerier.BlockMeta(ctx, meta.ULID.String())

0 commit comments

Comments
 (0)