From 04295c4a2e8bb080333c806cb1f40c14efbc3460 Mon Sep 17 00:00:00 2001 From: Piotr <17101802+thampiotr@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:00:52 +0000 Subject: [PATCH 1/6] Update loki dep to k190 (#6543) * Update loki dep to k190 * port renames * fix loki push api --- component/common/net/config.go | 4 +-- component/common/net/config_test.go | 8 ++--- .../api/internal/lokipush/push_api_server.go | 2 +- .../internal/common/weaveworks_server.go | 4 +-- go.mod | 18 ++++++---- go.sum | 34 +++++++++++++------ pkg/logs/logs_test.go | 2 +- 7 files changed, 45 insertions(+), 27 deletions(-) diff --git a/component/common/net/config.go b/component/common/net/config.go index 6ce1ae0bdd..444627bf50 100644 --- a/component/common/net/config.go +++ b/component/common/net/config.go @@ -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. diff --git a/component/common/net/config_test.go b/component/common/net/config_test.go index 1e296ed695..0eb8bf1082 100644 --- a/component/common/net/config_test.go +++ b/component/common/net/config_test.go @@ -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": { @@ -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) }, @@ -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) }, }, } diff --git a/component/loki/source/api/internal/lokipush/push_api_server.go b/component/loki/source/api/internal/lokipush/push_api_server.go index 9a9a20f759..d2813d2755 100644 --- a/component/loki/source/api/internal/lokipush/push_api_server.go +++ b/component/loki/source/api/internal/lokipush/push_api_server.go @@ -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) diff --git a/converter/internal/common/weaveworks_server.go b/converter/internal/common/weaveworks_server.go index 9211ca47f4..5fa665d77e 100644 --- a/converter/internal/common/weaveworks_server.go +++ b/converter/internal/common/weaveworks_server.go @@ -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, } diff --git a/go.mod b/go.mod index deab3814d8..81e677a27a 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/go.sum b/go.sum index f756dab4a7..95dd6c93ba 100644 --- a/go.sum +++ b/go.sum @@ -181,6 +181,10 @@ github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20O github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v0.0.0-20160329135253-cc2f4770f4d6/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/sketches-go v1.4.4 h1:dF52vzXRFSPOj2IjXSWLvXq3jubL4CI69kwYjJ1w5Z8= +github.com/DataDog/sketches-go v1.4.4/go.mod h1:XR0ns2RtEEF09mDKXiKZiQg+nfZStrq1ZuL1eezeZe0= +github.com/DmitriyVTitov/size v1.5.0 h1:/PzqxYrOyOUX1BXj6J9OuVRVGe+66VL4D9FlUaW515g= +github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0= github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 h1:KeNholpO2xKjgaaSyd+DyQRrsQjhbSeS7qe4nEw8aQw= github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962/go.mod h1:kC29dT1vFpj7py2OvG1khBdQpo3kInWP+6QipLbdngo= github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.20.0 h1:tk85AYGwOf6VNtoOQi8w/kVDi2vmPxp3/OU2FsUpdcA= @@ -387,6 +391,8 @@ github.com/aws/smithy-go v1.5.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAm github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.20.0 h1:6+kZsCXZwKxZS9RfISnPc4EXlHoyAkm2hPuM8X2BrrQ= github.com/aws/smithy-go v1.20.0/go.mod h1:uo5RKksAl4PzhqaAbjd4rLgFoq5koTsQKYuGe7dklGc= +github.com/axiomhq/hyperloglog v0.0.0-20240124082744-24bca3a5b39b h1:F3yMzKumBUQ6Fn0sYI1YQ16vQRucpZOfBQ9HXWl5+XI= +github.com/axiomhq/hyperloglog v0.0.0-20240124082744-24bca3a5b39b/go.mod h1:k08r+Yj1PRAmuayFiRK6MYuR5Ve4IuZtTfxErMIh0+c= github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48= github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0/go.mod h1:6L7zgvqo0idzI7IO8de6ZC051AfXb5ipkIJ7bIA2tGA= github.com/basgys/goxml2json v1.1.0 h1:4ln5i4rseYfXNd86lGEB+Vi652IsIXIvggKM/BhUKVw= @@ -423,8 +429,8 @@ github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx2 github.com/burningalchemist/sql_exporter v0.0.0-20240103092044-466b38b6abc4 h1:dgjwrjeVe90AeMhrx04TmDKjZe7xqKKEUxT3QKNx9RU= github.com/burningalchemist/sql_exporter v0.0.0-20240103092044-466b38b6abc4/go.mod h1:aRr7CZ/KleZpcDkQVsNeXE1BFT3xRG8baUHJ7J+j8NI= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee h1:BnPxIde0gjtTnc9Er7cxvBk8DHLWhEux0SxayC8dP6I= -github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= +github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b h1:6+ZFm0flnudZzdSE0JxlhR2hKnGPcNB35BjQf4RYQDY= +github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M= github.com/caio/go-tdigest v2.3.0+incompatible/go.mod h1:sHQM/ubZStBUmF1WbB8FAm8q9GjDajLC5T7ydxE3JHI= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/casbin/casbin/v2 v2.31.6/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= @@ -552,6 +558,8 @@ github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8l github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mzjeJY= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1/go.mod h1:+hnT3ywWDTAFrW5aE+u2Sa/wT555ZqwoCS+pk3p6ry4= +github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc h1:8WFBn63wegobsYAX0YjD+8suexZDga5CctH4CCTx2+8= +github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/digitalocean/godo v1.1.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= @@ -1039,19 +1047,21 @@ github.com/grafana/ckit v0.0.0-20230906125525-c046c99a5c04 h1:tG8Qxq4dN1WqakMmsP github.com/grafana/ckit v0.0.0-20230906125525-c046c99a5c04/go.mod h1:HOnDIbkxfvVlDM5FBujt0uawGLfdpdTeqE7fIwfBmQk= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 h1:qhugDMdQ4Vp68H0tp/0iN17DM2ehRo1rLEdOFe/gB8I= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2/go.mod h1:w/aiO1POVIeXUQyl0VQSZjl5OAGDTL5aX+4v0RA1tcw= -github.com/grafana/dskit v0.0.0-20230829141140-06955c011ffd h1:RHZuBHWNS2HRJ5XhQK7cKP11EMMJPtJO2xKvQ+ws+PU= -github.com/grafana/dskit v0.0.0-20230829141140-06955c011ffd/go.mod h1:3u7fr4hmOhuUL9Yc1QP/oa3za73kxvqJnRJH4BA5fOM= +github.com/grafana/dskit v0.0.0-20240104111617-ea101a3b86eb h1:AWE6+kvtE18HP+lRWNUCyvymyrFSXs6TcS2vXIXGIuw= +github.com/grafana/dskit v0.0.0-20240104111617-ea101a3b86eb/go.mod h1:kkWM4WUV230bNG3urVRWPBnSJHs64y/0RmWjftnnn0c= github.com/grafana/go-gelf/v2 v2.0.1 h1:BOChP0h/jLeD+7F9mL7tq10xVkDG15he3T1zHuQaWak= github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD4s0CLobh90= github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85/go.mod h1:crI9WX6p0IhrqB+DqIUHulRW853PaNFf7o4UprV//3I= -github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9 h1:WB3bGH2f1UN6jkd6uAEWfHB8OD7dKJ0v2Oo6SNfhpfQ= -github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU= +github.com/grafana/gomemcache v0.0.0-20231204155601-7de47a8c3cb0 h1:aLBiDMjTtXx2800iCIp+8kdjIlvGX0MF/zICQMQO2qU= +github.com/grafana/gomemcache v0.0.0-20231204155601-7de47a8c3cb0/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU= github.com/grafana/jfr-parser v0.8.0 h1:/uo2wZNXrxw7tKLFwP2omJ3EQGMkD9wzhPsRogVofc0= github.com/grafana/jfr-parser v0.8.0/go.mod h1:M5u1ux34Qo47ZBWksbMYVk40s7dvU3WMVYpxweEu4R0= github.com/grafana/jfr-parser/pprof v0.0.0-20240126072739-986e71dc0361 h1:TtNajaiSRfM2Mz8N7ouFQDFlviXbIEk9Hts0yoZnhGM= github.com/grafana/jfr-parser/pprof v0.0.0-20240126072739-986e71dc0361/go.mod h1:P5406BrWxjahTzVF6aCSumNI1KPlZJc0zO0v+zKZ4gc= -github.com/grafana/loki v1.6.2-0.20231004111112-07cbef92268a h1:lvSHlNONeo/H+aWRk86QEfBpRDCEX1yoqpsCK0Tys+g= -github.com/grafana/loki v1.6.2-0.20231004111112-07cbef92268a/go.mod h1:a5c5ZTC6FNufKkvF8NeDAb2nCWJpgkVDrejmV+O9hac= +github.com/grafana/jsonparser v0.0.0-20240209175146-098958973a2d h1:YwbJJ/PrVWVdnR+j/EAVuazdeP+Za5qbiH1Vlr+wFXs= +github.com/grafana/jsonparser v0.0.0-20240209175146-098958973a2d/go.mod h1:796sq+UcONnSlzA3RtlBZ+b/hrerkZXiEmO8oMjyRwY= +github.com/grafana/loki v1.6.2-0.20240221085104-f9d188620153 h1:C191g5Ls8lIf9lkJEoScTQgoVDwUdK4HXKP5XtL+zAM= +github.com/grafana/loki v1.6.2-0.20240221085104-f9d188620153/go.mod h1:j2XCl3SmslPf+3Vs7uyoaJE/QkmUlL9JzTBTShSOSiU= github.com/grafana/loki/pkg/push v0.0.0-20231212100434-384e5c2dc872 h1:6kPX7bngjBgUlHqADwZ6249UtzMaoQW5n0H8bOtnYeM= github.com/grafana/loki/pkg/push v0.0.0-20231212100434-384e5c2dc872/go.mod h1:f3JSoxBTPXX5ec4FxxeC19nTBSxoTz+cBgS3cYLMcr0= github.com/grafana/mysqld_exporter v0.12.2-0.20231005125903-364b9c41e595 h1:I9sRknI5ajd8whPOX0nBDXy5B6xUfhItClMy+6R4oqE= @@ -1291,11 +1301,13 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf github.com/infinityworks/go-common v0.0.0-20170820165359-7f20a140fd37 h1:Lm6kyC3JBiJQvJrus66He0E4viqDc/m5BdiFNSkIFfU= github.com/infinityworks/go-common v0.0.0-20170820165359-7f20a140fd37/go.mod h1:+OaHNKQvQ9oOCr+DgkF95PkiDx20fLHpzMp8SmRPQTg= github.com/influxdata/go-syslog/v2 v2.0.1/go.mod h1:hjvie1UTaD5E1fTnDmxaCw8RRDrT4Ve+XHr5O2dKSCo= -github.com/influxdata/go-syslog/v3 v3.0.1-0.20210608084020-ac565dc76ba6 h1:s9ZL6ZhFF8y6ebnm1FLvobkzoIu5xwDQUcRPk/IEhpM= -github.com/influxdata/go-syslog/v3 v3.0.1-0.20210608084020-ac565dc76ba6/go.mod h1:aXdIdfn2OcGnMhOTojXmwZqXKgC3MU5riiNvzwwG9OY= +github.com/influxdata/go-syslog/v3 v3.0.1-0.20230911200830-875f5bc594a4 h1:2r2WiFeAwiJ/uyx1qIKnV1L4C9w/2V8ehlbJY4gjFaM= +github.com/influxdata/go-syslog/v3 v3.0.1-0.20230911200830-875f5bc594a4/go.mod h1:1yEQhaLb/cETXCqQmdh7lDjupNAReO7c83AHyK2dJ48= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/tail v1.0.1-0.20200707181643-03a791b270e4/go.mod h1:VeiWgI3qaGdJWust2fP27a6J+koITo/1c/UhxeOxgaM= +github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b h1:i44CesU68ZBRvtCjBi3QSosCIKrjmMbYlQMFAwVLds4= +github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b/go.mod h1:Z0kXnxzbTC2qrx4NaIzYkE1k66+6oEDQTvL95hQFh5Y= github.com/influxdata/telegraf v1.16.3 h1:x0qeuSGGMg5y+YqP/5ZHwXZu3bcBrO8AAQOTNlYEb1c= github.com/influxdata/telegraf v1.16.3/go.mod h1:fX/6k7qpIqzVPWyeIamb0wN5hbwc0ANUaTS80lPYFB8= github.com/influxdata/toml v0.0.0-20190415235208-270119a8ce65/go.mod h1:zApaNFpP/bTpQItGZNNUMISDMDAnTXu9UqJ4yT3ocz8= @@ -2921,9 +2933,11 @@ golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4/go.mod h1:U gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.6.2/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= +gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.0.0-20180829000535-087779f1d2c9/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= diff --git a/pkg/logs/logs_test.go b/pkg/logs/logs_test.go index 1f542b8813..ca25a50905 100644 --- a/pkg/logs/logs_test.go +++ b/pkg/logs/logs_test.go @@ -54,7 +54,7 @@ func TestLogs(t *testing.T) { }) go func() { _ = http.Serve(lis, http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - req, err := push.ParseRequest(log.NewNopLogger(), "user_id", r, nil) + req, err := push.ParseRequest(log.NewNopLogger(), "user_id", r, nil, nil, push.ParseLokiRequest) require.NoError(t, err) pushes <- req From 92d888eb15ad93ebaa42e289f1e07ac66d71f1f4 Mon Sep 17 00:00:00 2001 From: mattdurham Date: Wed, 28 Feb 2024 14:33:14 -0500 Subject: [PATCH 2/6] Add windows build for boring crypto (#6535) * Add windows build for boring crypto * add changelog * add details on cngcrypto and fips * put some jsonnet into a function Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com> --------- Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com> Co-authored-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com> --- .drone/drone.yml | 133 +++++++++++++----------- .drone/pipelines/crosscompile.jsonnet | 55 ++++------ CHANGELOG.md | 2 + Makefile | 23 ++-- cmd/grafana-agent-operator/Dockerfile | 2 +- cmd/grafana-agent/Dockerfile | 2 +- cmd/grafana-agent/Dockerfile.windows | 2 +- cmd/grafana-agentctl/Dockerfile | 2 +- cmd/grafana-agentctl/Dockerfile.windows | 2 +- pkg/boringcrypto/disabled.go | 6 +- pkg/boringcrypto/enabled.go | 6 +- tools/make/build-container.mk | 2 +- tools/make/packaging.mk | 30 ++++-- 13 files changed, 151 insertions(+), 116 deletions(-) diff --git a/.drone/drone.yml b/.drone/drone.yml index f521c097fe..1070b7e0be 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -110,7 +110,7 @@ steps: - commands: - apt-get update -y && apt-get install -y libsystemd-dev - make lint - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Lint trigger: event: @@ -128,7 +128,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Regenerate dashboards trigger: event: @@ -146,7 +146,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Regenerate crds trigger: event: @@ -161,7 +161,7 @@ platform: steps: - commands: - make GO_TAGS="nodocker" test - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Run Go tests trigger: event: @@ -176,7 +176,7 @@ platform: steps: - commands: - K8S_USE_DOCKER_NETWORK=1 make test - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Run Go tests volumes: - name: docker @@ -199,7 +199,7 @@ platform: steps: - commands: - go test -tags="nodocker,nonetwork" ./... - image: grafana/agent-build-image:0.31.0-windows + image: grafana/agent-build-image:0.32.0-windows name: Run Go tests trigger: ref: @@ -214,7 +214,7 @@ platform: steps: - commands: - make agent-image - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build container volumes: - name: docker @@ -239,7 +239,7 @@ platform: steps: - commands: - make agentctl-image - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build container volumes: - name: docker @@ -264,7 +264,7 @@ platform: steps: - commands: - make operator-image - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build container volumes: - name: docker @@ -290,7 +290,7 @@ platform: steps: - commands: - '& "C:/Program Files/git/bin/bash.exe" ./tools/ci/docker-containers-windows agent' - image: grafana/agent-build-image:0.31.0-windows + image: grafana/agent-build-image:0.32.0-windows name: Build container volumes: - name: docker @@ -316,7 +316,7 @@ platform: steps: - commands: - '& "C:/Program Files/git/bin/bash.exe" ./tools/ci/docker-containers-windows agentctl' - image: grafana/agent-build-image:0.31.0-windows + image: grafana/agent-build-image:0.32.0-windows name: Build container volumes: - name: docker @@ -343,7 +343,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -360,7 +360,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -377,7 +377,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -394,7 +394,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -410,7 +410,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -426,7 +426,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -442,7 +442,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -458,7 +458,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make agent - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -475,7 +475,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -492,7 +492,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -509,7 +509,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -526,7 +526,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -542,7 +542,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make agent-flow - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -558,7 +558,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make agent-flow - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -574,7 +574,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make agent-flow - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -590,7 +590,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make agent-flow - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -607,7 +607,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -624,7 +624,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -641,7 +641,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -658,7 +658,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -674,7 +674,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -690,7 +690,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -706,7 +706,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -722,7 +722,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make agentctl - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -739,7 +739,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -756,7 +756,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=arm64 GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -773,7 +773,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=ppc64le GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -790,7 +790,7 @@ steps: - make generate-ui - GO_TAGS="builtinassets promtail_journal_enabled" GOOS=linux GOARCH=s390x GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -806,7 +806,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -822,7 +822,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -838,7 +838,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -854,7 +854,7 @@ steps: - commands: - make generate-ui - GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make operator - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -871,7 +871,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Build trigger: event: @@ -888,7 +888,24 @@ 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.31.0 + image: grafana/agent-build-image:0.32.0 + name: Build +trigger: + event: + - pull_request +type: docker +--- +kind: pipeline +name: Build agent-flow-windows-boringcrypto (Windows amd64) +platform: + arch: amd64 + os: linux +steps: +- commands: + - make generate-ui + - GO_TAGS="builtinassets" GOOS=windows GOARCH=amd64 GOARM= GOEXPERIMENT=cngcrypto + make agent-flow-windows-boringcrypto + image: grafana/agent-build-image:0.32.0-boringcrypto name: Build trigger: event: @@ -904,7 +921,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Configure QEMU volumes: - name: docker @@ -924,7 +941,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Publish container volumes: - name: docker @@ -948,7 +965,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Configure QEMU volumes: - name: docker @@ -968,7 +985,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Publish container volumes: - name: docker @@ -992,7 +1009,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Configure QEMU volumes: - name: docker @@ -1012,7 +1029,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Publish container volumes: - name: docker @@ -1036,7 +1053,7 @@ steps: - commands: - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes failure: ignore - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Configure QEMU volumes: - name: docker @@ -1056,7 +1073,7 @@ steps: from_secret: docker_password GCR_CREDS: from_secret: gcr_admin - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Publish container volumes: - name: docker @@ -1085,7 +1102,7 @@ steps: from_secret: docker_login DOCKER_PASSWORD: from_secret: docker_password - image: grafana/agent-build-image:0.31.0-windows + image: grafana/agent-build-image:0.32.0-windows name: Build containers volumes: - name: docker @@ -1114,7 +1131,7 @@ steps: from_secret: docker_login DOCKER_PASSWORD: from_secret: docker_password - image: grafana/agent-build-image:0.31.0-windows + image: grafana/agent-build-image:0.32.0-windows name: Build containers volumes: - name: docker @@ -1231,7 +1248,7 @@ steps: from_secret: gpg_private_key GPG_PUBLIC_KEY: from_secret: gpg_public_key - image: grafana/agent-build-image:0.31.0 + image: grafana/agent-build-image:0.32.0 name: Publish release volumes: - name: docker @@ -1256,7 +1273,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.31.0 + image: grafana/agent-build-image:0.32.0 name: Test Linux system packages volumes: - name: docker @@ -1352,6 +1369,6 @@ kind: secret name: updater_private_key --- kind: signature -hmac: 2e439110a89f33a78d745a71635d47f9b1a99de6028bb84c258a0be9c09840f2 +hmac: de5b1d2ea6f503ff78e6ed296cde31239b68c60c75b443cf0f06610a79013682 ... diff --git a/.drone/pipelines/crosscompile.jsonnet b/.drone/pipelines/crosscompile.jsonnet index f03a3d4674..6c6f7b2446 100644 --- a/.drone/pipelines/crosscompile.jsonnet +++ b/.drone/pipelines/crosscompile.jsonnet @@ -22,6 +22,7 @@ local os_arch_tuples = [ // Windows { name: 'Windows amd64', os: 'windows', arch: 'amd64' }, + // FreeBSD { name: 'FreeBSD amd64', os: 'freebsd', arch: 'amd64' }, ]; @@ -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 = { @@ -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) \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f2f9f9f4..e621e601b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Makefile b/Makefile index f08f0f9d89..4281a954d6 100644 --- a/Makefile +++ b/Makefile @@ -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: ## @@ -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 @@ -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) diff --git a/cmd/grafana-agent-operator/Dockerfile b/cmd/grafana-agent-operator/Dockerfile index a86af13209..3759851610 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.4 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.32.0 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS diff --git a/cmd/grafana-agent/Dockerfile b/cmd/grafana-agent/Dockerfile index f151d43fd0..9fcdce56b6 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.4 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.32.0 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS diff --git a/cmd/grafana-agent/Dockerfile.windows b/cmd/grafana-agent/Dockerfile.windows index 454c93450e..48b40c3d15 100644 --- a/cmd/grafana-agent/Dockerfile.windows +++ b/cmd/grafana-agent/Dockerfile.windows @@ -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 diff --git a/cmd/grafana-agentctl/Dockerfile b/cmd/grafana-agentctl/Dockerfile index d04f1816ef..a96ac1a6a8 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.4 as build +FROM --platform=$BUILDPLATFORM grafana/agent-build-image:0.32.0 as build ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETOS diff --git a/cmd/grafana-agentctl/Dockerfile.windows b/cmd/grafana-agentctl/Dockerfile.windows index 80d32f8667..5345428ce4 100644 --- a/cmd/grafana-agentctl/Dockerfile.windows +++ b/cmd/grafana-agentctl/Dockerfile.windows @@ -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 diff --git a/pkg/boringcrypto/disabled.go b/pkg/boringcrypto/disabled.go index f1b6e3b8d3..84569b630e 100644 --- a/pkg/boringcrypto/disabled.go +++ b/pkg/boringcrypto/disabled.go @@ -1,4 +1,8 @@ -//go:build !(fips || boringcrypto) +//go:build !(fips || boringcrypto || cngcrypto) + +// fips https://boringssl.googlesource.com/boringssl/+/master/crypto/fipsmodule/FIPS.md +// fips and boringcrytpo are for enabling via linux experiment using the goexperiment=boringcrytpo flag +// cngcrypto is used for windows builds that use https://github.com/microsoft/go fork, and is passed has a tag and experiment. package boringcrypto diff --git a/pkg/boringcrypto/enabled.go b/pkg/boringcrypto/enabled.go index 156370c88d..eddecceef2 100644 --- a/pkg/boringcrypto/enabled.go +++ b/pkg/boringcrypto/enabled.go @@ -1,4 +1,8 @@ -//go:build fips || boringcrypto +//go:build fips || boringcrypto || cngcrypto + +// fips https://boringssl.googlesource.com/boringssl/+/master/crypto/fipsmodule/FIPS.md +// fips and boringcrytpo are for enabling via linux experiment using the goexperiment=boringcrytpo flag +// cngcrypto is used for windows builds that use https://github.com/microsoft/go fork, and is passed has a tag and experiment. package boringcrypto diff --git a/tools/make/build-container.mk b/tools/make/build-container.mk index be1d4be9ca..22a502e4d9 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.31.0 +BUILD_IMAGE_VERSION ?= 0.32.0 BUILD_IMAGE ?= grafana/agent-build-image:$(BUILD_IMAGE_VERSION) DOCKER_OPTS ?= -it diff --git a/tools/make/packaging.mk b/tools/make/packaging.mk index c9421433e6..18c8569c4f 100644 --- a/tools/make/packaging.mk +++ b/tools/make/packaging.mk @@ -20,15 +20,15 @@ PACKAGING_VARS = RELEASE_BUILD=1 GO_TAGS="$(GO_TAGS)" GOOS=$(GOOS) GOARCH=$(GOAR # agent release binaries # -dist-agent-binaries: dist/grafana-agent-linux-amd64 \ - dist/grafana-agent-linux-arm64 \ - dist/grafana-agent-linux-ppc64le \ - dist/grafana-agent-linux-s390x \ - dist/grafana-agent-darwin-amd64 \ - dist/grafana-agent-darwin-arm64 \ - dist/grafana-agent-windows-amd64.exe \ - dist/grafana-agent-freebsd-amd64 \ - dist/grafana-agent-linux-amd64-boringcrypto \ +dist-agent-binaries: dist/grafana-agent-linux-amd64 \ + dist/grafana-agent-linux-arm64 \ + dist/grafana-agent-linux-ppc64le \ + dist/grafana-agent-linux-s390x \ + dist/grafana-agent-darwin-amd64 \ + dist/grafana-agent-darwin-arm64 \ + dist/grafana-agent-windows-amd64.exe \ + dist/grafana-agent-windows-boringcrypto-amd64.exe \ + dist/grafana-agent-freebsd-amd64 \ dist/grafana-agent-linux-arm64-boringcrypto dist/grafana-agent-linux-amd64: GO_TAGS += netgo builtinassets promtail_journal_enabled @@ -78,6 +78,18 @@ dist/grafana-agent-windows-amd64.exe: GOARCH := amd64 dist/grafana-agent-windows-amd64.exe: generate-ui $(PACKAGING_VARS) AGENT_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) agent +# NOTE(rfratto): do not use netgo when building Windows binaries, which +# prevents DNS short names from being resovable. See grafana/agent#4665. +# +# TODO(rfratto): add netgo back to Windows builds if a version of Go is +# released which natively supports resolving DNS short names on Windows. +dist/grafana-agent-windows-boringcrypto-amd64.exe: GO_TAGS += builtinassets +dist/grafana-agent-windows-boringcrypto-amd64.exe: GOOS := windows +dist/grafana-agent-windows-boringcrypto-amd64.exe: GOARCH := amd64 +dist/grafana-agent-windows-boringcrypto-amd64.exe: generate-ui + $(PACKAGING_VARS) AGENT_BINARY=$@ "$(MAKE)" -f $(PARENT_MAKEFILE) agent + + dist/grafana-agent-freebsd-amd64: GO_TAGS += netgo builtinassets dist/grafana-agent-freebsd-amd64: GOOS := freebsd dist/grafana-agent-freebsd-amd64: GOARCH := amd64 From c6fbc9236ca6051d612a627b8099a02482beefcc Mon Sep 17 00:00:00 2001 From: mattdurham Date: Wed, 28 Feb 2024 16:23:19 -0500 Subject: [PATCH 3/6] Fix reg delete (#6550) * fix issue with 64 bit registry * fix issue with 64 bit registry --- CHANGELOG.md | 2 ++ packaging/grafana-agent-flow/windows/install_script.nsis | 6 ++++-- packaging/grafana-agent/windows/install_script.nsis | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e621e601b8..183490b615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -129,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) diff --git a/packaging/grafana-agent-flow/windows/install_script.nsis b/packaging/grafana-agent-flow/windows/install_script.nsis index 469a2cbd97..5e253890c2 100644 --- a/packaging/grafana-agent-flow/windows/install_script.nsis +++ b/packaging/grafana-agent-flow/windows/install_script.nsis @@ -193,6 +193,8 @@ Section "uninstall" RMDir /r "$APPDATA\${APPNAME}" # Application data. # Remove service and uninstaller information from the registry. - DeleteRegKey HKLM "Software\Grafana\Grafana Agent Flow" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" + nsExec::ExecToLog 'Reg.exe delete "HKLM\SOFTWARE\Grafana\Grafana Agent Flow" /reg:64 /f' + Pop $0 + nsExec::ExecToLog 'Reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" /reg:64 /f' + Pop $0 SectionEnd diff --git a/packaging/grafana-agent/windows/install_script.nsis b/packaging/grafana-agent/windows/install_script.nsis index b08a8216c6..a39ec0d4dc 100644 --- a/packaging/grafana-agent/windows/install_script.nsis +++ b/packaging/grafana-agent/windows/install_script.nsis @@ -229,6 +229,7 @@ Section "uninstall" RMDir /r $APPDATA\grafana-agent-wal - # Remove uninstaller information from the registry - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" + # Remove service and uninstaller information from the registry. + nsExec::ExecToLog 'Reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" /reg:64 /f' + Pop $0 SectionEnd From af59ddbf019a5482f76b85a03ecc94d0115b5344 Mon Sep 17 00:00:00 2001 From: Paschalis Tsilias Date: Thu, 29 Feb 2024 10:47:38 +0200 Subject: [PATCH 4/6] otelcolconvert: support converting span processor (#6504) Signed-off-by: Paschalis Tsilias --- component/otelcol/config_filter.go | 35 ++++ .../otelcolconvert/converter_helpers.go | 24 +++ .../otelcolconvert/converter_spanprocessor.go | 160 ++++++++++++++++++ .../otelcolconvert/testdata/span.river | 23 +++ .../otelcolconvert/testdata/span.yaml | 33 ++++ .../otelcolconvert/testdata/span_full.river | 72 ++++++++ .../otelcolconvert/testdata/span_full.yaml | 67 ++++++++ 7 files changed, 414 insertions(+) create mode 100644 converter/internal/otelcolconvert/converter_spanprocessor.go create mode 100644 converter/internal/otelcolconvert/testdata/span.river create mode 100644 converter/internal/otelcolconvert/testdata/span.yaml create mode 100644 converter/internal/otelcolconvert/testdata/span_full.river create mode 100644 converter/internal/otelcolconvert/testdata/span_full.yaml diff --git a/component/otelcol/config_filter.go b/component/otelcol/config_filter.go index d3199b9ebd..826f876971 100644 --- a/component/otelcol/config_filter.go +++ b/component/otelcol/config_filter.go @@ -269,6 +269,33 @@ var severityLevels = map[SeverityLevel]plog.SeverityNumber{ "FATAL4": 24, } +var severityNumbers = map[plog.SeverityNumber]SeverityLevel{ + 1: "TRACE", + 2: "TRACE2", + 3: "TRACE3", + 4: "TRACE4", + 5: "DEBUG", + 6: "DEBUG2", + 7: "DEBUG3", + 8: "DEBUG4", + 9: "INFO", + 10: "INFO2", + 11: "INFO3", + 12: "INFO4", + 13: "WARN", + 14: "WARN2", + 15: "WARN3", + 16: "WARN4", + 17: "ERROR", + 18: "ERROR2", + 19: "ERROR3", + 20: "ERROR4", + 21: "FATAL", + 22: "FATAL2", + 23: "FATAL3", + 24: "FATAL4", +} + // UnmarshalText implements encoding.TextUnmarshaler for SeverityLevel. func (sl *SeverityLevel) UnmarshalText(text []byte) error { agentSevLevelStr := SeverityLevel(text) @@ -278,3 +305,11 @@ func (sl *SeverityLevel) UnmarshalText(text []byte) error { } return fmt.Errorf("unrecognized severity level %q", string(text)) } + +func LookupSeverityNumber(num plog.SeverityNumber) (SeverityLevel, error) { + if lvl, exists := severityNumbers[num]; exists { + return lvl, nil + } + + return "", fmt.Errorf("unrecognized severity number %q", num) +} diff --git a/converter/internal/otelcolconvert/converter_helpers.go b/converter/internal/otelcolconvert/converter_helpers.go index 99cb630643..ff4179333a 100644 --- a/converter/internal/otelcolconvert/converter_helpers.go +++ b/converter/internal/otelcolconvert/converter_helpers.go @@ -60,3 +60,27 @@ func encodeMapstruct(v any) map[string]any { } return res } + +// encodeMapslice uses mapstruct fields to convert the given argument into a +// []map[string]any. This is useful for being able to convert configuration +// sections for OpenTelemetry components where the configuration type is hidden +// in an internal package. +func encodeMapslice(v any) []map[string]any { + var res []map[string]any + if err := mapstructure.Decode(v, &res); err != nil { + panic(err) + } + return res +} + +// encodeString uses mapstruct fields to convert the given argument into a +// string. This is useful for being able to convert configuration +// sections for OpenTelemetry components where the configuration type is hidden +// in an internal package. +func encodeString(v any) string { + var res string + if err := mapstructure.Decode(v, &res); err != nil { + panic(err) + } + return res +} diff --git a/converter/internal/otelcolconvert/converter_spanprocessor.go b/converter/internal/otelcolconvert/converter_spanprocessor.go new file mode 100644 index 0000000000..bee3039085 --- /dev/null +++ b/converter/internal/otelcolconvert/converter_spanprocessor.go @@ -0,0 +1,160 @@ +package otelcolconvert + +import ( + "fmt" + + "github.com/grafana/agent/component/otelcol" + "github.com/grafana/agent/component/otelcol/processor/span" + "github.com/grafana/agent/converter/diag" + "github.com/grafana/agent/converter/internal/common" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/pdata/plog" +) + +func init() { + converters = append(converters, spanProcessorConverter{}) +} + +type spanProcessorConverter struct{} + +func (spanProcessorConverter) Factory() component.Factory { return spanprocessor.NewFactory() } + +func (spanProcessorConverter) InputComponentName() string { return "otelcol.processor.span" } + +func (spanProcessorConverter) ConvertAndAppend(state *state, id component.InstanceID, cfg component.Config) diag.Diagnostics { + var diags diag.Diagnostics + + label := state.FlowComponentLabel() + + args := toSpanProcessor(state, id, cfg.(*spanprocessor.Config)) + block := common.NewBlockWithOverride([]string{"otelcol", "processor", "span"}, label, args) + + diags.Add( + diag.SeverityLevelInfo, + fmt.Sprintf("Converted %s into %s", stringifyInstanceID(id), stringifyBlock(block)), + ) + + state.Body().AppendBlock(block) + return diags +} + +func toSpanProcessor(state *state, id component.InstanceID, cfg *spanprocessor.Config) *span.Arguments { + var ( + nextTraces = state.Next(id, component.DataTypeTraces) + ) + + var setStatus *span.Status + if cfg.SetStatus != nil { + setStatus = &span.Status{ + Code: cfg.SetStatus.Code, + Description: cfg.SetStatus.Description, + } + } + + var toAttributes *span.ToAttributes + if cfg.Rename.ToAttributes != nil { + toAttributes = &span.ToAttributes{ + Rules: cfg.Rename.ToAttributes.Rules, + BreakAfterMatch: cfg.Rename.ToAttributes.BreakAfterMatch, + } + } + + return &span.Arguments{ + Match: otelcol.MatchConfig{ + Include: toMatchProperties(encodeMapstruct(cfg.Include)), + Exclude: toMatchProperties(encodeMapstruct(cfg.Exclude)), + }, + Name: span.Name{ + FromAttributes: cfg.Rename.FromAttributes, + Separator: cfg.Rename.Separator, + ToAttributes: toAttributes, + }, + SetStatus: setStatus, + Output: &otelcol.ConsumerArguments{ + Traces: toTokenizedConsumers(nextTraces), + }, + } +} + +func toMatchProperties(cfg map[string]any) *otelcol.MatchProperties { + if cfg == nil { + return nil + } + + return &otelcol.MatchProperties{ + MatchType: encodeString(cfg["match_type"]), + RegexpConfig: toRegexpConfig(cfg), + LogSeverity: toLogSeverity(cfg), + Services: cfg["services"].([]string), + SpanNames: cfg["span_names"].([]string), + LogBodies: cfg["log_bodies"].([]string), + LogSeverityTexts: cfg["log_severity_texts"].([]string), + MetricNames: cfg["metric_names"].([]string), + SpanKinds: cfg["span_kinds"].([]string), + Attributes: toOtelcolAttributes(encodeMapslice(cfg["attributes"])), + Resources: toOtelcolAttributes(encodeMapslice(cfg["resources"])), + Libraries: toOtelcolInstrumentationLibrary(encodeMapslice(cfg["libraries"])), + } +} + +func toOtelcolAttributes(in []map[string]any) []otelcol.Attribute { + res := make([]otelcol.Attribute, 0, len(in)) + + for _, a := range in { + res = append(res, otelcol.Attribute{ + Key: a["key"].(string), + Value: a["value"], + }) + } + + return res +} + +func toOtelcolInstrumentationLibrary(in []map[string]any) []otelcol.InstrumentationLibrary { + res := make([]otelcol.InstrumentationLibrary, 0, len(in)) + + for _, l := range in { + res = append(res, otelcol.InstrumentationLibrary{ + Name: l["name"].(string), + Version: l["version"].(*string), + }) + } + return res +} + +func toRegexpConfig(cfg map[string]any) *otelcol.RegexpConfig { + if cfg["regexp_config"] == nil { + return nil + } + + rc := cfg["regexp_config"].(map[string]any) + + return &otelcol.RegexpConfig{ + CacheEnabled: rc["cache_enabled"].(bool), + CacheMaxNumEntries: rc["cache_max_num_entries"].(int), + } +} +func toLogSeverity(cfg map[string]any) *otelcol.LogSeverityNumberMatchProperties { + if cfg["log_severity_number"] == nil { + return nil + } + + // Theres's a nested type, so we have to re-encode the field. + ls := encodeMapstruct(cfg["log_severity_number"]) + if ls == nil { + return nil + } + + // This should never error out, but there's no 'unknown' severity level to + // return in case it did. + sn, err := otelcol.LookupSeverityNumber(ls["min"].(plog.SeverityNumber)) + if err != nil { + panic(err) + } + + return &otelcol.LogSeverityNumberMatchProperties{ + Min: sn, + MatchUndefined: ls["match_undefined"].(bool), + } +} diff --git a/converter/internal/otelcolconvert/testdata/span.river b/converter/internal/otelcolconvert/testdata/span.river new file mode 100644 index 0000000000..7ce267fbe6 --- /dev/null +++ b/converter/internal/otelcolconvert/testdata/span.river @@ -0,0 +1,23 @@ +otelcol.receiver.otlp "default" { + grpc { } + + http { } + + output { + metrics = [otelcol.exporter.otlp.default.input] + logs = [otelcol.exporter.otlp.default.input] + traces = [otelcol.processor.span.default.input] + } +} + +otelcol.processor.span "default" { + output { + traces = [otelcol.exporter.otlp.default.input] + } +} + +otelcol.exporter.otlp "default" { + client { + endpoint = "database:4317" + } +} diff --git a/converter/internal/otelcolconvert/testdata/span.yaml b/converter/internal/otelcolconvert/testdata/span.yaml new file mode 100644 index 0000000000..3d61052153 --- /dev/null +++ b/converter/internal/otelcolconvert/testdata/span.yaml @@ -0,0 +1,33 @@ +receivers: + otlp: + protocols: + grpc: + http: + +exporters: + otlp: + # Our defaults have drifted from upstream, so we explicitly set our + # defaults below (balancer_name and queue_size). + endpoint: database:4317 + balancer_name: pick_first + sending_queue: + queue_size: 5000 + +processors: + span: + +service: + pipelines: + metrics: + receivers: [otlp] + processors: [] + exporters: [otlp] + logs: + receivers: [otlp] + processors: [] + exporters: [otlp] + traces: + receivers: [otlp] + processors: [span] + exporters: [otlp] + diff --git a/converter/internal/otelcolconvert/testdata/span_full.river b/converter/internal/otelcolconvert/testdata/span_full.river new file mode 100644 index 0000000000..a7f8600a7c --- /dev/null +++ b/converter/internal/otelcolconvert/testdata/span_full.river @@ -0,0 +1,72 @@ +otelcol.receiver.otlp "default" { + grpc { } + + http { } + + output { + metrics = [otelcol.exporter.otlp.default.input] + logs = [otelcol.exporter.otlp.default.input] + traces = [otelcol.processor.span.default.input] + } +} + +otelcol.processor.span "default" { + include { + match_type = "strict" + span_names = ["span1", "span2"] + log_bodies = ["lb1", "lb2"] + log_severity_texts = ["ls1", "ls2"] + + attribute { + key = "key1" + value = "value1" + } + span_kinds = ["spankind1", "spankind2"] + } + + exclude { + match_type = "regex" + services = ["svc1", "svc2"] + + log_severity { + min = "TRACE2" + match_undefined = false + } + metric_names = ["mn1", "mn2"] + + resource { + key = "key1" + value = "value1" + } + + library { + name = "name1" + version = "version1" + } + } + + name { + from_attributes = ["db.svc", "operation"] + separator = "::" + + to_attributes { + rules = ["^\\/api\\/v1\\/document\\/(?P.*)\\/update$"] + break_after_match = true + } + } + + status { + code = "Error" + description = "some error description" + } + + output { + traces = [otelcol.exporter.otlp.default.input] + } +} + +otelcol.exporter.otlp "default" { + client { + endpoint = "database:4317" + } +} diff --git a/converter/internal/otelcolconvert/testdata/span_full.yaml b/converter/internal/otelcolconvert/testdata/span_full.yaml new file mode 100644 index 0000000000..e7a5173727 --- /dev/null +++ b/converter/internal/otelcolconvert/testdata/span_full.yaml @@ -0,0 +1,67 @@ +receivers: + otlp: + protocols: + grpc: + http: + +exporters: + otlp: + # Our defaults have drifted from upstream, so we explicitly set our + # defaults below (balancer_name and queue_size). + endpoint: database:4317 + balancer_name: pick_first + sending_queue: + queue_size: 5000 + +processors: + # Since this processor has deeply nested attributes, we're adding a more + # fleshed out testdata case to make sure we're hitting all the possible + # conversion code paths. + span: + name: + from_attributes: ["db.svc", "operation"] + separator: "::" + to_attributes: + break_after_match: true + rules: + - ^\/api\/v1\/document\/(?P.*)\/update$ + status: + code: Error + description: "some error description" + include: + match_type: "strict" + attributes: + - key: "key1" + value: "value1" + span_names: ["span1", "span2"] + span_kinds: ["spankind1", "spankind2"] + log_bodies: ["lb1", "lb2"] + log_severity_texts: ["ls1", "ls2"] + exclude: + match_type: "regex" + services: ["svc1", "svc2"] + resources: + - key: "key1" + value: "value1" + libraries: + - name: "name1" + version: "version1" + log_severity_number: + min: 2 + match_undefined: false + metric_names: ["mn1", "mn2"] + +service: + pipelines: + metrics: + receivers: [otlp] + processors: [] + exporters: [otlp] + logs: + receivers: [otlp] + processors: [] + exporters: [otlp] + traces: + receivers: [otlp] + processors: [span] + exporters: [otlp] From de6a6938997689a5a9bb673c55f05ceb7a037507 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 11:45:24 +0000 Subject: [PATCH 5/6] Update `make docs` procedure (#6553) Co-authored-by: grafanabot --- docs/make-docs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/make-docs b/docs/make-docs index 756e33b62f..43efdb5faa 100755 --- a/docs/make-docs +++ b/docs/make-docs @@ -6,6 +6,12 @@ # [Semantic versioning](https://semver.org/) is used to help the reader identify the significance of changes. # Changes are relevant to this script and the support docs.mk GNU Make interface. # +# ## 6.0.1 (2024-02-28) +# +# ### Added +# +# - Suppress new errors relating to absent content introduced in https://github.com/grafana/website/pull/17561. +# # ## 6.0.0 (2024-02-16) # # ### Changed @@ -822,7 +828,8 @@ EOF -e '/rm -rf dist*/ d' \ -e '/Press Ctrl+C to stop/ d' \ -e '/make/ d' \ - -e '/WARNING: The manual_mount source directory/ d' + -e '/WARNING: The manual_mount source directory/ d' \ + -e '/docs\/_index.md .* not found/ d' fi ;; esac From b691a44b47b3d443cf9fa462190069ed5ff5b98f Mon Sep 17 00:00:00 2001 From: William Dumont Date: Thu, 29 Feb 2024 15:02:48 +0100 Subject: [PATCH 6/6] ignore errors when the logging node empties the log buffer (#6558) --- CHANGELOG.md | 4 ++++ pkg/flow/logging/logger.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 183490b615..b9988a7fe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ Main (unreleased) - A new `loki.rules.kubernetes` component that discovers `PrometheusRule` Kubernetes resources and loads them into a Loki Ruler instance. (@EStork09) +### Bugfixes + +- Fix an issues where the logging config block would trigger an error when trying to send logs to components that were not running. (@wildum) + v0.40.0 (2024-02-27) -------------------- diff --git a/pkg/flow/logging/logger.go b/pkg/flow/logging/logger.go index da0046a281..5689d00fe0 100644 --- a/pkg/flow/logging/logger.go +++ b/pkg/flow/logging/logger.go @@ -126,9 +126,9 @@ func (l *Logger) Update(o Options) error { // Print out the buffered logs since we determined the log format already for _, bufferedLogChunk := range l.buffer { - if err := slogadapter.GoKit(l.handler).Log(bufferedLogChunk...); err != nil { - return err - } + // the buffered logs are currently only sent to the standard output + // because the components with the receivers are not running yet + slogadapter.GoKit(l.handler).Log(bufferedLogChunk...) } l.buffer = nil