Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
50f8e66
Update node_exporter dependency to v1.3.1 (#1228)
rfratto Jan 6, 2022
c88a0b6
Introduce experimental integrations revamp (#1198)
rfratto Jan 6, 2022
6fb3dcc
Fix panic when using 'stdout' in automatic logging (#1233)
mapno Jan 7, 2022
b027e7c
integrations-next: fix bug where v2 integrations were not being stric…
rfratto Jan 7, 2022
c211d40
Remove jsonnet vendor folders (#1222)
rfratto Jan 7, 2022
94cbbb1
Fix link to k3d example in DEVELOPERS.md (#1242)
tpaschalis Jan 10, 2022
e3d3306
Fix node_exporter upgrade docs (#1239)
pkoenig10 Jan 10, 2022
8bb01ea
Fix panic in automatic logging with stdout backend (#1243)
mapno Jan 10, 2022
f0cacd1
pkg/util: support custom yaml.Unmarshaler implementations for util.Un…
rfratto Jan 10, 2022
9d874ac
Update k3d example grafana/grafonnet-lib version (#1246)
tpaschalis Jan 10, 2022
0b8d63d
Create an e2e framework with support for running tests against k8s (#…
rfratto Jan 10, 2022
41cf32c
Operator: fix bug where /-/ready and /-/healthy always returned 404 (…
rfratto Jan 11, 2022
d151094
Make scraping-svc use the new `metrics:` key (#1259)
tpaschalis Jan 12, 2022
2dbe3a3
update prometheus dependency (#1260)
rfratto Jan 12, 2022
bf17aee
corrected typo (#1265)
langerma Jan 13, 2022
d2031d3
Use RELEASE_TAG to choose between `:main` and `:latest` docker tags (…
tpaschalis Jan 13, 2022
6240e64
prepare for v0.22.0 release (#1266)
rlankfo Jan 13, 2022
bb4174c
Add basic testing framework for operator (#1268)
rfratto Jan 14, 2022
e1df94f
Update release-note.md (#1267)
rlankfo Jan 14, 2022
e319f18
Set scrape User-Agent header during init (#1274)
tpaschalis Jan 14, 2022
8bebf94
Upgrade to Go 1.17 (#1278)
tpaschalis Jan 18, 2022
d74f94a
fix typo (#1284)
alexrudd2 Jan 18, 2022
ec42e23
Use custom Go version in agent-operator Dockerfile (#1286)
tpaschalis Jan 19, 2022
8fc3423
pkg/operator: refactor resource hierarchy discovery (#1271)
rfratto Jan 19, 2022
b890ef9
update agent-build-image for go 1.17 (#1287)
rfratto Jan 19, 2022
9beca9e
Skip non-ready entries when listing instances (#1289)
tpaschalis Jan 21, 2022
0759ad3
Fix panic in prom_sd_processor when address is empty (#1279)
mapno Jan 24, 2022
59ffd8b
Operator: generate proxy_url for remote_write (#1298)
rfratto Jan 24, 2022
42dd9de
Merge branch 'dev.dynamic_configuration' of github.com:grafana/agent …
mattdurham Jan 24, 2022
33881be
Merge remote-tracking branch 'origin/main' into dev.dynamic_configura…
mattdurham Jan 24, 2022
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
34 changes: 22 additions & 12 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trigger:

steps:
- name: lint
image: golangci/golangci-lint:v1.37.1
image: golangci/golangci-lint:v1.43
commands:
- apt-get update -y && apt-get install -y libsystemd-dev
- make lint
Expand All @@ -41,19 +41,27 @@ trigger:
steps:
- name: test
image: rfratto/seego
volumes:
- name: docker
path: /var/run/docker.sock
commands:
- apt-get update && apt-get install -y rubygems rpm nsis apt-transport-https ca-certificates curl gnupg lsb-release
- gem install --no-document fpm
- rm -r /usr/local/go
- mkdir -p /usr/local/go/bin
- wget -q https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
- rm go1.16.5.linux-amd64.tar.gz
- wget -q https://golang.org/dl/go1.17.6.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
- rm go1.17.6.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- make cmd/agent/agent cmd/agentctl/agentctl cmd/agent-operator/agent-operator cmd/grafana-agent-crow/grafana-agent-crow
- make DRONE=true BUILD_IN_CONTAINER=false test
- make K8S_USE_DOCKER_NETWORK=1 DRONE=true BUILD_IN_CONTAINER=false test
depends_on:
- Lint

volumes:
- name: docker
host:
path: /var/run/docker.sock

---
kind: pipeline
Expand All @@ -72,10 +80,11 @@ steps:
commands:
- apt-get update && apt-get install -y rubygems rpm nsis
- gem install --no-document fpm
- rm -r /usr/local/go
- mkdir -p /usr/local/go/bin
- wget -q https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
- rm go1.16.5.linux-amd64.tar.gz
- wget -q https://golang.org/dl/go1.17.6.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
- rm go1.17.6.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- make DRONE=true BUILD_IN_CONTAINER=false dist
depends_on:
Expand Down Expand Up @@ -209,10 +218,11 @@ steps:
- apt-get update && apt-get install -y rubygems rpm nsis docker-ce docker-ce-cli containerd.io gettext
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
- gem install --no-document fpm
- rm -r /usr/local/go
- mkdir -p /usr/local/go/bin
- wget -q https://golang.org/dl/go1.16.5.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.16.5.linux-amd64.tar.gz
- rm go1.16.5.linux-amd64.tar.gz
- wget -q https://golang.org/dl/go1.17.6.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz
- rm go1.17.6.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- GO111MODULE=on go get -u github.com/mitchellh/gox github.com/tcnksm/ghr
- export PATH="$(go env GOPATH)/bin:$PATH"
Expand Down Expand Up @@ -242,6 +252,6 @@ get:
name: pat
---
kind: signature
hmac: 11038ae4592a13955388dff643b35bb1f07e53a659cdca946e863c9f2ac77066
hmac: 87a9a23731884dac8e0b5c3ee0fa2b5cef9d7fa490fcad649f7783f6ea9d2d32

...
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
platform: [macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.16
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.17.6
id: go
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: make BUILD_IN_CONTAINER=false cmd/agent/agent cmd/agentctl/agentctl cmd/agent-operator/agent-operator
run: make GOFLAGS="-tags=netgo,nodocker" BUILD_IN_CONTAINER=false cmd/agent/agent cmd/agentctl/agentctl cmd/agent-operator/agent-operator
- name: Test
run: make BUILD_IN_CONTAINER=false test
run: make GOFLAGS="-tags=netgo,nodocker" BUILD_IN_CONTAINER=false test
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Main (unreleased)

- [ENHANCEMENT] Go 1.17 is now used for all builds of the Agent. (@tpaschalis)

- [BUGFIX] Fixed issue where Grafana Agent may panic if there is a very large
WAL loading while old WALs are being deleted or the `/agent/api/v1/targets`
endpoint is called. (@tpaschalis)

- [BUGFIX] Fix panic in prom_sd_processor when address is empty (@mapno)

- [BUGFIX] Operator: Add missing proxy_url field from generated remote_write
configs. (@rfratto)

# v0.22.0 (2022-01-13)

This release has deprecations. Please read [DEPRECATION] entries and consult
Expand Down
23 changes: 7 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CROSS_BUILD ?= false
# run make BUILD_IN_CONTAINER=false <target>, or you can set BUILD_IN_CONTAINER=true
# as an environment variable.
BUILD_IN_CONTAINER ?= true
BUILD_IMAGE_VERSION := 0.12.0
BUILD_IMAGE_VERSION := 0.13.0
BUILD_IMAGE := $(IMAGE_PREFIX)/agent-build-image:$(BUILD_IMAGE_VERSION)

# Enables the binary to be built with optimizations (i.e., doesn't strip the image of
Expand All @@ -69,14 +69,14 @@ DONT_FIND := -name tools -prune -o -name vendor -prune -o -name .git -prune -o -
# Build flags
VPREFIX := github.com/grafana/agent/pkg/build
GO_LDFLAGS := -X $(VPREFIX).Branch=$(GIT_BRANCH) -X $(VPREFIX).Version=$(IMAGE_TAG) -X $(VPREFIX).Revision=$(GIT_REVISION) -X $(VPREFIX).BuildUser=$(shell whoami)@$(shell hostname) -X $(VPREFIX).BuildDate=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
GO_FLAGS := -ldflags "-extldflags \"-static\" -s -w $(GO_LDFLAGS)" -tags "netgo static_build"
DEBUG_GO_FLAGS := -gcflags "all=-N -l" -ldflags "-extldflags \"-static\" $(GO_LDFLAGS)" -tags "netgo static_build"
GO_FLAGS := -ldflags "-extldflags \"-static\" -s -w $(GO_LDFLAGS)" -tags "netgo static_build" $(GOFLAGS)
DEBUG_GO_FLAGS := -gcflags "all=-N -l" -ldflags "-extldflags \"-static\" $(GO_LDFLAGS)" -tags "netgo static_build" $(GOFLAGS)
DOCKER_BUILD_FLAGS = --build-arg RELEASE_BUILD=$(RELEASE_BUILD) --build-arg IMAGE_TAG=$(IMAGE_TAG) --build-arg DRONE=$(DRONE)

# We need a separate set of flags for CGO, where building with -static can
# cause problems with some C libraries.
CGO_FLAGS := -ldflags "-s -w $(GO_LDFLAGS)" -tags "netgo"
DEBUG_CGO_FLAGS := -gcflags "all=-N -l" -ldflags "-s -w $(GO_LDFLAGS)" -tags "netgo"
CGO_FLAGS := -ldflags "-s -w $(GO_LDFLAGS)" -tags "netgo" $(GOFLAGS)
DEBUG_CGO_FLAGS := -gcflags "all=-N -l" -ldflags "-s -w $(GO_LDFLAGS)" -tags "netgo" $(GOFLAGS)
# If we're not building the release, use the debug flags instead.
ifeq ($(RELEASE_BUILD),false)
GO_FLAGS = $(DEBUG_GO_FLAGS)
Expand Down Expand Up @@ -224,18 +224,9 @@ lint:

# We have to run test twice: once for all packages with -race and then once
# more without -race for packages that have known race detection issues.
#
# Run tests with -tags=has_network to include tests that require network
# connectivity.
test:
CGO_ENABLED=1 go test $(CGO_FLAGS) -tags=has_network -race -cover -coverprofile=cover.out -p=4 ./...
CGO_ENABLED=1 go test $(CGO_FLAGS) -tags=has_network -cover -coverprofile=cover-norace.out -p=4 ./pkg/integrations/node_exporter ./pkg/logs

e2e/lint:
$(MAKE) -C e2e lint

e2e/test:
$(MAKE) -C e2e test
CGO_ENABLED=1 go test $(CGO_FLAGS) -race -cover -coverprofile=cover.out -p=4 ./...
CGO_ENABLED=1 go test $(CGO_FLAGS) -cover -coverprofile=cover-norace.out -p=4 ./pkg/integrations/node_exporter ./pkg/logs ./pkg/operator ./pkg/util/k8s

clean:
rm -rf cmd/agent/agent
Expand Down
7 changes: 4 additions & 3 deletions build-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Use the loki-build-image as a base as it shares most of the common tooling. We just need some additional tooling for building packages.
FROM grafana/loki-build-image
# Use the loki-build-image as a base as it shares most of the common tooling.
# We just need some additional tooling for building packages.
FROM grafana/loki-build-image:0.18.0

RUN apt-get update && apt-get install -y \
build-essential \
Expand All @@ -12,7 +13,7 @@ RUN apt-get update && apt-get install -y \

# Install dependencies used for the operator
# Keep versions in sync with cmd/agent-operator/DEVELOPERS.md
RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2
RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0

# Fix permissions for /go/bin directory.
RUN chmod 0755 /go/bin
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=false
Expand Down
10 changes: 10 additions & 0 deletions cmd/agent-operator/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ FROM --platform=$BUILDPLATFORM rfratto/seego:latest as build
ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Use custom Go version instead of one prepacked in seego
ENV GOLANG_VERSION 1.17.6
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2
RUN rm -rf /usr/local/go \
&& curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz

COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=true
Expand Down
17 changes: 2 additions & 15 deletions cmd/agent-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/grafana/agent/pkg/operator/logutil"
"github.com/prometheus/common/version"
controller "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"

// Needed for clients.
_ "k8s.io/client-go/plugin/pkg/client/auth"
Expand All @@ -28,27 +27,15 @@ func main() {

logger = setupLogger(logger, cfg)

m, err := cfg.Manager()
op, err := operator.New(logger, cfg)
if err != nil {
level.Error(logger).Log("msg", "unable to create manager", "err", err)
os.Exit(1)
}

if err := m.AddReadyzCheck("running", healthz.Ping); err != nil {
level.Warn(logger).Log("msg", "failed to set up 'running' readyz check", "err", err)
}
if err := m.AddHealthzCheck("running", healthz.Ping); err != nil {
level.Warn(logger).Log("msg", "failed to set up 'running' healthz check", "err", err)
}

if err := operator.New(logger, cfg, m); err != nil {
level.Error(logger).Log("msg", "unable to create operator", "err", err)
os.Exit(1)
}

// Run the manager and wait for a signal to shut down.
level.Info(logger).Log("msg", "starting manager")
if err := m.Start(controller.SetupSignalHandler()); err != nil {
if err := op.Start(controller.SetupSignalHandler()); err != nil {
level.Error(logger).Log("msg", "problem running manager", "err", err)
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=true
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Use custom Go version instead of one prepacked in seego
ENV GOLANG_VERSION 1.16
ENV GOLANG_VERSION 1.17.6
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2
ENV GOLANG_DOWNLOAD_SHA256 231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2
RUN rm -rf /usr/local/go \
&& curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
2 changes: 1 addition & 1 deletion cmd/agentctl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=false
Expand Down
4 changes: 2 additions & 2 deletions cmd/agentctl/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Use custom Go version instead of one prepacked in seego
ENV GOLANG_VERSION 1.16
ENV GOLANG_VERSION 1.17.6
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2
ENV GOLANG_DOWNLOAD_SHA256 231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2
RUN rm -rf /usr/local/go \
&& curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent-crow/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-buster as build
FROM golang:1.17.6-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=true
Expand Down
4 changes: 2 additions & 2 deletions cmd/grafana-agent-crow/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ARG TARGETPLATFORM
ARG BUILDPLATFORM

# Use custom Go version instead of one prepacked in seego
ENV GOLANG_VERSION 1.16
ENV GOLANG_VERSION 1.17.6
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2
ENV GOLANG_DOWNLOAD_SHA256 231654bbf2dab3d86c1619ce799e77b03d96f9b50770297c8f4dff8836fc8ca2
RUN rm -rf /usr/local/go \
&& curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/integrations/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ agent:
# prometheus.global.scrape_interval.
[scrape_interval: <duration> | default = <global_config.scrape_interval>]

# The timtout before considering the scrape a failure. Defaults to
# The timeout before considering the scrape a failure. Defaults to
# prometheus.global.scrape_timeout.
[scrape_timeout: <duration> | default = <global_config.scrape_timeout>]

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/traces-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ scrape_configs:
#
# By default, all methods are enabled, and evaluated in the order specified above.
# Order of evaluation is honored when multiple methods are enabled.
prom_sd_pod_association:
prom_sd_pod_associations:
- [ <string>... ]

# spanmetrics supports aggregating Request, Error and Duration (R.E.D) metrics
Expand Down
6 changes: 0 additions & 6 deletions e2e/Makefile

This file was deleted.

Loading