Skip to content

Commit

Permalink
Use newest build image 0.31.2 with golangci-lint update. (grafana#11118)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:
This just updates the Loki build imaage changed in grafana#11114.

**Checklist**
- [ ] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [ ] Documentation added
- [ ] Tests updated
- [ ] `CHANGELOG.md` updated
- [ ] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [ ] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](grafana@d10549e)
- [ ] If the change is deprecating or removing a configuration option,
update the `deprecated-config.yaml` and `deleted-config.yaml` files
respectively in the `tools/deprecated-config-checker` directory.
[Example
PR](grafana@0d4416a)
  • Loading branch information
jeschkies authored and rhnasc committed Apr 12, 2024
1 parent 6774150 commit 80b2fc5
Show file tree
Hide file tree
Showing 46 changed files with 95 additions and 85 deletions.
42 changes: 21 additions & 21 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: check-drone-drift
- commands:
- make BUILD_IN_CONTAINER=false check-generated-files
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: check-generated-files
- commands:
- cd ..
Expand All @@ -110,7 +110,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: clone-target-branch
when:
event:
Expand All @@ -121,14 +121,14 @@ steps:
- clone-target-branch
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: test
- commands:
- cd ../loki-target-branch && BUILD_IN_CONTAINER=false make test
depends_on:
- clone-target-branch
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: test-target-branch
when:
event:
Expand All @@ -141,7 +141,7 @@ steps:
- test
- test-target-branch
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: compare-coverage
when:
event:
Expand All @@ -159,7 +159,7 @@ steps:
TOKEN:
from_secret: github_token
USER: grafanabot
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: report-coverage
when:
event:
Expand All @@ -169,15 +169,15 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: lint
- commands:
- make BUILD_IN_CONTAINER=false check-mod
depends_on:
- test
- lint
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: check-mod
- commands:
- apk add make bash && make lint-scripts
Expand All @@ -188,21 +188,21 @@ steps:
depends_on:
- check-generated-files
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: loki
- commands:
- make BUILD_IN_CONTAINER=false check-doc
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: check-doc
- commands:
- make BUILD_IN_CONTAINER=false check-format GIT_TARGET_BRANCH="$DRONE_TARGET_BRANCH"
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: check-format
when:
event:
Expand All @@ -212,14 +212,14 @@ steps:
depends_on:
- loki
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: validate-example-configs
- commands:
- make BUILD_IN_CONTAINER=false check-example-config-doc
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: check-example-config-doc
- commands:
- mkdir -p /hugo/content/docs/loki/latest
Expand Down Expand Up @@ -252,7 +252,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: loki-mixin-check
when:
event:
Expand All @@ -277,7 +277,7 @@ steps:
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: documentation-helm-reference-check
trigger:
ref:
Expand Down Expand Up @@ -1683,15 +1683,15 @@ steps:
NFPM_SIGNING_KEY:
from_secret: gpg_private_key
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: write-key
- commands:
- make BUILD_IN_CONTAINER=false packages
environment:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: test packaging
- commands:
- ./tools/packaging/verify-deb-install.sh
Expand All @@ -1717,7 +1717,7 @@ steps:
NFPM_PASSPHRASE:
from_secret: gpg_passphrase
NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: publish
when:
event:
Expand Down Expand Up @@ -1752,7 +1752,7 @@ steps:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
image: grafana/loki-build-image:0.30.1
image: grafana/loki-build-image:0.31.2
name: build and push
privileged: true
volumes:
Expand Down Expand Up @@ -2017,6 +2017,6 @@ kind: secret
name: gpg_private_key
---
kind: signature
hmac: 27257b795645c64fe82deb850f6efdf73fec2e0e2217e86ac52ae6bf434a92b5
hmac: a68ce0151ff769aa0731f120437450f0d9685c843cb3c5b046d4991f910aadd7

...
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,8 @@ issues:
- Error return value of .*log\.Logger\)\.Log\x60 is not checked
- Error return value of .*.Log.* is not checked
- Error return value of `` is not checked

exclude-rules:
- path: '(.+)_test\.go'
linters:
- goconst
fix: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES))
BUILD_IN_CONTAINER ?= true

# ensure you run `make drone` after changing this
BUILD_IMAGE_VERSION := 0.30.1
BUILD_IMAGE_VERSION ?= 0.31.2

# Docker image info
IMAGE_PREFIX ?= grafana
Expand Down
1 change: 1 addition & 0 deletions clients/pkg/logentry/stages/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func (m *metricStage) Name() string {
}

