diff --git a/.drone/drone.yml b/.drone/drone.yml index 92336af4c4e5..d171a9f84963 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -75,7 +75,7 @@ steps: - commands: - apt-get update -y && apt-get install -y libsystemd-dev - make lint - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Lint trigger: event: @@ -93,7 +93,7 @@ steps: - ERR_MSG="Dashboard definitions are out of date. Please run 'make generate-dashboards' and commit changes!" - if [ ! -z "$(git status --porcelain)" ]; then echo $ERR_MSG >&2; exit 1; fi - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Regenerate dashboards trigger: event: @@ -111,7 +111,7 @@ steps: - ERR_MSG="Custom Resource Definitions are out of date. Please run 'make generate-crds' and commit changes!" - if [ ! -z "$(git status --porcelain)" ]; then echo $ERR_MSG >&2; exit 1; fi - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Regenerate crds trigger: event: @@ -129,7 +129,7 @@ steps: - ERR_MSG="The environment manifests are out of date. Please run 'make generate-manifests' and commit changes!" - if [ ! -z "$(git status --porcelain)" ]; then echo $ERR_MSG >&2; exit 1; fi - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Regenerate environment manifests trigger: event: @@ -144,7 +144,7 @@ platform: steps: - commands: - make GO_TAGS="nodocker" test - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Run Go tests trigger: event: @@ -159,7 +159,7 @@ platform: steps: - commands: - K8S_USE_DOCKER_NETWORK=1 make test - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Run Go tests volumes: - name: docker @@ -182,7 +182,7 @@ platform: steps: - commands: - go test -tags="nodocker,nonetwork" ./... - image: grafana/agent-build-image:0.30.2-windows + image: grafana/agent-build-image:0.30.3-windows name: Run Go tests trigger: ref: @@ -197,7 +197,7 @@ platform: steps: - commands: - make agent-image - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build container volumes: - name: docker @@ -222,7 +222,7 @@ platform: steps: - commands: - make agentctl-image - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build container volumes: - name: docker @@ -247,7 +247,7 @@ platform: steps: - commands: - make operator-image - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build container volumes: - name: docker @@ -273,7 +273,7 @@ platform: steps: - commands: - '& "C:/Program Files/git/bin/bash.exe" ./tools/ci/docker-containers-windows agent' - image: grafana/agent-build-image:0.30.2-windows + image: grafana/agent-build-image:0.30.3-windows name: Build container volumes: - name: docker @@ -299,7 +299,7 @@ platform: steps: - commands: - '& "C:/Program Files/git/bin/bash.exe" ./tools/ci/docker-containers-windows agentctl' - image: grafana/agent-build-image:0.30.2-windows + image: grafana/agent-build-image:0.30.3-windows name: Build container volumes: - name: docker @@ -326,7 +326,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -343,7 +343,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -360,7 +360,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -377,7 +377,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -393,7 +393,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -409,7 +409,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -425,7 +425,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -441,7 +441,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -458,7 +458,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -475,7 +475,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -492,7 +492,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -509,7 +509,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -525,7 +525,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -541,7 +541,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -557,7 +557,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -573,7 +573,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make agent-flow - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -590,7 +590,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -607,7 +607,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -624,7 +624,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -641,7 +641,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -657,7 +657,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -673,7 +673,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -689,7 +689,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -705,7 +705,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -722,7 +722,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -739,7 +739,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -756,7 +756,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -773,7 +773,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -789,7 +789,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -805,7 +805,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -821,7 +821,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -837,7 +837,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -854,7 +854,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= GOEXPERIMENT=boringcrypto make agent-boringcrypto - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -871,7 +871,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= GOEXPERIMENT=boringcrypto make agent-boringcrypto - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Build trigger: event: @@ -887,7 +887,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Configure QEMU volumes: - name: docker @@ -907,7 +907,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Publish container volumes: - name: docker @@ -931,7 +931,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Configure QEMU volumes: - name: docker @@ -951,7 +951,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Publish container volumes: - name: docker @@ -975,7 +975,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Configure QEMU volumes: - name: docker @@ -995,7 +995,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Publish container volumes: - name: docker @@ -1019,7 +1019,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Configure QEMU volumes: - name: docker @@ -1039,7 +1039,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Publish container volumes: - name: docker @@ -1063,7 +1063,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Configure QEMU volumes: - name: docker @@ -1083,7 +1083,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Publish container volumes: - name: docker @@ -1107,7 +1107,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Configure QEMU volumes: - name: docker @@ -1127,7 +1127,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Publish container volumes: - name: docker @@ -1156,7 +1156,7 @@ steps: from_secret: docker_login DOCKER_PASSWORD: from_secret: docker_password - image: grafana/agent-build-image:0.30.2-windows + image: grafana/agent-build-image:0.30.3-windows name: Build containers volumes: - name: docker @@ -1185,7 +1185,7 @@ steps: from_secret: docker_login DOCKER_PASSWORD: from_secret: docker_password - image: grafana/agent-build-image:0.30.2-windows + image: grafana/agent-build-image:0.30.3-windows name: Build containers volumes: - name: docker @@ -1306,7 +1306,7 @@ steps: from_secret: gpg_private_key GPG_PUBLIC_KEY: from_secret: gpg_public_key - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Publish release volumes: - name: docker @@ -1331,7 +1331,7 @@ steps: - DOCKER_OPTS="" make dist/grafana-agentctl-linux-amd64 - DOCKER_OPTS="" make dist.temp/grafana-agent-flow-linux-amd64 - DOCKER_OPTS="" make test-packages - image: grafana/agent-build-image:0.30.2 + image: grafana/agent-build-image:0.30.3 name: Test Linux system packages volumes: - name: docker @@ -1427,6 +1427,6 @@ kind: secret name: updater_private_key --- kind: signature -hmac: 372648213124cf1280ee4f0d402324dcc80b8a3304ae7a8e877bbe766ccb4074 +hmac: 47d018f95267288b13edfd1bdabbab3bc60daa2674fda3ebeb713fac569586cb ... diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a4825f014ba..f8f5289981d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,16 +29,33 @@ Main (unreleased) - Fixed an issue where `loki.process` validation for stage `metric.counter` was allowing invalid combination of configuration options. (@thampiotr) + +### Enhancements + +- The `loki.write` WAL now has snappy compression enabled by default. (@thepalbi) + +- Allow converting labels to structured metadata with Loki's structured_metadata stage. (@gonzalesraul) + +v0.37.2 (2023-10-16) +----------------- + +### Bugfixes - Fix the handling of the `--cluster.join-addresses` flag causing an invalid comparison with the mutually-exclusive `--cluster.discover-peers`. (@tpaschalis) - Fix an issue with the static to flow converter for blackbox exporter modules config not being included in the river output. (@erikbaranowski) - + ### Enhancements -- The `loki.write` WAL now has snappy compression enabled by default. (@thepalbi) +- Update Prometheus dependency to v2.47.2. (@tpaschalis) + +- Allow Out of Order writing to the WAL for metrics. (@mattdurham) + +### Other changes + +- Use Go 1.21.3 for builds. (@tpaschalis) v0.37.1 (2023-10-10) ----------------- diff --git a/cmd/grafana-agent-operator/Dockerfile b/cmd/grafana-agent-operator/Dockerfile index 8a76dd3f1162..1b797fc96d69 100644 --- a/cmd/grafana-agent-operator/Dockerfile +++ b/cmd/grafana-agent-operator/Dockerfile @@ -4,7 +4,7 @@ # default when running `docker buildx build` or when DOCKER_BUILDKIT=1 is set # in environment variables. -FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.2 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.3 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS diff --git a/cmd/grafana-agent/Dockerfile b/cmd/grafana-agent/Dockerfile index 178abb736e69..f03bd4efdfd0 100644 --- a/cmd/grafana-agent/Dockerfile +++ b/cmd/grafana-agent/Dockerfile @@ -4,7 +4,7 @@ # default when running `docker buildx build` or when DOCKER_BUILDKIT=1 is set # in environment variables. -FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.2 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.3 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS diff --git a/cmd/grafana-agent/Dockerfile.windows b/cmd/grafana-agent/Dockerfile.windows index 1670dc036068..cd2bd529f942 100644 --- a/cmd/grafana-agent/Dockerfile.windows +++ b/cmd/grafana-agent/Dockerfile.windows @@ -1,4 +1,4 @@ -FROM grafana/agent-build-image:0.30.2-windows as builder +FROM grafana/agent-build-image:0.30.3-windows as builder ARG VERSION ARG RELEASE_BUILD=1 diff --git a/cmd/grafana-agentctl/Dockerfile b/cmd/grafana-agentctl/Dockerfile index 8ac72875b42d..5a024889e664 100644 --- a/cmd/grafana-agentctl/Dockerfile +++ b/cmd/grafana-agentctl/Dockerfile @@ -4,7 +4,7 @@ # default when running `docker buildx build` or when DOCKER_BUILDKIT=1 is set # in environment variables. -FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.2 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.3 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS diff --git a/cmd/grafana-agentctl/Dockerfile.windows b/cmd/grafana-agentctl/Dockerfile.windows index b1336e0379fe..f310fa1af798 100644 --- a/cmd/grafana-agentctl/Dockerfile.windows +++ b/cmd/grafana-agentctl/Dockerfile.windows @@ -1,4 +1,4 @@ -FROM grafana/agent-build-image:0.30.2-windows as builder +FROM grafana/agent-build-image:0.30.3-windows as builder ARG VERSION ARG RELEASE_BUILD=1 diff --git a/component/loki/process/stages/structured_metadata.go b/component/loki/process/stages/structured_metadata.go index 2c752ac5017c..abaee55245b8 100644 --- a/component/loki/process/stages/structured_metadata.go +++ b/component/loki/process/stages/structured_metadata.go @@ -32,6 +32,26 @@ func (s *structuredMetadataStage) Run(in chan Entry) chan Entry { processLabelsConfigs(s.logger, e.Extracted, s.cfgs, func(labelName model.LabelName, labelValue model.LabelValue) { e.StructuredMetadata = append(e.StructuredMetadata, logproto.LabelAdapter{Name: string(labelName), Value: string(labelValue)}) }) - return e + return s.extractFromLabels(e) }) } + +func (s *structuredMetadataStage) extractFromLabels(e Entry) Entry { + labels := e.Labels + foundLabels := []model.LabelName{} + + for lName, lSrc := range s.cfgs.Values { + labelKey := model.LabelName(*lSrc) + if lValue, ok := labels[labelKey]; ok { + e.StructuredMetadata = append(e.StructuredMetadata, logproto.LabelAdapter{Name: lName, Value: string(lValue)}) + foundLabels = append(foundLabels, labelKey) + } + } + + // Remove found labels, do this after append to structure metadata + for _, fl := range foundLabels { + delete(labels, fl) + } + e.Labels = labels + return e +} diff --git a/component/loki/process/stages/structured_metadata_test.go b/component/loki/process/stages/structured_metadata_test.go index e5a858584872..33a62fe25f69 100644 --- a/component/loki/process/stages/structured_metadata_test.go +++ b/component/loki/process/stages/structured_metadata_test.go @@ -71,6 +71,26 @@ stage.labels { } ` +var pipelineStagesStructuredMetadataFromStaticLabels = ` +stage.static_labels { + values = {"component" = "querier", "pod" = "loki-querier-664f97db8d-qhnwg"} +} + +stage.structured_metadata { + values = {"pod" = ""} +} +` + +var pipelineStagesStructuredMetadataFromStaticLabelsDifferentKey = ` +stage.static_labels { + values = {"component" = "querier", "pod" = "loki-querier-664f97db8d-qhnwg"} +} + +stage.structured_metadata { + values = {"pod_name" = "pod"} +} +` + func Test_StructuredMetadataStage(t *testing.T) { tests := map[string]struct { pipelineStagesYaml string @@ -104,6 +124,18 @@ func Test_StructuredMetadataStage(t *testing.T) { expectedStructuredMetadata: push.LabelsAdapter{push.LabelAdapter{Name: "app", Value: "loki"}}, expectedLabels: model.LabelSet{model.LabelName("component"): model.LabelValue("ingester")}, }, + "expected structured metadata and regular labels to be extracted with static labels stage and to be added to entry": { + pipelineStagesYaml: pipelineStagesStructuredMetadataFromStaticLabels, + logLine: `sample log line`, + expectedStructuredMetadata: push.LabelsAdapter{push.LabelAdapter{Name: "pod", Value: "loki-querier-664f97db8d-qhnwg"}}, + expectedLabels: model.LabelSet{model.LabelName("component"): model.LabelValue("querier")}, + }, + "expected structured metadata and regular labels to be extracted with static labels stage using different structured key": { + pipelineStagesYaml: pipelineStagesStructuredMetadataFromStaticLabelsDifferentKey, + logLine: `sample log line`, + expectedStructuredMetadata: push.LabelsAdapter{push.LabelAdapter{Name: "pod_name", Value: "loki-querier-664f97db8d-qhnwg"}}, + expectedLabels: model.LabelSet{model.LabelName("component"): model.LabelValue("querier")}, + }, } for name, test := range tests { t.Run(name, func(t *testing.T) { diff --git a/docs/sources/_index.md b/docs/sources/_index.md index b7d5c9c4a6a8..0b131e9462d0 100644 --- a/docs/sources/_index.md +++ b/docs/sources/_index.md @@ -8,7 +8,7 @@ title: Grafana Agent description: Grafana Agent is a flexible, performant, vendor-neutral, telemetry collector weight: 350 cascade: - AGENT_RELEASE: v0.37.1 + AGENT_RELEASE: v0.37.2 --- # Grafana Agent diff --git a/go.mod b/go.mod index 48f0c11ada53..1c562e2ad647 100644 --- a/go.mod +++ b/go.mod @@ -675,8 +675,8 @@ replace ( // * There is a release of Prometheus which contains // prometheus/prometheus#12677 and prometheus/prometheus#12729. // We use the last v1-related tag as the replace statement does not work for v2 -// tags without the v2 suffix to the module root -replace github.com/prometheus/prometheus => github.com/grafana/prometheus v1.8.2-0.20231003113207-17e15326a784 // grafana:prometheus:v0.46.0-retry-improvements +// tags without the v2 suffix to the module root. +replace github.com/prometheus/prometheus => github.com/grafana/prometheus v1.8.2-0.20231016083943-46550094220d // grafana:prometheus:v0.47.2-retry-improvements replace gopkg.in/yaml.v2 => github.com/rfratto/go-yaml v0.0.0-20211119180816-77389c3526dc diff --git a/go.sum b/go.sum index 359aea725075..be5bfee9f0aa 100644 --- a/go.sum +++ b/go.sum @@ -1071,8 +1071,8 @@ github.com/grafana/perflib_exporter v0.1.1-0.20230511173423-6166026bd090 h1:Ko80 github.com/grafana/perflib_exporter v0.1.1-0.20230511173423-6166026bd090/go.mod h1:MinSWm88jguXFFrGsP56PtleUb4Qtm4tNRH/wXNXRTI= github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520 h1:HnFWqxhoSF3WC7sKAdMZ+SRXvHLVZlZ3sbQjuUlTqkw= github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520/go.mod h1:+HPXgiOV0InDHcZ2jNijL1SOKvo0eEPege5fQA0+ICI= -github.com/grafana/prometheus v1.8.2-0.20231003113207-17e15326a784 h1:B8AAFKq7WQPUYdoGwWjgxFARn5XodYlKJNHCYUopah8= -github.com/grafana/prometheus v1.8.2-0.20231003113207-17e15326a784/go.mod h1:10L5IJE5CEsjee1FnOcVswYXlPIscDWWt3IJ2UDYrz4= +github.com/grafana/prometheus v1.8.2-0.20231016083943-46550094220d h1:hr0QEXSfpdakWdHw2sZeT/5GnGwIkHnNO0YBkfRj5zk= +github.com/grafana/prometheus v1.8.2-0.20231016083943-46550094220d/go.mod h1:J/bmOSjgH7lFxz2gZhrWEZs2i64vMS+HIuZfmYNhJ/M= github.com/grafana/pyroscope-go/godeltaprof v0.1.3 h1:eunWpv1B3Z7ZK9o4499EmQGlY+CsDmSZ4FbxjRx37uk= github.com/grafana/pyroscope-go/godeltaprof v0.1.3/go.mod h1:1HSPtjU8vLG0jE9JrTdzjgFqdJ/VgN7fvxBNq3luJko= github.com/grafana/pyroscope/api v0.2.0 h1:TzOxL0s6SiaLEy944ZAKgHcx/JDRJXu4O8ObwkqR6p4= diff --git a/pkg/metrics/wal/wal.go b/pkg/metrics/wal/wal.go index 13c0b441d437..e1176afdeccb 100644 --- a/pkg/metrics/wal/wal.go +++ b/pkg/metrics/wal/wal.go @@ -699,11 +699,6 @@ func (a *appender) Append(ref storage.SeriesRef, l labels.Labels, t int64, v flo series.Lock() defer series.Unlock() - if t < series.lastTs { - a.w.metrics.totalOutOfOrderSamples.Inc() - return 0, storage.ErrOutOfOrderSample - } - // NOTE(rfratto): always modify pendingSamples and sampleSeries together. a.pendingSamples = append(a.pendingSamples, record.RefSample{ Ref: series.ref, @@ -824,11 +819,6 @@ func (a *appender) AppendHistogram(ref storage.SeriesRef, l labels.Labels, t int series.Lock() defer series.Unlock() - if t < series.lastTs { - a.w.metrics.totalOutOfOrderSamples.Inc() - return 0, storage.ErrOutOfOrderSample - } - switch { case h != nil: // NOTE(rfratto): always modify pendingHistograms and histogramSeries diff --git a/pkg/metrics/wal/wal_test.go b/pkg/metrics/wal/wal_test.go index c99bad9bf579..9aaf52d639d1 100644 --- a/pkg/metrics/wal/wal_test.go +++ b/pkg/metrics/wal/wal_test.go @@ -434,6 +434,35 @@ func TestGlobalReferenceID_Normal(t *testing.T) { require.True(t, ref3 == 2) } +func TestDBAllowOOOSamples(t *testing.T) { + walDir := t.TempDir() + + s, err := NewStorage(log.NewNopLogger(), nil, walDir) + require.NoError(t, err) + defer func() { + require.NoError(t, s.Close()) + }() + + app := s.Appender(context.Background()) + + // Write some samples + payload := buildSeries([]string{"foo", "bar", "baz"}) + for _, metric := range payload { + metric.Write(t, app) + } + + require.NoError(t, app.Commit()) + for _, metric := range payload { + for _, sa := range metric.samples { + // We want to set the timestamp to before. This should no longer trigger an out of order. + sa.ts = sa.ts - 10_000 + } + } + for _, metric := range payload { + metric.Write(t, app) + } +} + func BenchmarkAppendExemplar(b *testing.B) { walDir := b.TempDir() diff --git a/pkg/operator/defaults.go b/pkg/operator/defaults.go index 59ea98669a8c..789c867acecc 100644 --- a/pkg/operator/defaults.go +++ b/pkg/operator/defaults.go @@ -2,7 +2,7 @@ package operator // Supported versions of the Grafana Agent. var ( - DefaultAgentVersion = "v0.37.1" + DefaultAgentVersion = "v0.37.2" DefaultAgentBaseImage = "grafana/agent" DefaultAgentImage = DefaultAgentBaseImage + ":" + DefaultAgentVersion ) diff --git a/production/kubernetes/agent-bare.yaml b/production/kubernetes/agent-bare.yaml index 4a84a679ef92..a471e12915be 100644 --- a/production/kubernetes/agent-bare.yaml +++ b/production/kubernetes/agent-bare.yaml @@ -83,7 +83,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.37.1 + image: grafana/agent:v0.37.2 imagePullPolicy: IfNotPresent name: grafana-agent ports: diff --git a/production/kubernetes/agent-loki.yaml b/production/kubernetes/agent-loki.yaml index 2550cd6a7571..e3f93ee35231 100644 --- a/production/kubernetes/agent-loki.yaml +++ b/production/kubernetes/agent-loki.yaml @@ -65,7 +65,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.37.1 + image: grafana/agent:v0.37.2 imagePullPolicy: IfNotPresent name: grafana-agent-logs ports: diff --git a/production/kubernetes/agent-traces.yaml b/production/kubernetes/agent-traces.yaml index 1fb5501c8558..92d67e6528e3 100644 --- a/production/kubernetes/agent-traces.yaml +++ b/production/kubernetes/agent-traces.yaml @@ -114,7 +114,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.37.1 + image: grafana/agent:v0.37.2 imagePullPolicy: IfNotPresent name: grafana-agent-traces ports: diff --git a/production/kubernetes/build/lib/version.libsonnet b/production/kubernetes/build/lib/version.libsonnet index 3c0c2dc542fc..54c982231ef1 100644 --- a/production/kubernetes/build/lib/version.libsonnet +++ b/production/kubernetes/build/lib/version.libsonnet @@ -1 +1 @@ -'grafana/agent:v0.37.1' +'grafana/agent:v0.37.2' diff --git a/production/kubernetes/build/templates/operator/main.jsonnet b/production/kubernetes/build/templates/operator/main.jsonnet index 18c53173d526..1b27d4df15b3 100644 --- a/production/kubernetes/build/templates/operator/main.jsonnet +++ b/production/kubernetes/build/templates/operator/main.jsonnet @@ -23,8 +23,8 @@ local ksm = import 'kube-state-metrics/kube-state-metrics.libsonnet'; local this = self, _images:: { - agent: 'grafana/agent:v0.37.1', - agent_operator: 'grafana/agent-operator:v0.37.1', + agent: 'grafana/agent:v0.37.2', + agent_operator: 'grafana/agent-operator:v0.37.2', ksm: 'registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.5.0', }, diff --git a/production/kubernetes/install-bare.sh b/production/kubernetes/install-bare.sh index ff06be34f772..c91dbe9392c2 100644 --- a/production/kubernetes/install-bare.sh +++ b/production/kubernetes/install-bare.sh @@ -25,7 +25,7 @@ check_installed() { check_installed curl check_installed envsubst -MANIFEST_BRANCH=v0.37.1 +MANIFEST_BRANCH=v0.37.2 MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-bare.yaml} NAMESPACE=${NAMESPACE:-default} diff --git a/production/operator/templates/agent-operator.yaml b/production/operator/templates/agent-operator.yaml index dc618b85099c..da54bde278bf 100644 --- a/production/operator/templates/agent-operator.yaml +++ b/production/operator/templates/agent-operator.yaml @@ -372,7 +372,7 @@ spec: containers: - args: - --kubelet-service=default/kubelet - image: grafana/agent-operator:v0.37.1 + image: grafana/agent-operator:v0.37.2 imagePullPolicy: IfNotPresent name: grafana-agent-operator serviceAccount: grafana-agent-operator @@ -436,7 +436,7 @@ metadata: name: grafana-agent namespace: ${NAMESPACE} spec: - image: grafana/agent:v0.37.1 + image: grafana/agent:v0.37.2 integrations: selector: matchLabels: diff --git a/production/tanka/grafana-agent/v1/main.libsonnet b/production/tanka/grafana-agent/v1/main.libsonnet index 051e7a45e7b6..4b94562f59eb 100644 --- a/production/tanka/grafana-agent/v1/main.libsonnet +++ b/production/tanka/grafana-agent/v1/main.libsonnet @@ -15,8 +15,8 @@ local service = k.core.v1.service; (import './lib/traces.libsonnet') + { _images:: { - agent: 'grafana/agent:v0.37.1', - agentctl: 'grafana/agentctl:v0.37.1', + agent: 'grafana/agent:v0.37.2', + agentctl: 'grafana/agentctl:v0.37.2', }, // new creates a new DaemonSet deployment of the grafana-agent. By default, diff --git a/production/tanka/grafana-agent/v2/internal/base.libsonnet b/production/tanka/grafana-agent/v2/internal/base.libsonnet index 553feb15012a..08f34634bf16 100644 --- a/production/tanka/grafana-agent/v2/internal/base.libsonnet +++ b/production/tanka/grafana-agent/v2/internal/base.libsonnet @@ -11,8 +11,8 @@ function(name='grafana-agent', namespace='') { local this = self, _images:: { - agent: 'grafana/agent:v0.37.1', - agentctl: 'grafana/agentctl:v0.37.1', + agent: 'grafana/agent:v0.37.2', + agentctl: 'grafana/agentctl:v0.37.2', }, _config:: { name: name, diff --git a/production/tanka/grafana-agent/v2/internal/syncer.libsonnet b/production/tanka/grafana-agent/v2/internal/syncer.libsonnet index 633ae5d519fe..3f1f215d721f 100644 --- a/production/tanka/grafana-agent/v2/internal/syncer.libsonnet +++ b/production/tanka/grafana-agent/v2/internal/syncer.libsonnet @@ -14,7 +14,7 @@ function( ) { local _config = { api: error 'api must be set', - image: 'grafana/agentctl:v0.37.1', + image: 'grafana/agentctl:v0.37.2', schedule: '*/5 * * * *', configs: [], } + config, diff --git a/tools/crow/Dockerfile b/tools/crow/Dockerfile index 11ff7f62bb29..2e167ab9d2f6 100644 --- a/tools/crow/Dockerfile +++ b/tools/crow/Dockerfile @@ -4,7 +4,7 @@ # default when running `docker buildx build` or when DOCKER_BUILDKIT=1 is set # in environment variables. -FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.2 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.3 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS diff --git a/tools/gen-versioned-files/agent-version.txt b/tools/gen-versioned-files/agent-version.txt index 283d4a015533..c350e8f78a3f 100644 --- a/tools/gen-versioned-files/agent-version.txt +++ b/tools/gen-versioned-files/agent-version.txt @@ -1 +1 @@ -v0.37.1 \ No newline at end of file +v0.37.2 diff --git a/tools/make/build-container.mk b/tools/make/build-container.mk index aec36120c173..ae67dbe8a3e3 100644 --- a/tools/make/build-container.mk +++ b/tools/make/build-container.mk @@ -34,7 +34,7 @@ # variable names should be passed through to the container. USE_CONTAINER ?= 0 -BUILD_IMAGE_VERSION ?= 0.30.2 +BUILD_IMAGE_VERSION ?= 0.30.3 BUILD_IMAGE ?= grafana/agent-build-image:$(BUILD_IMAGE_VERSION) DOCKER_OPTS ?= -it diff --git a/tools/smoke/Dockerfile b/tools/smoke/Dockerfile index 503c9ebe8809..aed61b57dede 100644 --- a/tools/smoke/Dockerfile +++ b/tools/smoke/Dockerfile @@ -4,7 +4,7 @@ # default when running `docker buildx build` or when DOCKER_BUILDKIT=1 is set # in environment variables. -FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.2 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.30.3 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS