Skip to content

Commit

Permalink
Merge pull request #13 from grafana/sync-grafana-agent
Browse files Browse the repository at this point in the history
Sync grafana/agent:c6fbc923 into grafana/alloy:main
  • Loading branch information
rfratto authored Feb 29, 2024
2 parents c681d22 + e999635 commit cd81fb9
Show file tree
Hide file tree
Showing 22 changed files with 194 additions and 136 deletions.
111 changes: 64 additions & 47 deletions .drone/drone.yml

Large diffs are not rendered by default.

55 changes: 21 additions & 34 deletions .drone/pipelines/crosscompile.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ local os_arch_tuples = [
// Windows
{ name: 'Windows amd64', os: 'windows', arch: 'amd64' },


// FreeBSD
{ name: 'FreeBSD amd64', os: 'freebsd', arch: 'amd64' },
];
Expand All @@ -37,15 +38,22 @@ local targets = [
local targets_boringcrypto = [
'agent-boringcrypto',
];
local targets_boringcrypto_windows = [
'agent-flow-windows-boringcrypto',
];


local os_arch_types_boringcrypto = [
// Linux boringcrypto
{ name: 'Linux amd64 boringcrypto', os: 'linux', arch: 'amd64', experiment: 'boringcrypto' },
{ name: 'Linux arm64 boringcrypto', os: 'linux', arch: 'arm64', experiment: 'boringcrypto' },
];
local windows_os_arch_types_boringcrypto = [
// Windows boringcrypto
{ name: 'Windows amd64', os: 'windows', arch: 'amd64', experiment: 'cngcrypto' },
];


std.flatMap(function(target) (
local build_environments(targets, tuples, image) = std.flatMap(function(target) (
std.map(function(platform) (
pipelines.linux('Build %s (%s)' % [target, platform.name]) {
local env = {
Expand All @@ -56,47 +64,26 @@ std.flatMap(function(target) (
target: target,

tags: go_tags[platform.os],
},
} + (if 'experiment' in platform then { GOEXPERIMENT: platform.experiment } else { }),

trigger: {
event: ['pull_request'],
},
steps: [{
name: 'Build',
image: build_image.linux,
commands: [
'make generate-ui',
'GO_TAGS="%(tags)s" GOOS=%(GOOS)s GOARCH=%(GOARCH)s GOARM=%(GOARM)s make %(target)s' % env,
],
}],
}
), os_arch_tuples)
), targets) +
std.flatMap(function(target) (
std.map(function(platform) (
pipelines.linux('Build %s (%s)' % [target, platform.name]) {
local env = {
GOOS: platform.os,
GOARCH: platform.arch,
GOARM: if 'arm' in platform then platform.arm else '',
GOEXPERIMENT: platform.experiment,

target: target,

tags: go_tags[platform.os],
},

trigger: {
event: ['pull_request'],
},
steps: [{
name: 'Build',
image: build_image.linux,
image: image,
commands: [
'make generate-ui',
'GO_TAGS="%(tags)s" GOOS=%(GOOS)s GOARCH=%(GOARCH)s GOARM=%(GOARM)s GOEXPERIMENT=%(GOEXPERIMENT)s make %(target)s' % env,
(if 'GOEXPERIMENT' in env
then 'GO_TAGS="%(tags)s" GOOS=%(GOOS)s GOARCH=%(GOARCH)s GOARM=%(GOARM)s GOEXPERIMENT=%(GOEXPERIMENT)s make %(target)s' % env
else 'GO_TAGS="%(tags)s" GOOS=%(GOOS)s GOARCH=%(GOARCH)s GOARM=%(GOARM)s make %(target)s') % env,
],
}],
}
), os_arch_types_boringcrypto)
), targets_boringcrypto)
), tuples)
), targets);

build_environments(targets, os_arch_tuples, build_image.linux) +
build_environments(targets_boringcrypto, os_arch_types_boringcrypto, build_image.linux) +
build_environments(targets_boringcrypto_windows, windows_os_arch_types_boringcrypto, build_image.boringcrypto)
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ v0.40.0 (2024-02-27)

- Add `otelcol.connector.host_info` component to gather usage metrics for cloud users. (@rlankfo, @jcreixell)

- Add Windows boringcrypto build and executable. (@mattdurham)

### Enhancements

- Include line numbers in profiles produced by `pyrsocope.java` component. (@korniltsev)
Expand Down Expand Up @@ -127,6 +129,8 @@ v0.40.0 (2024-02-27)

- Fix an issue where changing the configuration of `loki.write` would cause a panic. (@rfratto)

- Fix issue where registry was not being properly deleted. (@mattdurham)

### Other changes

- Removed support for Windows 2012 in line with Microsoft end of life. (@mattdurham)
Expand Down
23 changes: 16 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
##
## Targets for building binaries:
##
## binaries Compiles all binaries.
## agent Compiles cmd/grafana-agent to $(AGENT_BINARY)
## agent-boringcrypto Compiles cmd/grafana-agent with GOEXPERIMENT=boringcrypto to $(AGENT_BORINGCRYPTO_BINARY)
## agent-flow Compiles cmd/grafana-agent-flow to $(FLOW_BINARY)
## agent-service Compiles cmd/grafana-agent-service to $(SERVICE_BINARY)
## agentctl Compiles cmd/grafana-agentctl to $(AGENTCTL_BINARY)
## operator Compiles cmd/grafana-agent-operator to $(OPERATOR_BINARY)
## binaries Compiles all binaries.
## agent Compiles cmd/grafana-agent to $(AGENT_BINARY)
## agent-boringcrypto Compiles cmd/grafana-agent with GOEXPERIMENT=boringcrypto to $(AGENT_BORINGCRYPTO_BINARY)
## agent-flow Compiles cmd/grafana-agent-flow to $(FLOW_BINARY)
## agent-flow-windows-boringcrypto Compiles cmd/grafana-agent-flow to $(FLOW_BINARY)-windows-boringcrypto
## agent-service Compiles cmd/grafana-agent-service to $(SERVICE_BINARY)
## agentctl Compiles cmd/grafana-agentctl to $(AGENTCTL_BINARY)
## operator Compiles cmd/grafana-agent-operator to $(OPERATOR_BINARY)
##
## Targets for building Docker images:
##
Expand Down Expand Up @@ -98,6 +99,7 @@ AGENTCTL_IMAGE ?= grafana/agentctl:latest
OPERATOR_IMAGE ?= grafana/agent-operator:latest
AGENT_BINARY ?= build/grafana-agent
AGENT_BORINGCRYPTO_BINARY ?= build/grafana-agent-boringcrypto
AGENT_BORINGCRYPTO_WINDOWS_BINARY ?= build/agent-flow-windows-boringcrypto.exe
FLOW_BINARY ?= build/grafana-agent-flow
SERVICE_BINARY ?= build/grafana-agent-service
AGENTCTL_BINARY ?= build/grafana-agentctl
Expand Down Expand Up @@ -192,6 +194,13 @@ else
GOEXPERIMENT=boringcrypto $(GO_ENV) go build $(GO_FLAGS) -o $(AGENT_BORINGCRYPTO_BINARY) ./cmd/grafana-agent
endif

agent-flow-windows-boringcrypto:
ifeq ($(USE_CONTAINER),1)
$(RERUN_IN_CONTAINER)
else
GOEXPERIMENT=cngcrypto $(GO_ENV) go build $(GO_FLAGS) -tags cngcrypto -o $(AGENT_BORINGCRYPTO_WINDOWS_BINARY) ./cmd/grafana-agent-flow
endif


agent-flow:
ifeq ($(USE_CONTAINER),1)
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent-operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.4 as build
FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.32.0 as build
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.4 as build
FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.32.0 as build
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM grafana/agent-build-image:0.30.4-windows as builder
FROM grafana/agent-build-image:0.32.0-windows as builder
ARG VERSION
ARG RELEASE_BUILD=1

Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agentctl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.4 as build
FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.32.0 as build
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agentctl/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM grafana/agent-build-image:0.30.4-windows as builder
FROM grafana/agent-build-image:0.32.0-windows as builder
ARG VERSION
ARG RELEASE_BUILD=1