// recordCounter will update a counter metric
// nolint:goconst
func (m *metricStage) recordCounter(name string, counter *metric.Counters, labels model.LabelSet, v interface{}) {
// If value matching is defined, make sure value matches.
if counter.Cfg.Value != nil {
Expand Down
1 change: 1 addition & 0 deletions clients/pkg/logentry/stages/pack_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// nolint:goconst
package stages

import (
Expand Down
1 change: 1 addition & 0 deletions integration/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"gopkg.in/yaml.v2"

"github.com/grafana/loki/integration/util"

"github.com/grafana/loki/pkg/loki"
"github.com/grafana/loki/pkg/storage"
"github.com/grafana/loki/pkg/storage/config"
Expand Down
2 changes: 1 addition & 1 deletion pkg/bloomgateway/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type noopClient struct {
}

// FilterChunks implements Client.
func (c *noopClient) FilterChunks(ctx context.Context, tenant string, from, through model.Time, groups []*logproto.GroupedChunkRefs, filters ...*logproto.LineFilterExpression) ([]*logproto.GroupedChunkRefs, error) {
func (c *noopClient) FilterChunks(ctx context.Context, tenant string, from, through model.Time, groups []*logproto.GroupedChunkRefs, filters ...*logproto.LineFilterExpression) ([]*logproto.GroupedChunkRefs, error) { // nolint:revive
c.callCount++
return groups, c.err
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/bloomgateway/sharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ func (s *ShuffleShardingStrategy) FilterTenants(_ context.Context, tenantIDs []s
return filteredIDs, nil
}

// nolint:revive
func getBucket(rangeMin, rangeMax, pos uint64) int {
return 0
}

// FilterBlocks implements ShardingStrategy.
func (s *ShuffleShardingStrategy) FilterBlocks(ctx context.Context, tenantID string, blockRefs []BlockRef) ([]BlockRef, error) {
func (s *ShuffleShardingStrategy) FilterBlocks(_ context.Context, tenantID string, blockRefs []BlockRef) ([]BlockRef, error) {
filteredBlockRefs := make([]BlockRef, 0, len(blockRefs))

subRing := GetShuffleShardingSubring(s.r, tenantID, s.limits)
Expand Down Expand Up @@ -152,11 +153,11 @@ func NewNoopStrategy() *NoopStrategy {
}

// FilterTenants implements ShardingStrategy.
func (s *NoopStrategy) FilterTenants(ctx context.Context, tenantIDs []string) ([]string, error) {
func (s *NoopStrategy) FilterTenants(_ context.Context, tenantIDs []string) ([]string, error) {
return tenantIDs, nil
}

// FilterBlocks implements ShardingStrategy.
func (s *NoopStrategy) FilterBlocks(ctx context.Context, tenantID string, blockRefs []BlockRef) ([]BlockRef, error) {
func (s *NoopStrategy) FilterBlocks(_ context.Context, _ string, blockRefs []BlockRef) ([]BlockRef, error) {
return blockRefs, nil
}
1 change: 1 addition & 0 deletions pkg/logcli/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ func (c *DefaultClient) doRequest(path, query string, quiet bool, out interface{
return json.NewDecoder(resp.Body).Decode(out)
}

// nolint:goconst
func (c *DefaultClient) getHTTPRequestHeader() (http.Header, error) {
h := make(http.Header)

Expand Down
2 changes: 1 addition & 1 deletion pkg/logcli/query/part_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (f *PartFile) Exists() (bool, error) {
} else if errors.Is(err, os.ErrNotExist) {
// File does not exist.
return false, nil
} else {
} else { // nolint:revive
// Unclear if file exists or not, we cannot stat it.
return false, fmt.Errorf("failed to check if part file exists: %s: %s", f.finalName, err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/loghttp/push/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,6 @@ func TestAttributesToLabels(t *testing.T) {

type fakeRetention struct{}

func (f fakeRetention) RetentionPeriodFor(userID string, lbs labels.Labels) time.Duration {
func (f fakeRetention) RetentionPeriodFor(_ string, _ labels.Labels) time.Duration {
return time.Hour
}
4 changes: 2 additions & 2 deletions pkg/logql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (q *query) Eval(ctx context.Context) (promql_parser.Value, error) {
}

defer util.LogErrorWithContext(ctx, "closing iterator", itr.Close)
streams, err := readStreams(itr, q.params.Limit(), q.params.Direction(), q.params.Interval(), true)
streams, err := readStreams(itr, q.params.Limit(), q.params.Direction(), q.params.Interval())
return streams, err
default:
return nil, fmt.Errorf("unexpected type (%T): cannot evaluate", e)
Expand Down Expand Up @@ -508,7 +508,7 @@ func PopulateMatrixFromScalar(data promql.Scalar, params Params) promql.Matrix {
// If categorizeLabels is true, the stream labels contains just the stream labels and entries inside each stream have their
// structuredMetadata and parsed fields populated with structured metadata labels plus the parsed labels respectively.
// Otherwise, the stream labels are the whole series labels including the stream labels, structured metadata labels and parsed labels.
func readStreams(i iter.EntryIterator, size uint32, dir logproto.Direction, interval time.Duration, categorizeLabels bool) (logqlmodel.Streams, error) {
func readStreams(i iter.EntryIterator, size uint32, dir logproto.Direction, interval time.Duration) (logqlmodel.Streams, error) {
streams := map[string]*logproto.Stream{}
respSize := uint32(0)
// lastEntry should be a really old time so that the first comparison is always true, we use a negative
Expand Down
4 changes: 2 additions & 2 deletions pkg/logql/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,9 @@ func matchingSignature(sample promql.Sample, opts *syntax.BinOpOptions) uint64 {
return sample.Metric.Hash()
} else if opts.VectorMatching.On {
return labels.NewBuilder(sample.Metric).Keep(opts.VectorMatching.MatchingLabels...).Labels().Hash()
} else {
return labels.NewBuilder(sample.Metric).Del(opts.VectorMatching.MatchingLabels...).Labels().Hash()
}

return labels.NewBuilder(sample.Metric).Del(opts.VectorMatching.MatchingLabels...).Labels().Hash()
}

func vectorBinop(op string, opts *syntax.BinOpOptions, lhs, rhs promql.Vector, lsigs, rsigs []uint64) (promql.Vector, error) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/loki/config_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ func (c *ConfigWrapper) ApplyDynamicConfig() cfg.Source {
}

if i := lastBoltdbShipperConfig(r.SchemaConfig.Configs); i != len(r.SchemaConfig.Configs) {
betterBoltdbShipperDefaults(r, &defaults, r.SchemaConfig.Configs[i])
betterBoltdbShipperDefaults(r)
}

if i := lastTSDBConfig(r.SchemaConfig.Configs); i != len(r.SchemaConfig.Configs) {
betterTSDBShipperDefaults(r, &defaults, r.SchemaConfig.Configs[i])
betterTSDBShipperDefaults(r)
}

applyEmbeddedCacheConfig(r)
Expand Down Expand Up @@ -575,7 +575,7 @@ func applyStorageConfig(cfg, defaults *ConfigWrapper) error {
return nil
}

func betterBoltdbShipperDefaults(cfg, defaults *ConfigWrapper, period config.PeriodConfig) {
func betterBoltdbShipperDefaults(cfg *ConfigWrapper) {
if cfg.Common.PathPrefix != "" {
prefix := strings.TrimSuffix(cfg.Common.PathPrefix, "/")

Expand All @@ -589,7 +589,7 @@ func betterBoltdbShipperDefaults(cfg, defaults *ConfigWrapper, period config.Per
}
}

func betterTSDBShipperDefaults(cfg, defaults *ConfigWrapper, period config.PeriodConfig) {
func betterTSDBShipperDefaults(cfg *ConfigWrapper) {
if cfg.Common.PathPrefix != "" {
prefix := strings.TrimSuffix(cfg.Common.PathPrefix, "/")

Expand Down
2 changes: 1 addition & 1 deletion pkg/loki/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (c *Config) Validate() error {
if err := c.CompactorConfig.Validate(); err != nil {
return errors.Wrap(err, "invalid compactor config")
}
if err := c.ChunkStoreConfig.Validate(util_log.Logger); err != nil {
if err := c.ChunkStoreConfig.Validate(); err != nil {
return errors.Wrap(err, "invalid chunk store config")
}
if err := c.QueryRange.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ func (t *Loki) setupAsyncStore() error {
}

func (t *Loki) initIngesterQuerier() (_ services.Service, err error) {
t.ingesterQuerier, err = querier.NewIngesterQuerier(t.Cfg.IngesterClient, t.ring, t.Cfg.Querier.ExtraQueryDelay, t.Cfg.MetricsNamespace)
t.ingesterQuerier, err = querier.NewIngesterQuerier(t.Cfg.IngesterClient, t.ring, t.Cfg.Querier.ExtraQueryDelay)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/lokifrontend/frontend/v1/frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func TestFrontendMetricsCleanup(t *testing.T) {
}
}

func testFrontend(t *testing.T, config Config, handler queryrangebase.Handler, test func(addr string, frontend *Frontend), matchMaxConcurrency bool, reg prometheus.Registerer) {
func testFrontend(t *testing.T, config Config, handler queryrangebase.Handler, test func(addr string, frontend *Frontend), _ bool, reg prometheus.Registerer) {
logger := log.NewNopLogger()

var workerConfig querier_worker.Config
Expand Down
6 changes: 3 additions & 3 deletions pkg/querier/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ func (q *QuerierAPI) TailHandler(w http.ResponseWriter, r *http.Request) {
break
} else if tailer.stopped {
return
} else {
level.Error(logger).Log("msg", "Unexpected error from client", "err", err)
break
}

level.Error(logger).Log("msg", "Unexpected error from client", "err", err)
break
}
}
doneChan <- struct{}{}
Expand Down
Loading

0 comments on commit 80b2fc5

Please sign in to comment.