Expand Down
4 changes: 2 additions & 2 deletions component/common/net/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ func (g *GRPCConfig) Into(c *dskit.Config) {
c.GRPCServerMaxConnectionAge = g.MaxConnectionAge
c.GRPCServerMaxConnectionAgeGrace = g.MaxConnectionAgeGrace
c.GRPCServerMaxConnectionIdle = g.MaxConnectionIdle
c.GPRCServerMaxRecvMsgSize = g.ServerMaxRecvMsg
c.GRPCServerMaxRecvMsgSize = g.ServerMaxRecvMsg
c.GRPCServerMaxSendMsgSize = g.ServerMaxSendMsg
c.GPRCServerMaxConcurrentStreams = g.ServerMaxConcurrentStreams
c.GRPCServerMaxConcurrentStreams = g.ServerMaxConcurrentStreams
}

// Convert converts the River-based ServerConfig into a dskit.Config object.
Expand Down
8 changes: 4 additions & 4 deletions component/common/net/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestConfig(t *testing.T) {
require.Equal(t, time.Second*30, config.ServerGracefulShutdownTimeout)

require.Equal(t, size4MB, config.GRPCServerMaxSendMsgSize)
require.Equal(t, size4MB, config.GPRCServerMaxRecvMsgSize)
require.Equal(t, size4MB, config.GRPCServerMaxRecvMsgSize)
},
},
"overriding defaults": {
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestConfig(t *testing.T) {
require.Equal(t, "0.0.0.0", config.GRPCListenAddress)
require.Equal(t, 10, config.GRPCServerMaxSendMsgSize)
// this should have the default applied
require.Equal(t, size4MB, config.GPRCServerMaxRecvMsgSize)
require.Equal(t, size4MB, config.GRPCServerMaxRecvMsgSize)

require.Equal(t, time.Minute, config.ServerGracefulShutdownTimeout)
},
Expand Down Expand Up @@ -141,9 +141,9 @@ func TestConfig(t *testing.T) {
require.Equal(t, 5*time.Minute, config.GRPCServerMaxConnectionAge)
require.Equal(t, 6*time.Minute, config.GRPCServerMaxConnectionAgeGrace)
require.Equal(t, 7*time.Minute, config.GRPCServerMaxConnectionIdle)
require.Equal(t, 5, config.GPRCServerMaxRecvMsgSize)
require.Equal(t, 5, config.GRPCServerMaxRecvMsgSize)
require.Equal(t, 6, config.GRPCServerMaxSendMsgSize)
require.Equal(t, uint(7), config.GPRCServerMaxConcurrentStreams)
require.Equal(t, uint(7), config.GRPCServerMaxConcurrentStreams)
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (s *PushAPIServer) getRelabelRules() []*relabel.Config {
func (s *PushAPIServer) handleLoki(w http.ResponseWriter, r *http.Request) {
logger := util_log.WithContext(r.Context(), util_log.Logger)
userID, _ := tenant.TenantID(r.Context())
req, err := push.ParseRequest(logger, userID, r, nil)
req, err := push.ParseRequest(logger, userID, r, nil, nil, push.ParseLokiRequest)
if err != nil {
level.Warn(s.logger).Log("msg", "failed to parse incoming push request", "err", err.Error())
http.Error(w, err.Error(), http.StatusBadRequest)
Expand Down
4 changes: 2 additions & 2 deletions converter/internal/common/weaveworks_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func WeaveWorksServerToFlowServer(config server.Config) *fnet.ServerConfig {
MaxConnectionAge: config.GRPCServerMaxConnectionAge,
MaxConnectionAgeGrace: config.GRPCServerMaxConnectionAgeGrace,
MaxConnectionIdle: config.GRPCServerMaxConnectionIdle,
ServerMaxRecvMsg: config.GPRCServerMaxRecvMsgSize,
ServerMaxRecvMsg: config.GRPCServerMaxRecvMsgSize,
ServerMaxSendMsg: config.GRPCServerMaxSendMsgSize,
ServerMaxConcurrentStreams: config.GPRCServerMaxConcurrentStreams,
ServerMaxConcurrentStreams: config.GRPCServerMaxConcurrentStreams,
},
GracefulShutdownTimeout: config.ServerGracefulShutdownTimeout,
}
Expand Down
18 changes: 11 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ require (
github.com/gorilla/mux v1.8.0
github.com/grafana/ckit v0.0.0-20230906125525-c046c99a5c04
github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2
github.com/grafana/dskit v0.0.0-20230829141140-06955c011ffd
github.com/grafana/dskit v0.0.0-20240104111617-ea101a3b86eb
github.com/grafana/go-gelf/v2 v2.0.1
// Loki main commit where the Prometheus dependency matches ours. TODO(@tpaschalis) Update to kXYZ branch once it's available
github.com/grafana/loki v1.6.2-0.20231004111112-07cbef92268a
github.com/grafana/loki v1.6.2-0.20240221085104-f9d188620153 // k190 branch
github.com/grafana/pyroscope-go/godeltaprof v0.1.7
github.com/grafana/pyroscope/api v0.4.0
github.com/grafana/pyroscope/ebpf v0.4.3
Expand All @@ -81,7 +80,7 @@ require (
github.com/hashicorp/vault/api/auth/userpass v0.2.0
github.com/heroku/x v0.0.61
github.com/iamseth/oracledb_exporter v0.0.0-20230918193147-95e16f21ceee
github.com/influxdata/go-syslog/v3 v3.0.1-0.20210608084020-ac565dc76ba6
github.com/influxdata/go-syslog/v3 v3.0.1-0.20230911200830-875f5bc594a4
github.com/jaegertracing/jaeger v1.50.0
github.com/jmespath/go-jmespath v0.4.0
github.com/json-iterator/go v1.1.12
Expand Down Expand Up @@ -303,7 +302,7 @@ require (
github.com/blang/semver v3.5.2-0.20180723201105-3c1074078d32+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/boynux/squid-exporter v1.10.5-0.20230618153315-c1fae094e18e
github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee // indirect
github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b // indirect
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
Expand Down Expand Up @@ -393,7 +392,7 @@ require (
github.com/gophercloud/gophercloud v1.7.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gosnmp/gosnmp v1.36.0 // indirect
github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9 // indirect
github.com/grafana/gomemcache v0.0.0-20231204155601-7de47a8c3cb0 // indirect
github.com/grafana/loki/pkg/push v0.0.0-20231212100434-384e5c2dc872 // k180 branch
github.com/grobie/gomemcache v0.0.0-20230213081705-239240bbc445 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
Expand Down Expand Up @@ -624,6 +623,7 @@ require (
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.2.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.2.1 // indirect
github.com/DataDog/sketches-go v1.4.4 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.20.0 // indirect
github.com/Shopify/sarama v1.38.1 // indirect
github.com/Showmax/go-fqdn v1.0.0 // indirect
Expand All @@ -638,15 +638,19 @@ require (
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.27.0 // indirect
github.com/aws/aws-sdk-go-v2/service/shield v1.24.0 // indirect
github.com/aws/aws-sdk-go-v2/service/storagegateway v1.26.0 // indirect
github.com/axiomhq/hyperloglog v0.0.0-20240124082744-24bca3a5b39b // indirect
github.com/channelmeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc // indirect
github.com/drone/envsubst v1.0.3 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/grafana/jfr-parser v0.8.0 // indirect
github.com/grafana/jsonparser v0.0.0-20240209175146-098958973a2d // indirect
github.com/hetznercloud/hcloud-go/v2 v2.4.0 // indirect
github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/knadh/koanf/v2 v2.0.1 // indirect
github.com/lightstep/go-expohisto v1.0.0 // indirect
Expand All @@ -664,7 +668,7 @@ require (
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/prometheus-community/prom-label-proxy v0.6.0 // indirect
github.com/sercand/kuberesolver/v4 v4.0.0 // indirect
github.com/sercand/kuberesolver/v5 v5.1.1 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/sony/gobreaker v0.5.0 // indirect
github.com/tidwall/gjson v1.10.2 // indirect
Expand Down
Loading

0 comments on commit cd81fb9

Please sign in to comment.