From 96b1115154344665ef9341085b3a93c2278aba4e Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Tue, 14 Jan 2025 10:19:56 +0000 Subject: [PATCH 01/51] Add otelbench --- loadgen/Makefile | 1 + loadgen/cmd/otelbench/main.go | 72 ++++++ loadgen/cmd/otelsoak/main.go | 53 ++++ loadgen/collector.go | 89 +++++++ loadgen/components.go | 75 ++++++ loadgen/config.example.yaml | 11 +- loadgen/go.mod | 169 +++++++++++++ loadgen/go.sum | 450 ++++++++++++++++++++++++++++++++++ loadgen/prom_scraper.go | 66 +++++ loadgen/runner.go | 127 ++++++++++ 10 files changed, 1110 insertions(+), 3 deletions(-) create mode 100644 loadgen/Makefile create mode 100644 loadgen/cmd/otelbench/main.go create mode 100644 loadgen/cmd/otelsoak/main.go create mode 100644 loadgen/collector.go create mode 100644 loadgen/components.go create mode 100644 loadgen/go.mod create mode 100644 loadgen/go.sum create mode 100644 loadgen/prom_scraper.go create mode 100644 loadgen/runner.go diff --git a/loadgen/Makefile b/loadgen/Makefile new file mode 100644 index 00000000..cef6fcbd --- /dev/null +++ b/loadgen/Makefile @@ -0,0 +1 @@ +include ../Makefile.Common \ No newline at end of file diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go new file mode 100644 index 00000000..05ad3765 --- /dev/null +++ b/loadgen/cmd/otelbench/main.go @@ -0,0 +1,72 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package main + +import ( + "context" + "flag" + "fmt" + "testing" + "time" + + "github.com/elastic/opentelemetry-collector-components/loadgen" +) + +func main() { + loadgen.Init() + flag.CommandLine = loadgen.FlagSet + testing.Init() + flag.Parse() + + result := testing.Benchmark(func(b *testing.B) { + stop := make(chan bool) + + go func() { + ticker := time.NewTicker(500 * time.Millisecond) + defer ticker.Stop() + for { + select { + case <-stop: + case <-ticker.C: + logs, metricPoints, spans, err := loadgen.GetTelemetrySent() + if err != nil { + b.Logf("error getting internal telemetry: %s", err) + continue + } + total := logs + metricPoints + spans + if total > int64(b.N) { + b.StopTimer() + close(stop) + b.ReportMetric(float64(logs)/b.Elapsed().Seconds(), "logs/s") + b.ReportMetric(float64(metricPoints)/b.Elapsed().Seconds(), "metric_points/s") + b.ReportMetric(float64(spans)/b.Elapsed().Seconds(), "spans/s") + b.ReportMetric(float64(total)/b.Elapsed().Seconds(), "total/s") + return + } + } + } + }() + + err := loadgen.Run(context.Background(), stop) + if err != nil { + fmt.Println(err) + b.Log(err) + } + }) + fmt.Println(result.String()) +} diff --git a/loadgen/cmd/otelsoak/main.go b/loadgen/cmd/otelsoak/main.go new file mode 100644 index 00000000..10609a8b --- /dev/null +++ b/loadgen/cmd/otelsoak/main.go @@ -0,0 +1,53 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package main + +import ( + "fmt" + "log" + + "github.com/elastic/opentelemetry-collector-components/loadgen" + "github.com/spf13/cobra" + "go.opentelemetry.io/collector/otelcol" +) + +func main() { + loadgen.Init() + + settings, err := loadgen.NewCollectorSettings(nil) + if err != nil { + log.Fatalf("collector new settings error: %v", err) + } + + cmd := otelcol.NewCommand(settings) + cmd.Flags().AddGoFlagSet(loadgen.FlagSet) + runE := cmd.RunE + cmd.RunE = func(cmd *cobra.Command, args []string) error { + // This is to pass in parsed loadgen flags e.g. api-key, secret-token to otel collector + sets := loadgen.CollectorSetFromConfig() + for _, set := range sets { + if err := cmd.Flags().Set("set", set); err != nil { + return fmt.Errorf("error passing --set to collector: %w", err) + } + } + return runE(cmd, args) + } + if err := cmd.Execute(); err != nil { + log.Fatalf("collector execute error: %v", err) + } +} diff --git a/loadgen/collector.go b/loadgen/collector.go new file mode 100644 index 00000000..854f1dc9 --- /dev/null +++ b/loadgen/collector.go @@ -0,0 +1,89 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package loadgen // import "github.com/elastic/opentelemetry-collector-components/loadgen" + +import ( + "context" + "os" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/confmap/provider/envprovider" + "go.opentelemetry.io/collector/confmap/provider/fileprovider" + "go.opentelemetry.io/collector/confmap/provider/httpprovider" + "go.opentelemetry.io/collector/confmap/provider/httpsprovider" + "go.opentelemetry.io/collector/confmap/provider/yamlprovider" + "go.opentelemetry.io/collector/otelcol" +) + +const ( + buildDescription = "loadgen distribution" + buildVersion = "0.1.0" +) + +func RunCollector(ctx context.Context, stop chan bool, configFiles []string) error { + settings, err := NewCollectorSettings(configFiles) + if err != nil { + return err + } + + svc, err := otelcol.NewCollector(settings) + if err != nil { + return err + } + + // cancel context on stop from event manager + cancelCtx, cancel := context.WithCancel(ctx) + go func() { + <-stop + cancel() + }() + defer cancel() + + return svc.Run(cancelCtx) +} + +func NewCollectorSettings(configPaths []string) (otelcol.CollectorSettings, error) { + buildInfo := component.BuildInfo{ + Command: os.Args[0], + Description: buildDescription, + Version: buildVersion, + } + configProviderSettings := otelcol.ConfigProviderSettings{ + ResolverSettings: confmap.ResolverSettings{ + URIs: configPaths, + ProviderFactories: []confmap.ProviderFactory{ + fileprovider.NewFactory(), + envprovider.NewFactory(), + yamlprovider.NewFactory(), + httpprovider.NewFactory(), + httpsprovider.NewFactory(), + }, + ConverterFactories: []confmap.ConverterFactory{}, + }, + } + + return otelcol.CollectorSettings{ + Factories: components, + BuildInfo: buildInfo, + ConfigProviderSettings: configProviderSettings, + // we're handling DisableGracefulShutdown via the cancelCtx being passed + // to the collector's Run method in the Run function + DisableGracefulShutdown: true, + }, nil +} diff --git a/loadgen/components.go b/loadgen/components.go new file mode 100644 index 00000000..898b3910 --- /dev/null +++ b/loadgen/components.go @@ -0,0 +1,75 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package loadgen // import "github.com/elastic/opentelemetry-collector-components/loadgen" + +import ( + "github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor" + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor" + "go.opentelemetry.io/collector/connector" + "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/debugexporter" + "go.opentelemetry.io/collector/exporter/otlpexporter" + "go.opentelemetry.io/collector/extension" + "go.opentelemetry.io/collector/otelcol" + "go.opentelemetry.io/collector/processor" + "go.opentelemetry.io/collector/receiver" +) + +func components() (otelcol.Factories, error) { + var err error + factories := otelcol.Factories{} + + // Receivers + factories.Receivers, err = receiver.MakeFactoryMap( + loadgenreceiver.NewFactory(), + ) + if err != nil { + return otelcol.Factories{}, err + } + + // Processors + factories.Processors, err = processor.MakeFactoryMap( + ratelimitprocessor.NewFactory(), + transformprocessor.NewFactory(), + ) + if err != nil { + return otelcol.Factories{}, err + } + + // Exporters + factories.Exporters, err = exporter.MakeFactoryMap( + otlpexporter.NewFactory(), + debugexporter.NewFactory(), + ) + if err != nil { + return otelcol.Factories{}, err + } + + factories.Connectors, err = connector.MakeFactoryMap() + if err != nil { + return otelcol.Factories{}, err + } + + factories.Extensions, err = extension.MakeFactoryMap() + if err != nil { + return otelcol.Factories{}, err + } + + return factories, err +} diff --git a/loadgen/config.example.yaml b/loadgen/config.example.yaml index fd199721..027b047f 100644 --- a/loadgen/config.example.yaml +++ b/loadgen/config.example.yaml @@ -43,6 +43,11 @@ service: receivers: [loadgen] processors: [ratelimit, transform/rewrite] exporters: [otlp, debug] -# telemetry: -# logs: -# level: debug + telemetry: + metrics: + readers: + - pull: + exporter: + prometheus: + host: '127.0.0.1' + port: 8888 diff --git a/loadgen/go.mod b/loadgen/go.mod new file mode 100644 index 00000000..2b8662c7 --- /dev/null +++ b/loadgen/go.mod @@ -0,0 +1,169 @@ +module github.com/elastic/opentelemetry-collector-components/loadgen + +go 1.22.7 + +require ( + github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor v0.0.0-00010101000000-000000000000 + github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver v0.0.0-00010101000000-000000000000 + github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.117.0 + github.com/prometheus/client_model v0.6.1 + github.com/prometheus/prom2json v1.4.1 + go.opentelemetry.io/collector/component v0.117.0 + go.opentelemetry.io/collector/confmap v1.23.0 + go.opentelemetry.io/collector/confmap/provider/envprovider v1.23.0 + go.opentelemetry.io/collector/confmap/provider/fileprovider v1.23.0 + go.opentelemetry.io/collector/confmap/provider/httpprovider v1.23.0 + go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.23.0 + go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.23.0 + go.opentelemetry.io/collector/connector v0.117.0 + go.opentelemetry.io/collector/exporter v0.117.0 + go.opentelemetry.io/collector/exporter/debugexporter v0.117.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0 + go.opentelemetry.io/collector/extension v0.117.0 + go.opentelemetry.io/collector/otelcol v0.117.0 + go.opentelemetry.io/collector/processor v0.117.0 + go.opentelemetry.io/collector/receiver v0.117.0 +) + +require ( + github.com/alecthomas/participle/v2 v2.1.1 // indirect + github.com/antchfx/xmlquery v1.4.3 // indirect + github.com/antchfx/xpath v1.3.3 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/ebitengine/purego v0.8.1 // indirect + github.com/elastic/go-grok v0.3.1 // indirect + github.com/elastic/lunes v0.1.0 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/goccy/go-json v0.10.4 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/hashicorp/golang-lru v0.6.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.11 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/providers/confmap v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.1.2 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magefile/mage v1.15.0 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mostynb/go-grpc-compression v1.2.3 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.117.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.117.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil v0.117.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.117.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.117.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/prometheus/client_golang v1.20.5 // indirect + github.com/prometheus/common v0.61.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect + github.com/prometheus/prometheus v0.54.1 // indirect + github.com/shirou/gopsutil/v4 v4.24.12 // indirect + github.com/spf13/cobra v1.8.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/testify v1.10.0 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/collector/client v1.23.0 // indirect + go.opentelemetry.io/collector/component/componentstatus v0.117.0 // indirect + go.opentelemetry.io/collector/component/componenttest v0.117.0 // indirect + go.opentelemetry.io/collector/config/configauth v0.117.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.23.0 // indirect + go.opentelemetry.io/collector/config/configgrpc v0.117.0 // indirect + go.opentelemetry.io/collector/config/confignet v1.23.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.23.0 // indirect + go.opentelemetry.io/collector/config/configretry v1.23.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.117.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.23.0 // indirect + go.opentelemetry.io/collector/connector/connectortest v0.117.0 // indirect + go.opentelemetry.io/collector/connector/xconnector v0.117.0 // indirect + go.opentelemetry.io/collector/consumer v1.23.0 // indirect + go.opentelemetry.io/collector/consumer/consumererror v0.117.0 // indirect + go.opentelemetry.io/collector/consumer/consumererror/xconsumererror v0.117.0 // indirect + go.opentelemetry.io/collector/consumer/consumertest v0.117.0 // indirect + go.opentelemetry.io/collector/consumer/xconsumer v0.117.0 // indirect + go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0 // indirect + go.opentelemetry.io/collector/exporter/exportertest v0.117.0 // indirect + go.opentelemetry.io/collector/exporter/xexporter v0.117.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.117.0 // indirect + go.opentelemetry.io/collector/extension/extensioncapabilities v0.117.0 // indirect + go.opentelemetry.io/collector/extension/extensiontest v0.117.0 // indirect + go.opentelemetry.io/collector/extension/xextension v0.117.0 // indirect + go.opentelemetry.io/collector/featuregate v1.23.0 // indirect + go.opentelemetry.io/collector/internal/fanoutconsumer v0.117.0 // indirect + go.opentelemetry.io/collector/pdata v1.23.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.117.0 // indirect + go.opentelemetry.io/collector/pdata/testdata v0.117.0 // indirect + go.opentelemetry.io/collector/pipeline v0.117.0 // indirect + go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0 // indirect + go.opentelemetry.io/collector/processor/processortest v0.117.0 // indirect + go.opentelemetry.io/collector/processor/xprocessor v0.117.0 // indirect + go.opentelemetry.io/collector/receiver/receivertest v0.117.0 // indirect + go.opentelemetry.io/collector/receiver/xreceiver v0.117.0 // indirect + go.opentelemetry.io/collector/semconv v0.117.0 // indirect + go.opentelemetry.io/collector/service v0.117.0 // indirect + go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect + go.opentelemetry.io/contrib/config v0.10.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.31.0 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect + go.opentelemetry.io/otel/exporters/prometheus v0.54.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 // indirect + go.opentelemetry.io/otel/log v0.8.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/sdk/log v0.7.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/time v0.9.0 // indirect + gonum.org/v1/gonum v0.15.1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241206012308-a4fef0638583 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 // indirect + google.golang.org/grpc v1.69.2 // indirect + google.golang.org/protobuf v1.36.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace ( + github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor => ./../processor/ratelimitprocessor + github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver => ./../receiver/loadgenreceiver +) diff --git a/loadgen/go.sum b/loadgen/go.sum new file mode 100644 index 00000000..c4b4e175 --- /dev/null +++ b/loadgen/go.sum @@ -0,0 +1,450 @@ +github.com/alecthomas/assert/v2 v2.3.0 h1:mAsH2wmvjsuvyBvAmCtm7zFsBlb8mIHx5ySLVdDZXL0= +github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= +github.com/alecthomas/participle/v2 v2.1.1 h1:hrjKESvSqGHzRb4yW1ciisFJ4p3MGYih6icjJvbsmV8= +github.com/alecthomas/participle/v2 v2.1.1/go.mod h1:Y1+hAs8DHPmc3YUFzqllV+eSQ9ljPTk0ZkPMtEdAx2c= +github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= +github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/antchfx/xmlquery v1.4.3 h1:f6jhxCzANrWfa93O+NmRWvieVyLs+R2Szfpy+YrZaww= +github.com/antchfx/xmlquery v1.4.3/go.mod h1:AEPEEPYE9GnA2mj5Ur2L5Q5/2PycJ0N9Fusrx9b12fc= +github.com/antchfx/xpath v1.3.3 h1:tmuPQa1Uye0Ym1Zn65vxPgfltWb/Lxu2jeqIGteJSRs= +github.com/antchfx/xpath v1.3.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= +github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/elastic/go-grok v0.3.1 h1:WEhUxe2KrwycMnlvMimJXvzRa7DoByJB4PVUIE1ZD/U= +github.com/elastic/go-grok v0.3.1/go.mod h1:n38ls8ZgOboZRgKcjMY8eFeZFMmcL9n2lP0iHhIDk64= +github.com/elastic/lunes v0.1.0 h1:amRtLPjwkWtzDF/RKzcEPMvSsSseLDLW+bnhfNSLRe4= +github.com/elastic/lunes v0.1.0/go.mod h1:xGphYIt3XdZRtyWosHQTErsQTd4OP1p9wsbVoHelrd4= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= +github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4= +github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= +github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= +github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= +github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= +github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mLPqKctH7Uo//I= +github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.117.0 h1:LZG1N02gLmfi9Lv6JiUWMhb3LFLbHHp4w4/qegeDrxg= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.117.0/go.mod h1:mH6Ffc14prL+GEeSBW7yCkqMTxE64b1BQLnHNxG0pMM= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.117.0 h1:Mz4I1Kccj+UHnYBa/dJM2eCMXBz95MV1ELk1UqKre2A= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.117.0/go.mod h1:jYgogs1e88bxEDv0a3/yr7uvmElskxswsNpTj22F6dE= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil v0.117.0 h1:SjZHtgph6f675yK/p+GTo8I7VlIAjJFod3SMNgfpEAg= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil v0.117.0/go.mod h1:e4cIzlw2iGmMCgHKyJHLf+PF99A1Y6GvNC0+E3x1dA4= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.117.0 h1:tOJFUIZaAU4zm5CilqZN1/AuKQa7diTrcEhgQIYly6k= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.117.0/go.mod h1:PJ2FGCS+Hw+tlHUNNWVHNo3IXtEsb9RKgl/ssSi3Z98= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.117.0 h1:HnkgGMpQKEW9z2bJaIyK1HQ7nETyOvTYYXEDLA1GR8E= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.117.0/go.mod h1:/xsh6bL6X7OcPwdWWApGJH3j4tMchr0e0NL8t1qgAXs= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.117.0 h1:/wMNk8w1UEHKpKoNk1jA2aifHgfGZE+WelGNrCf0CJ0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.117.0/go.mod h1:ESyMNHmgZYh8Ouhr2veecTMK6sB8gQ8u2s3dsy9Og6k= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.117.0 h1:GqlhXd6J8zgxCYenbI3ew03SJnGec1vEEGzGHw9X/Y0= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.117.0/go.mod h1:OGylX+Bp+urSNNGoI1XG7U6vaRDZk1wN/w6fHP1F7IY= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.117.0 h1:s45IZekyWIO8SGSRfKgav9mxCWbG/D7VM5uWQgvfQMY= +github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.117.0/go.mod h1:NwIzo4y40ouEDLBYvPNafBdAVSVI0fLSRdEeSIqi6dU= +github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= +github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= +github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= +github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= +github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/prometheus/prom2json v1.4.1 h1:7McxdrHgPEOtMwWjkKtd0v5AhpR2Q6QAnlHKVxq0+tQ= +github.com/prometheus/prom2json v1.4.1/go.mod h1:CzOQykSKFxXuC7ELUZHOHQvwKesQ3eN0p2PWLhFitQM= +github.com/prometheus/prometheus v0.54.1 h1:vKuwQNjnYN2/mDoWfHXDhAsz/68q/dQDb+YbcEqU7MQ= +github.com/prometheus/prometheus v0.54.1/go.mod h1:xlLByHhk2g3ycakQGrMaU8K7OySZx98BzeCR99991NY= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shirou/gopsutil/v4 v4.24.12 h1:qvePBOk20e0IKA1QXrIIU+jmk+zEiYVVx06WjBRlZo4= +github.com/shirou/gopsutil/v4 v4.24.12/go.mod h1:DCtMPAad2XceTeIAbGyVfycbYQNBGk2P8cvDi7/VN9o= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 h1:SIKIoA4e/5Y9ZOl0DCe3eVMLPOQzJxgZpfdHHeauNTM= +github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6/go.mod h1:BUbeWZiieNxAuuADTBNb3/aeje6on3DhU3rpWsQSB1E= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.opentelemetry.io/collector v0.117.0 h1:nj/Q89KGmev1l4YxWJt4JH3+fV1YFmci9MRmr9bULf4= +go.opentelemetry.io/collector v0.117.0/go.mod h1:z8XawVuKONaUkJW5w1GrfAXokrgxdF8mGtekK0sFIyQ= +go.opentelemetry.io/collector/client v1.23.0 h1:X11yEZ2T3T1Cr1CfDPI0xjZgw7ekes7CVbF/NVYxGG0= +go.opentelemetry.io/collector/client v1.23.0/go.mod h1:pfhOGJ13n5xH3HgmFwUHa1nBE1kCIa9X/DLTJVxtbVM= +go.opentelemetry.io/collector/component v0.117.0 h1:A3Im4PqLyfduAdVyUgbOZdUs7J/USegdpnkoIAOuN3Y= +go.opentelemetry.io/collector/component v0.117.0/go.mod h1:+SxJgeMwNV6y3aKNR2sP0PfovcUlRwC0+pEv4tTYdXA= +go.opentelemetry.io/collector/component/componentstatus v0.117.0 h1:8PGN66p9o5L7xCfT4jDJHd3d2VdtIuzPU2mEXOSONt8= +go.opentelemetry.io/collector/component/componentstatus v0.117.0/go.mod h1:u8tVDI+S9TxBa5NtxJNdxqjI0CLIzbmqbRl9DPrdR/0= +go.opentelemetry.io/collector/component/componenttest v0.117.0 h1:r3k0BsU/cJlqVQRtgFjxfduNEGaM2qCAU7JitIGkRds= +go.opentelemetry.io/collector/component/componenttest v0.117.0/go.mod h1:MoBWSGb3KwGc5FAIO+htez/QWK2uqJ4fnbEnfHB384c= +go.opentelemetry.io/collector/config/configauth v0.117.0 h1:o+sEz1aeS01XD3procwMmvDAhGHFFH1dxmC6XHwxG6s= +go.opentelemetry.io/collector/config/configauth v0.117.0/go.mod h1:oWkIayfVGS/ED6jEDTILSypW8MVNZ/bHd11lXrt7fsQ= +go.opentelemetry.io/collector/config/configcompression v1.23.0 h1:KCEztOb+2L4+dUCCadOW/byRiw7LbgguNqHD5LxJcwY= +go.opentelemetry.io/collector/config/configcompression v1.23.0/go.mod h1:LvYG00tbPTv0NOLoZN0wXq1F5thcxvukO8INq7xyfWU= +go.opentelemetry.io/collector/config/configgrpc v0.117.0 h1:ELxoFoZxNDxb/YQJuku6JWL5TRQT+exsrTGrCoZeyrk= +go.opentelemetry.io/collector/config/configgrpc v0.117.0/go.mod h1:l916AszIpA12JiqCG5RNPgBgm5oimc4yeVPEUOOD/G4= +go.opentelemetry.io/collector/config/confighttp v0.117.0 h1:0BRGo1aivqIsGtAMmxTZ0u3rlGJ073+iyHD5RvUOtQk= +go.opentelemetry.io/collector/config/confighttp v0.117.0/go.mod h1:iNCp62v5k9SPTOdOxQlPfs/4gLGh7YLGpjP//9uvT0A= +go.opentelemetry.io/collector/config/confignet v1.23.0 h1:gq90GDgQFSjAeFkDeIkstkBwYrD8feUjqEWCrIJhFGA= +go.opentelemetry.io/collector/config/confignet v1.23.0/go.mod h1:ZppUH1hgUJOubawEsxsQ9MzEYFytqo2GnVSS7d4CVxc= +go.opentelemetry.io/collector/config/configopaque v1.23.0 h1:SEnEzOHufGc4KGOjQq8zKIQuDBmRFl9ncZ3qs1SRpJk= +go.opentelemetry.io/collector/config/configopaque v1.23.0/go.mod h1:sW0t0iI/VfRL9VYX7Ik6XzVgPcR+Y5kejTLsYcMyDWs= +go.opentelemetry.io/collector/config/configretry v1.23.0 h1:0Ox2KvTZyNdgureAs3kJzsNIa6ttrx9bwlKjj/p4fGU= +go.opentelemetry.io/collector/config/configretry v1.23.0/go.mod h1:cleBc9I0DIWpTiiHfu9v83FUaCTqcPXmebpLxjEIqro= +go.opentelemetry.io/collector/config/configtelemetry v0.117.0 h1:xsMfc89VByIF2fJzWuxs/2eqy44DWfNBAysReG4TAr8= +go.opentelemetry.io/collector/config/configtelemetry v0.117.0/go.mod h1:SlBEwQg0qly75rXZ6W1Ig8jN25KBVBkFIIAUI1GiAAE= +go.opentelemetry.io/collector/config/configtls v1.23.0 h1:52q9dAV923hHn1aoYQyKGnrRXCPvTTT3DXurtxcpZaQ= +go.opentelemetry.io/collector/config/configtls v1.23.0/go.mod h1:cjMoqKm4MX9sc9qyEW5/kRepiKLuDYqFofGa0f/rqFE= +go.opentelemetry.io/collector/confmap v1.23.0 h1:EY+auc0kbyZ4HIfkLYeJyLDCZIFzMA1u8QRGW4bC1Ag= +go.opentelemetry.io/collector/confmap v1.23.0/go.mod h1:Rrhs+MWoaP6AswZp+ReQ2VO9dfOfcUjdjiSHBsG+nec= +go.opentelemetry.io/collector/confmap/provider/envprovider v1.23.0 h1:b1aZxceRYYH1wXqqVHYZpepiVKYy8WJ27NHq/KQFQJs= +go.opentelemetry.io/collector/confmap/provider/envprovider v1.23.0/go.mod h1:c1zdel/NZJumOWY8RhKfOuF/uxihNxQrJzBQcnY0HFw= +go.opentelemetry.io/collector/confmap/provider/fileprovider v1.23.0 h1:2CwU9PZLCP76iNTk6vP1CN3BA1C9OnnebpCE0WQf6F4= +go.opentelemetry.io/collector/confmap/provider/fileprovider v1.23.0/go.mod h1:tDUen3bEdWlgJtJEc2OrNV6sTfR/QkImyAFlxUXcplY= +go.opentelemetry.io/collector/confmap/provider/httpprovider v1.23.0 h1:CdGl8CI5rnbAhNIJwisCKvKEiqOKWTZqnsQ2WqcCPs8= +go.opentelemetry.io/collector/confmap/provider/httpprovider v1.23.0/go.mod h1:lvljQaUjATZhFghYNPGNjIO3lsedzv7lOlkQfOdiung= +go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.23.0 h1:LhAmpmjCVSmiusk0lymvSxkYPy1praMHwGhNdnUJVFw= +go.opentelemetry.io/collector/confmap/provider/httpsprovider v1.23.0/go.mod h1:89KFhIqvcjibD2yduEHmkl9w0fzVQgOh4NP0p293reU= +go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.23.0 h1:ZaK8+EcQxlYZZgJn7ew700AUhH9CpXA3VBn46OHHEHk= +go.opentelemetry.io/collector/confmap/provider/yamlprovider v1.23.0/go.mod h1:WrlXU+lshUTmsgyacD7jijs0Nh85Xf0xU/0sqtkHDNs= +go.opentelemetry.io/collector/connector v0.117.0 h1:7MM6FOrquYyLSftp3vJSeahRLcVcJ+EwgsqZpsPtGas= +go.opentelemetry.io/collector/connector v0.117.0/go.mod h1:Qp3KAr/S3vMjOtWG5tZxQ+6JgFFYBUzFx6xzM6Xt30A= +go.opentelemetry.io/collector/connector/connectortest v0.117.0 h1:tRes8VpoYEXbOZtT5NQdYhWd7PyHy4N3R/9M2VMZt7U= +go.opentelemetry.io/collector/connector/connectortest v0.117.0/go.mod h1:rb7ax+hQzL2fiUFI9QpfOPQX2S6GfJlyxjT4tsIYODQ= +go.opentelemetry.io/collector/connector/xconnector v0.117.0 h1:H4tTVBKDW9bfEJ+6p6ZDIdN7yUkGl59ELs0+46UtQ78= +go.opentelemetry.io/collector/connector/xconnector v0.117.0/go.mod h1:aAfKBBFnJrPgKC653Lt1gwfTDbSZUuTY4TPI7Fcv9MM= +go.opentelemetry.io/collector/consumer v1.23.0 h1:JT0nE1vikL5yIk97IHBGzwx8co3w1WsAd3GFEl8r9XA= +go.opentelemetry.io/collector/consumer v1.23.0/go.mod h1:8d0uQ6gq64LbPktV4sc888lRj1cQCmrdl13hRIEURgA= +go.opentelemetry.io/collector/consumer/consumererror v0.117.0 h1:PPIZCcYZcENnyIrpRV4ERvMUoPSTV0zIP0QPzJvz80g= +go.opentelemetry.io/collector/consumer/consumererror v0.117.0/go.mod h1:L47xOVC+Vzos8350j3SWtU43w7rzms6UDhb6IrFxymY= +go.opentelemetry.io/collector/consumer/consumererror/xconsumererror v0.117.0 h1:gT9VUzerc4rSRUDMEBQdrgBxbrpjinoa4Oxo5qlj6gw= +go.opentelemetry.io/collector/consumer/consumererror/xconsumererror v0.117.0/go.mod h1:AzJIPm65RpEeoQk8OuQ4HLT6QQPDNrWWKk8IEaNBiIQ= +go.opentelemetry.io/collector/consumer/consumertest v0.117.0 h1:9WFyyjLudvfJDEuUaGsQyNRd1m6D1iRg8Iyg3xliFko= +go.opentelemetry.io/collector/consumer/consumertest v0.117.0/go.mod h1:B7A+OS76QKAzM8W7cmvlfVynFELj9Sa444hSm1SILFw= +go.opentelemetry.io/collector/consumer/xconsumer v0.117.0 h1:vsBNJGaEbYqgMU3PEsOcqjMxX5ul++Cxda44sttoi8c= +go.opentelemetry.io/collector/consumer/xconsumer v0.117.0/go.mod h1:dTr+Tms53lRLvR3OAzYic0yhcwldhTUdVIwJNSDmBmw= +go.opentelemetry.io/collector/exporter v0.117.0 h1:A9kVXzdb8i1eFELImuaSPyijAfg4qMIpM/4y/98mlxk= +go.opentelemetry.io/collector/exporter v0.117.0/go.mod h1:Cbrorch2s18w1X7+A+zXQtAffbInnIOP7Su26gbRG+k= +go.opentelemetry.io/collector/exporter/debugexporter v0.117.0 h1:/ZLnlpKulaeqHAudVL+cfupfgETxpuiANaqaffJ3e10= +go.opentelemetry.io/collector/exporter/debugexporter v0.117.0/go.mod h1:gAFxD8cSJMx1GRB/6XwfFRapCD0CsP6MpkQx892NyNY= +go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0 h1:1e991aHPgSvWFMOFFir40HANg2SkXcrkG4AlRvK2+KI= +go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0/go.mod h1:TkPEGX28zDvGAqlJRZQhKohG+82iN2lWPjF+dTuzS9Q= +go.opentelemetry.io/collector/exporter/exportertest v0.117.0 h1:u+loeqxpniMiJL1iqc/lCCcfniWrqHBgJTAjXfqVBqQ= +go.opentelemetry.io/collector/exporter/exportertest v0.117.0/go.mod h1:GyHwJLsOPPau0m+TYrIA7jWD9/GU+ID+l/9sL0cAqhE= +go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0 h1:A/qDjii7WN2Wdx+gtdLvSVpPu8to6ogVutxIggNBEio= +go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0/go.mod h1:rW4Re7GGCPB4JwZoZjXaPqJ77GEIr8OjTz5YK59avJM= +go.opentelemetry.io/collector/exporter/xexporter v0.117.0 h1:BB8D0Dvb46CVAZrnPEg5nYgXO7LzONmXeGKEfzSIOZs= +go.opentelemetry.io/collector/exporter/xexporter v0.117.0/go.mod h1:yo0T8WkvLCJ7NOqIquHGFe4Xpuc4CbDb8a06T2G5De4= +go.opentelemetry.io/collector/extension v0.117.0 h1:B3cG7g+wbhmpMFugaDxOcyiPKeulaW8+EQdJbZxDfho= +go.opentelemetry.io/collector/extension v0.117.0/go.mod h1:WjyD5h9N5Y0SF8azB2rulvHJieJoWqroGO5hi3ax5+8= +go.opentelemetry.io/collector/extension/auth v0.117.0 h1:tXQdYIdcABXalWyFZP22pREY7+nWUNurx8Y6FseWs7w= +go.opentelemetry.io/collector/extension/auth v0.117.0/go.mod h1:ofrV2BuE46+k7Su/h0ccrMl5Zk5Y7NVlzOb3AwU7Dzw= +go.opentelemetry.io/collector/extension/auth/authtest v0.117.0 h1:wV4OIiWrt7gteQrxL8MCmGvjGhMiu5TplKJHOfVZO6Y= +go.opentelemetry.io/collector/extension/auth/authtest v0.117.0/go.mod h1:nHxcAOyo26JnuYwKIoQM9mDlSXpERQrbjIw3Dtp9hug= +go.opentelemetry.io/collector/extension/extensioncapabilities v0.117.0 h1:YbCF0s0jywLZgwNUyKdPUMLMZs3nUPm1tGvJz8x6wTU= +go.opentelemetry.io/collector/extension/extensioncapabilities v0.117.0/go.mod h1:VArn6UKAy4pqlATfhDFfc8UOwX/TtavPF5pgAL70AEw= +go.opentelemetry.io/collector/extension/extensiontest v0.117.0 h1:XH+tkHdATylYZtASZKK3rCoN/xlaFi8MXLh07ZlQQWw= +go.opentelemetry.io/collector/extension/extensiontest v0.117.0/go.mod h1:ABqB9D41p4MCeGVmABOgJi7i7roWZlFbqeFJDy7lskQ= +go.opentelemetry.io/collector/extension/xextension v0.117.0 h1:ADUKWHGaVvvmebJHiNRuX6YAfQXFDW/UaXK9W1hCo1k= +go.opentelemetry.io/collector/extension/xextension v0.117.0/go.mod h1:BmR8xN7Ja+El4IJ9aVmtON2miudjsbq2COZ9azVXsNg= +go.opentelemetry.io/collector/extension/zpagesextension v0.117.0 h1:TNSMgnCYZ1He2ANJQDoBEQ2tuHMa97qM5cpLErNLous= +go.opentelemetry.io/collector/extension/zpagesextension v0.117.0/go.mod h1:c82ly0hN5nMEtXY9mNdS9xVToYxbUjXblnXZCoICwCc= +go.opentelemetry.io/collector/featuregate v1.23.0 h1:N033ROo85qKrsK16QzR6RV+3UWOWF7kpOO8FSnX99s0= +go.opentelemetry.io/collector/featuregate v1.23.0/go.mod h1:3GaXqflNDVwWndNGBJ1+XJFy3Fv/XrFgjMN60N3z7yg= +go.opentelemetry.io/collector/internal/fanoutconsumer v0.117.0 h1:IfObXF9WEixWA9baPt0d4GOv8XGxmlsX7oAyD9Gdq/4= +go.opentelemetry.io/collector/internal/fanoutconsumer v0.117.0/go.mod h1:n+hmwNk4CbOTmQyUo1K4CEnCGcrPd7RY3E6ljrQ2GYo= +go.opentelemetry.io/collector/otelcol v0.117.0 h1:BWmXS+Qh8ypu95w5PKz4NEcyRfX9TzoXQaqD6antji8= +go.opentelemetry.io/collector/otelcol v0.117.0/go.mod h1:jbEizqJKjZ1Q7XIbKvYc+vF2sxW5aw0LO7U8wj7wysM= +go.opentelemetry.io/collector/pdata v1.23.0 h1:tEk0dkfB8RdSukoOMfEa8duB938gfZowdfRkrJxGDrw= +go.opentelemetry.io/collector/pdata v1.23.0/go.mod h1:I2jggpBMiO8A+7TXhzNpcJZkJtvi1cU0iVNIi+6bc+o= +go.opentelemetry.io/collector/pdata/pprofile v0.117.0 h1:AyOK+rkNGeawmLGUqF84wYks22BSGJtEV++3YSfvD1I= +go.opentelemetry.io/collector/pdata/pprofile v0.117.0/go.mod h1:eh7TLIkLrSI79/R3RL+sZsKpLS0k+83WntucPtXC5Ak= +go.opentelemetry.io/collector/pdata/testdata v0.117.0 h1:ainpacShKHaDkPK6lcvgJ0aPKYUD/E3+I0gYJZleedo= +go.opentelemetry.io/collector/pdata/testdata v0.117.0/go.mod h1:LZAymmRKHQEqJqJUSO15rej3+V1rNRyBMF5mWCKCMBY= +go.opentelemetry.io/collector/pipeline v0.117.0 h1:CSv0Dd3n9AQNQ73e7PdEkgexkSMRZliKATxkoZKUFcY= +go.opentelemetry.io/collector/pipeline v0.117.0/go.mod h1:qE3DmoB05AW0C3lmPvdxZqd/H4po84NPzd5MrqgtL74= +go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0 h1:jnHQNaNfVRIdrtOPCORUy8s1cEJyxql3uv/WQ1ve1Js= +go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0/go.mod h1:lNY3uQjRcb3f7CW1JQMXJcWzCJp5122LOKrKs5eito8= +go.opentelemetry.io/collector/processor v0.117.0 h1:K4WdaNC5ROIoLRGgyHmXxtw7xVpAMR4cIMQ5PVLP5cI= +go.opentelemetry.io/collector/processor v0.117.0/go.mod h1:4ewsyJD4n8GjFN+mFbxgr7uXLZYNcJEnH3wl47aDV7s= +go.opentelemetry.io/collector/processor/processortest v0.117.0 h1:c2zjsm3nQDkq9GErzhczN7psGI5Wk0eqXM5LGrX3wxg= +go.opentelemetry.io/collector/processor/processortest v0.117.0/go.mod h1:nywNHogkxp++ab3QkXpWKlv41Gkm9cAYB4PHvyoHwjs= +go.opentelemetry.io/collector/processor/xprocessor v0.117.0 h1:yGBjlY8HRb2AqYo1Q8pKJOLRbmZKrjeeTO4COiP45OU= +go.opentelemetry.io/collector/processor/xprocessor v0.117.0/go.mod h1:MnyEaS47cqol7Cph6LnYIp0g2Km4M+I1vWTwiDeuBN0= +go.opentelemetry.io/collector/receiver v0.117.0 h1:jm+b2G2IKKwGE213lB9cviKEdeATvYtNSY1kO0XdpMM= +go.opentelemetry.io/collector/receiver v0.117.0/go.mod h1:fZXigB3afp54OE+ogPcup/RPwI7j+CwZh9Mz6ObB/Cg= +go.opentelemetry.io/collector/receiver/receivertest v0.117.0 h1:aN4zOuWsiARa+RG9f89JyIrJbx5wsQ71Y0giiHsO1z8= +go.opentelemetry.io/collector/receiver/receivertest v0.117.0/go.mod h1:1wnGEowDmlO89feq1P+b4tQI2G/+iJxRrMallw7zeJE= +go.opentelemetry.io/collector/receiver/xreceiver v0.117.0 h1:HJjBj6P3/WQoYaRKZkWZHnUUCVFpBieqGKzKHcT6HUw= +go.opentelemetry.io/collector/receiver/xreceiver v0.117.0/go.mod h1:K1qMjIiAg6i3vHA+/EpM8nkhna3uIgoEellE2yuhz7A= +go.opentelemetry.io/collector/semconv v0.117.0 h1:SavOvSbHPVD/QdAnXlI/cMca+yxCNyXStY1mQzerHs4= +go.opentelemetry.io/collector/semconv v0.117.0/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= +go.opentelemetry.io/collector/service v0.117.0 h1:yx3ZwnjHcL1YAWZDK2Kxco1BSB228+RaCwgmMzXykqE= +go.opentelemetry.io/collector/service v0.117.0/go.mod h1:Mtxu9Qn/90kdRrEqRr6n7MbtnW6qF1qCIi/u2LMYrRo= +go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 h1:j8icMXyyqNf6HGuwlYhniPnVsbJIq7n+WirDu3VAJdQ= +go.opentelemetry.io/contrib/bridges/otelzap v0.6.0/go.mod h1:evIOZpl+kAlU5IsaYX2Siw+IbpacAZvXemVsgt70uvw= +go.opentelemetry.io/contrib/config v0.10.0 h1:2JknAzMaYjxrHkTnZh3eOme/Y2P5eHE2SWfhfV6Xd6c= +go.opentelemetry.io/contrib/config v0.10.0/go.mod h1:aND2M6/KfNkntI5cyvHriR/zvZgPf8j9yETdSmvpfmc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 h1:qtFISDHKolvIxzSs0gIaiPUPR0Cucb0F2coHC7ZLdps= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0/go.mod h1:Y+Pop1Q6hCOnETWTW4NROK/q1hv50hM7yDaUTjG8lp8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= +go.opentelemetry.io/contrib/propagators/b3 v1.31.0 h1:PQPXYscmwbCp76QDvO4hMngF2j8Bx/OTV86laEl8uqo= +go.opentelemetry.io/contrib/propagators/b3 v1.31.0/go.mod h1:jbqfV8wDdqSDrAYxVpXQnpM0XFMq2FtDesblJ7blOwQ= +go.opentelemetry.io/contrib/zpages v0.56.0 h1:W7vP6s3juzL5KiHpr41zLNmsJ0QAZudYu8ay0zGAoko= +go.opentelemetry.io/contrib/zpages v0.56.0/go.mod h1:IxPRP4TYHw9jLeaEOSDIiA9zmyJNZNO6sbW55iMvSXs= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 h1:mMOmtYie9Fx6TSVzw4W+NTpvoaS1JWWga37oI1a/4qQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0/go.mod h1:yy7nDsMMBUkD+jeekJ36ur5f3jJIrmCwUrY67VFhNpA= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0 h1:j7ZSD+5yn+lo3sGV69nW04rRR0jhYnBwjuX3r0HvnK0= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.32.0/go.mod h1:WXbYJTUaZXAbYd8lbgGuvih0yuCfOFC5RJoYnoLcGz8= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0 h1:t/Qur3vKSkUCcDVaSumWF2PKHt85pc7fRvFuoVT8qFU= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0/go.mod h1:Rl61tySSdcOJWoEgYZVtmnKdA0GeKrSqkHC1t+91CH8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4= +go.opentelemetry.io/otel/exporters/prometheus v0.54.0 h1:rFwzp68QMgtzu9PgP3jm9XaMICI6TsofWWPcBDKwlsU= +go.opentelemetry.io/otel/exporters/prometheus v0.54.0/go.mod h1:QyjcV9qDP6VeK5qPyKETvNjmaaEc7+gqjh4SS0ZYzDU= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0 h1:TwmL3O3fRR80m8EshBrd8YydEZMcUCsZXzOUlnFohwM= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.7.0/go.mod h1:tH98dDv5KPmPThswbXA0fr0Lwfs+OhK8HgaCo7PjRrk= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.32.0 h1:SZmDnHcgp3zwlPBS2JX2urGYe/jBKEIT6ZedHRUyCz8= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.32.0/go.mod h1:fdWW0HtZJ7+jNpTKUR0GpMEDP69nR8YBJQxNiVCE3jk= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0 h1:UGZ1QwZWY67Z6BmckTU+9Rxn04m2bD3gD6Mk0OIOCPk= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.31.0/go.mod h1:fcwWuDuaObkkChiDlhEpSq9+X1C0omv+s5mBtToAQ64= +go.opentelemetry.io/otel/log v0.8.0 h1:egZ8vV5atrUWUbnSsHn6vB8R21G2wrKqNiDt3iWertk= +go.opentelemetry.io/otel/log v0.8.0/go.mod h1:M9qvDdUTRCopJcGRKg57+JSQ9LgLBrwwfC32epk5NX8= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/log v0.7.0 h1:dXkeI2S0MLc5g0/AwxTZv6EUEjctiH8aG14Am56NTmQ= +go.opentelemetry.io/otel/sdk/log v0.7.0/go.mod h1:oIRXpW+WD6M8BuGj5rtS0aRu/86cbDV/dAfNaZBIjYM= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= +google.golang.org/genproto/googleapis/api v0.0.0-20241206012308-a4fef0638583 h1:v+j+5gpj0FopU0KKLDGfDo9ZRRpKdi5UBrCP0f76kuY= +google.golang.org/genproto/googleapis/api v0.0.0-20241206012308-a4fef0638583/go.mod h1:jehYqy3+AhJU9ve55aNOaSml7wUXjF9x6z2LcCfpAhY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 h1:IfdSdTcLFy4lqUQrQJLkLt1PB+AsqVz6lwkWPzWEz10= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= +google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU= +google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/loadgen/prom_scraper.go b/loadgen/prom_scraper.go new file mode 100644 index 00000000..32b11ec7 --- /dev/null +++ b/loadgen/prom_scraper.go @@ -0,0 +1,66 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package loadgen // import "github.com/elastic/opentelemetry-collector-components/loadgen" + +import ( + dto "github.com/prometheus/client_model/go" + "github.com/prometheus/prom2json" +) + +func GetTelemetrySent() (logs, metricPoints, spans int64, err error) { + done := make(chan struct{}) + mfChan := make(chan *dto.MetricFamily, 1024) + go func() { + for { + select { + case mf := <-mfChan: + if mf == nil { + close(done) + return + } + for _, m := range mf.GetMetric() { + var isOtlp bool + for _, l := range m.GetLabel() { + if l.GetName() == "exporter" && l.GetValue() == "otlp" { + isOtlp = true + } + } + if isOtlp { + v := int64(m.GetCounter().GetValue()) + switch mf.GetName() { + case "otelcol_exporter_sent_log_records": + logs = v + case "otelcol_exporter_sent_metric_points": + metricPoints = v + case "otelcol_exporter_sent_spans": + spans = v + } + } + } + + } + } + + }() + err = prom2json.FetchMetricFamilies("http://127.0.0.1:8888/metrics", mfChan, nil) + if err != nil { + return + } + <-done + return +} diff --git a/loadgen/runner.go b/loadgen/runner.go new file mode 100644 index 00000000..601e9d97 --- /dev/null +++ b/loadgen/runner.go @@ -0,0 +1,127 @@ +package loadgen + +import ( + "context" + "flag" + "fmt" + "net/url" + "os" + "strings" +) + +var Config struct { + ServerURL *url.URL + SecretToken string + APIKey string + Secure bool + Headers map[string]string + CollectorConfigPath string +} + +var FlagSet = flag.NewFlagSet("", flag.ExitOnError) + +func Init() { + // Server config + FlagSet.Func( + "server", + "server URL (default http://127.0.0.1:8200)", + func(server string) (err error) { + if server != "" { + Config.ServerURL, err = url.Parse(server) + } + return + }) + FlagSet.StringVar(&Config.SecretToken, "secret-token", "", "secret token for APM Server") + FlagSet.StringVar(&Config.APIKey, "api-key", "", "API key for APM Server") + FlagSet.BoolVar(&Config.Secure, "secure", false, "validate the remote server TLS certificates") + FlagSet.Func("header", + "extra headers to use when sending data to the server", + func(s string) error { + k, v, ok := strings.Cut(s, "=") + if !ok { + return fmt.Errorf("invalid header '%s': format must be key=value", s) + } + if len(Config.Headers) == 0 { + Config.Headers = make(map[string]string) + } + Config.Headers[k] = v + return nil + }, + ) + + FlagSet.StringVar(&Config.CollectorConfigPath, "config", "", "Collector config path") + + // For configs that can be set via environment variables, set the required + // flags from env if they are not explicitly provided via command line + setFlagsFromEnv() +} + +func getAuthorizationHeaderValue(apiKey, secretToken string) string { + if apiKey != "" { + return fmt.Sprintf("ApiKey %s", apiKey) + } else if secretToken != "" { + return fmt.Sprintf("Bearer %s", secretToken) + } + return "" +} + +func setFlagsFromEnv() { + // value[0] is environment key + // value[1] is default value + flagEnvMap := map[string][]string{ + "server": {"ELASTIC_APM_SERVER_URL", "http://127.0.0.1:8200"}, + "secret-token": {"ELASTIC_APM_SECRET_TOKEN", ""}, + "api-key": {"ELASTIC_APM_API_KEY", ""}, + "secure": {"ELASTIC_APM_VERIFY_SERVER_CERT", "false"}, + } + + for k, v := range flagEnvMap { + FlagSet.Set(k, getEnvOrDefault(v[0], v[1])) + } +} + +func getEnvOrDefault(name, defaultValue string) string { + value := os.Getenv(name) + if value != "" { + return value + } + return defaultValue +} + +// CollectorConfigFilesFromConfig returns a slice of strings, each can be passed to the collector using --config +func CollectorConfigFilesFromConfig() (configFiles []string) { + sets := CollectorSetFromConfig() + for _, s := range sets { + idx := strings.Index(s, "=") + if idx == -1 { + panic("missing = in --set") // Should never happen as all the strings are hardcoded below. + } + v := "yaml:" + strings.TrimSpace(strings.ReplaceAll(s[:idx], ".", "::")) + ": " + strings.TrimSpace(s[idx+1:]) + configFiles = append(configFiles, v) + } + return +} + +// CollectorSetFromConfig returns a slice of strings, each can be passed to the collector using --set +func CollectorSetFromConfig() (configSets []string) { + configSets = append(configSets, fmt.Sprintf("exporters.otlp.endpoint=%s", Config.ServerURL)) + + if v := getAuthorizationHeaderValue(Config.APIKey, Config.SecretToken); v != "" { + configSets = append(configSets, fmt.Sprintf("exporters.otlp.headers.Authorization=%s", v)) + } + + for k, v := range Config.Headers { + configSets = append(configSets, fmt.Sprintf("exporters.otlp.headers.%s=%s", k, v)) + } + + configSets = append(configSets, fmt.Sprintf("exporters.otlp.tls.insecure=%v", !Config.Secure)) + + return +} + +func Run(ctx context.Context, stop chan bool) error { + var configFiles []string + configFiles = append(configFiles, Config.CollectorConfigPath) + configFiles = append(configFiles, CollectorConfigFilesFromConfig()...) + return RunCollector(ctx, stop, configFiles) +} From f9da22fa5a33068dee913403c26b91bcb921f370 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Tue, 14 Jan 2025 10:42:26 +0000 Subject: [PATCH 02/51] Move config file --- Makefile | 4 ++-- loadgen/{ => cmd/otelsoak}/config.example.yaml | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename loadgen/{ => cmd/otelsoak}/config.example.yaml (100%) diff --git a/Makefile b/Makefile index a24d92a1..ce84501b 100644 --- a/Makefile +++ b/Makefile @@ -94,9 +94,9 @@ builddocker: # Validate that the Elastic components collector can run with the example loadgen configuration. .PHONY: loadgencol-validate loadgen-validate: genelasticcol - ELASTIC_APM_SERVER_URL=http://localhost:8200 ELASTIC_APM_API_KEY=foobar ./_build/elastic-collector-components validate --config ./loadgen/config.example.yaml + ELASTIC_APM_SERVER_URL=http://localhost:8200 ELASTIC_APM_API_KEY=foobar ./_build/elastic-collector-components validate --config ./loadgen/cmd/otelsoak/config.example.yaml # Run loadgen .PHONY: loadgencol-run loadgen-run: genelasticcol - TESTDATA_DIR=./loadgen ./_build/elastic-collector-components --config ./loadgen/config.example.yaml $(ARGS) + TESTDATA_DIR=./loadgen ./_build/elastic-collector-components --config ./loadgen/cmd/otelsoak/config.example.yaml $(ARGS) diff --git a/loadgen/config.example.yaml b/loadgen/cmd/otelsoak/config.example.yaml similarity index 100% rename from loadgen/config.example.yaml rename to loadgen/cmd/otelsoak/config.example.yaml From 4a3027f8f32b7cc5fc6a3ae13e2ac1f02beeeb6a Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Tue, 14 Jan 2025 10:47:47 +0000 Subject: [PATCH 03/51] Make otelsoak a symlink --- loadgen/{ => cmd/otelbench}/Makefile | 0 loadgen/{ => cmd/otelbench}/collector.go | 6 +-- loadgen/{ => cmd/otelbench}/components.go | 2 +- loadgen/cmd/otelbench/config.yaml | 40 ++++++++++++++++ loadgen/{ => cmd/otelbench}/go.mod | 4 +- loadgen/{ => cmd/otelbench}/go.sum | 0 loadgen/{ => cmd/otelbench}/prom_scraper.go | 2 +- loadgen/{ => cmd/otelbench}/runner.go | 2 +- loadgen/cmd/otelsoak/main.go | 53 --------------------- loadgen/cmd/otelsoak/otelsoak | 1 + 10 files changed, 49 insertions(+), 61 deletions(-) rename loadgen/{ => cmd/otelbench}/Makefile (100%) rename loadgen/{ => cmd/otelbench}/collector.go (94%) rename loadgen/{ => cmd/otelbench}/components.go (96%) create mode 100644 loadgen/cmd/otelbench/config.yaml rename loadgen/{ => cmd/otelbench}/go.mod (98%) rename loadgen/{ => cmd/otelbench}/go.sum (100%) rename loadgen/{ => cmd/otelbench}/prom_scraper.go (95%) rename loadgen/{ => cmd/otelbench}/runner.go (99%) delete mode 100644 loadgen/cmd/otelsoak/main.go create mode 120000 loadgen/cmd/otelsoak/otelsoak diff --git a/loadgen/Makefile b/loadgen/cmd/otelbench/Makefile similarity index 100% rename from loadgen/Makefile rename to loadgen/cmd/otelbench/Makefile diff --git a/loadgen/collector.go b/loadgen/cmd/otelbench/collector.go similarity index 94% rename from loadgen/collector.go rename to loadgen/cmd/otelbench/collector.go index 854f1dc9..b65d5b49 100644 --- a/loadgen/collector.go +++ b/loadgen/cmd/otelbench/collector.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package loadgen // import "github.com/elastic/opentelemetry-collector-components/loadgen" +package main // import "github.com/elastic/opentelemetry-collector-components/loadgen" import ( "context" @@ -32,8 +32,8 @@ import ( ) const ( - buildDescription = "loadgen distribution" - buildVersion = "0.1.0" + buildDescription = "otelbench distribution" + buildVersion = "0.0.1" ) func RunCollector(ctx context.Context, stop chan bool, configFiles []string) error { diff --git a/loadgen/components.go b/loadgen/cmd/otelbench/components.go similarity index 96% rename from loadgen/components.go rename to loadgen/cmd/otelbench/components.go index 898b3910..febb055b 100644 --- a/loadgen/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package loadgen // import "github.com/elastic/opentelemetry-collector-components/loadgen" +package main // import "github.com/elastic/opentelemetry-collector-components/loadgen" import ( "github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor" diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml new file mode 100644 index 00000000..d2e284f3 --- /dev/null +++ b/loadgen/cmd/otelbench/config.yaml @@ -0,0 +1,40 @@ +receivers: + loadgen: + +exporters: + otlp: + sending_queue: + enabled: false + timeout: 60s + +processors: + transform/rewrite: # Rewrite telemetry to increase cardinality + trace_statements: + - context: span + statements: + # The worst way to generate a random ID, but is the simplest in OTTL + # Only randomize trace ID such that span relationships are still maintained + - set(trace_id.string, Substring(MD5(UUID()), 0, 32)) + +service: + pipelines: + logs: + receivers: [loadgen] + processors: [transform/rewrite] + exporters: [otlp] + metrics: + receivers: [loadgen] + processors: [transform/rewrite] + exporters: [otlp] + traces: + receivers: [loadgen] + processors: [transform/rewrite] + exporters: [otlp] + telemetry: + metrics: + readers: + - pull: + exporter: + prometheus: + host: '127.0.0.1' + port: 8888 diff --git a/loadgen/go.mod b/loadgen/cmd/otelbench/go.mod similarity index 98% rename from loadgen/go.mod rename to loadgen/cmd/otelbench/go.mod index 2b8662c7..bb9e8a91 100644 --- a/loadgen/go.mod +++ b/loadgen/cmd/otelbench/go.mod @@ -164,6 +164,6 @@ require ( ) replace ( - github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor => ./../processor/ratelimitprocessor - github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver => ./../receiver/loadgenreceiver + github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor => ./../../../processor/ratelimitprocessor + github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver => ./../../../receiver/loadgenreceiver ) diff --git a/loadgen/go.sum b/loadgen/cmd/otelbench/go.sum similarity index 100% rename from loadgen/go.sum rename to loadgen/cmd/otelbench/go.sum diff --git a/loadgen/prom_scraper.go b/loadgen/cmd/otelbench/prom_scraper.go similarity index 95% rename from loadgen/prom_scraper.go rename to loadgen/cmd/otelbench/prom_scraper.go index 32b11ec7..fb79b4a7 100644 --- a/loadgen/prom_scraper.go +++ b/loadgen/cmd/otelbench/prom_scraper.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package loadgen // import "github.com/elastic/opentelemetry-collector-components/loadgen" +package main // import "github.com/elastic/opentelemetry-collector-components/loadgen" import ( dto "github.com/prometheus/client_model/go" diff --git a/loadgen/runner.go b/loadgen/cmd/otelbench/runner.go similarity index 99% rename from loadgen/runner.go rename to loadgen/cmd/otelbench/runner.go index 601e9d97..27e1294e 100644 --- a/loadgen/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -1,4 +1,4 @@ -package loadgen +package main import ( "context" diff --git a/loadgen/cmd/otelsoak/main.go b/loadgen/cmd/otelsoak/main.go deleted file mode 100644 index 10609a8b..00000000 --- a/loadgen/cmd/otelsoak/main.go +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package main - -import ( - "fmt" - "log" - - "github.com/elastic/opentelemetry-collector-components/loadgen" - "github.com/spf13/cobra" - "go.opentelemetry.io/collector/otelcol" -) - -func main() { - loadgen.Init() - - settings, err := loadgen.NewCollectorSettings(nil) - if err != nil { - log.Fatalf("collector new settings error: %v", err) - } - - cmd := otelcol.NewCommand(settings) - cmd.Flags().AddGoFlagSet(loadgen.FlagSet) - runE := cmd.RunE - cmd.RunE = func(cmd *cobra.Command, args []string) error { - // This is to pass in parsed loadgen flags e.g. api-key, secret-token to otel collector - sets := loadgen.CollectorSetFromConfig() - for _, set := range sets { - if err := cmd.Flags().Set("set", set); err != nil { - return fmt.Errorf("error passing --set to collector: %w", err) - } - } - return runE(cmd, args) - } - if err := cmd.Execute(); err != nil { - log.Fatalf("collector execute error: %v", err) - } -} diff --git a/loadgen/cmd/otelsoak/otelsoak b/loadgen/cmd/otelsoak/otelsoak new file mode 120000 index 00000000..09e8e387 --- /dev/null +++ b/loadgen/cmd/otelsoak/otelsoak @@ -0,0 +1 @@ +../../_build/elastic-collector-components \ No newline at end of file From 1defbf68ecea72592ccda8f2ac404cc3277c1acd Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Tue, 14 Jan 2025 10:54:48 +0000 Subject: [PATCH 04/51] Fix symlink --- loadgen/cmd/otelsoak/otelsoak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loadgen/cmd/otelsoak/otelsoak b/loadgen/cmd/otelsoak/otelsoak index 09e8e387..ecbcb1e2 120000 --- a/loadgen/cmd/otelsoak/otelsoak +++ b/loadgen/cmd/otelsoak/otelsoak @@ -1 +1 @@ -../../_build/elastic-collector-components \ No newline at end of file +../../../_build/elastic-collector-components \ No newline at end of file From d39e396ef7f49e9ec71e44c34a981fd7342db6c9 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Wed, 15 Jan 2025 22:37:41 +0000 Subject: [PATCH 05/51] Fix makefile --- loadgen/cmd/otelbench/Makefile | 2 +- loadgen/cmd/otelbench/collector.go | 2 +- loadgen/cmd/otelbench/components.go | 7 ++++--- loadgen/cmd/otelbench/main.go | 10 ++++------ loadgen/cmd/otelbench/prom_scraper.go | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/loadgen/cmd/otelbench/Makefile b/loadgen/cmd/otelbench/Makefile index cef6fcbd..b157d14a 100644 --- a/loadgen/cmd/otelbench/Makefile +++ b/loadgen/cmd/otelbench/Makefile @@ -1 +1 @@ -include ../Makefile.Common \ No newline at end of file +include ../../../Makefile.Common \ No newline at end of file diff --git a/loadgen/cmd/otelbench/collector.go b/loadgen/cmd/otelbench/collector.go index b65d5b49..461a874c 100644 --- a/loadgen/cmd/otelbench/collector.go +++ b/loadgen/cmd/otelbench/collector.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package main // import "github.com/elastic/opentelemetry-collector-components/loadgen" +package main import ( "context" diff --git a/loadgen/cmd/otelbench/components.go b/loadgen/cmd/otelbench/components.go index febb055b..a1061c16 100644 --- a/loadgen/cmd/otelbench/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -15,11 +15,9 @@ // specific language governing permissions and limitations // under the License. -package main // import "github.com/elastic/opentelemetry-collector-components/loadgen" +package main import ( - "github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor" - "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" "github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor" "go.opentelemetry.io/collector/connector" "go.opentelemetry.io/collector/exporter" @@ -29,6 +27,9 @@ import ( "go.opentelemetry.io/collector/otelcol" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" + + "github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor" + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) func components() (otelcol.Factories, error) { diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 05ad3765..0d4c94bb 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -23,13 +23,11 @@ import ( "fmt" "testing" "time" - - "github.com/elastic/opentelemetry-collector-components/loadgen" ) func main() { - loadgen.Init() - flag.CommandLine = loadgen.FlagSet + Init() + flag.CommandLine = FlagSet testing.Init() flag.Parse() @@ -43,7 +41,7 @@ func main() { select { case <-stop: case <-ticker.C: - logs, metricPoints, spans, err := loadgen.GetTelemetrySent() + logs, metricPoints, spans, err := GetTelemetrySent() if err != nil { b.Logf("error getting internal telemetry: %s", err) continue @@ -62,7 +60,7 @@ func main() { } }() - err := loadgen.Run(context.Background(), stop) + err := Run(context.Background(), stop) if err != nil { fmt.Println(err) b.Log(err) diff --git a/loadgen/cmd/otelbench/prom_scraper.go b/loadgen/cmd/otelbench/prom_scraper.go index fb79b4a7..5b3eacb0 100644 --- a/loadgen/cmd/otelbench/prom_scraper.go +++ b/loadgen/cmd/otelbench/prom_scraper.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package main // import "github.com/elastic/opentelemetry-collector-components/loadgen" +package main import ( dto "github.com/prometheus/client_model/go" From d8e402a53e2b19138f7b64395adae760ce345688 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Wed, 15 Jan 2025 22:41:52 +0000 Subject: [PATCH 06/51] Rename to otelsoak --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ce84501b..d24a9223 100644 --- a/Makefile +++ b/Makefile @@ -91,12 +91,12 @@ builddocker: fi; \ docker build -t $$IMAGE_NAME -f distributions/elastic-components/Dockerfile . -# Validate that the Elastic components collector can run with the example loadgen configuration. +# Validate that the Elastic components collector can run with the example otelsoak configuration. .PHONY: loadgencol-validate loadgen-validate: genelasticcol - ELASTIC_APM_SERVER_URL=http://localhost:8200 ELASTIC_APM_API_KEY=foobar ./_build/elastic-collector-components validate --config ./loadgen/cmd/otelsoak/config.example.yaml + ELASTIC_APM_SERVER_URL=http://localhost:8200 ELASTIC_APM_API_KEY=foobar ./loadgen/cmd/otelsoak/otelsoak validate --config ./loadgen/cmd/otelsoak/config.example.yaml # Run loadgen .PHONY: loadgencol-run loadgen-run: genelasticcol - TESTDATA_DIR=./loadgen ./_build/elastic-collector-components --config ./loadgen/cmd/otelsoak/config.example.yaml $(ARGS) + ./loadgen/cmd/otelsoak/otelsoak --config ./loadgen/cmd/otelsoak/config.example.yaml $(ARGS) From b53eb9bcdab31bf5c414df6e1cfaff0534bc8751 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Wed, 15 Jan 2025 23:18:39 +0000 Subject: [PATCH 07/51] Support otlphttp --- loadgen/cmd/otelbench/components.go | 2 ++ loadgen/cmd/otelbench/config.yaml | 12 ++++++-- loadgen/cmd/otelbench/go.mod | 7 +++++ loadgen/cmd/otelbench/go.sum | 2 ++ loadgen/cmd/otelbench/main.go | 3 +- loadgen/cmd/otelbench/runner.go | 39 +++++++++++++----------- loadgen/cmd/otelsoak/config.example.yaml | 8 +++++ 7 files changed, 51 insertions(+), 22 deletions(-) diff --git a/loadgen/cmd/otelbench/components.go b/loadgen/cmd/otelbench/components.go index a1061c16..29be1a89 100644 --- a/loadgen/cmd/otelbench/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/debugexporter" "go.opentelemetry.io/collector/exporter/otlpexporter" + "go.opentelemetry.io/collector/exporter/otlphttpexporter" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/otelcol" "go.opentelemetry.io/collector/processor" @@ -56,6 +57,7 @@ func components() (otelcol.Factories, error) { // Exporters factories.Exporters, err = exporter.MakeFactoryMap( otlpexporter.NewFactory(), + otlphttpexporter.NewFactory(), debugexporter.NewFactory(), ) if err != nil { diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml index d2e284f3..7b5dac41 100644 --- a/loadgen/cmd/otelbench/config.yaml +++ b/loadgen/cmd/otelbench/config.yaml @@ -3,6 +3,12 @@ receivers: exporters: otlp: + endpoint: "localhost:0" + sending_queue: + enabled: false + timeout: 60s + otlphttp: + endpoint: "localhost:0" sending_queue: enabled: false timeout: 60s @@ -21,15 +27,15 @@ service: logs: receivers: [loadgen] processors: [transform/rewrite] - exporters: [otlp] + exporters: [] metrics: receivers: [loadgen] processors: [transform/rewrite] - exporters: [otlp] + exporters: [] traces: receivers: [loadgen] processors: [transform/rewrite] - exporters: [otlp] + exporters: [] telemetry: metrics: readers: diff --git a/loadgen/cmd/otelbench/go.mod b/loadgen/cmd/otelbench/go.mod index bb9e8a91..34933852 100644 --- a/loadgen/cmd/otelbench/go.mod +++ b/loadgen/cmd/otelbench/go.mod @@ -19,6 +19,7 @@ require ( go.opentelemetry.io/collector/exporter v0.117.0 go.opentelemetry.io/collector/exporter/debugexporter v0.117.0 go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0 + go.opentelemetry.io/collector/exporter/otlphttpexporter v0.117.0 go.opentelemetry.io/collector/extension v0.117.0 go.opentelemetry.io/collector/otelcol v0.117.0 go.opentelemetry.io/collector/processor v0.117.0 @@ -36,6 +37,7 @@ require ( github.com/ebitengine/purego v0.8.1 // indirect github.com/elastic/go-grok v0.3.1 // indirect github.com/elastic/lunes v0.1.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -73,12 +75,14 @@ require ( github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil v0.117.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.117.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.117.0 // indirect + github.com/pierrec/lz4/v4 v4.1.22 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/common v0.61.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/prometheus/prometheus v0.54.1 // indirect + github.com/rs/cors v1.11.1 // indirect github.com/shirou/gopsutil/v4 v4.24.12 // indirect github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -87,12 +91,14 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/ua-parser/uap-go v0.0.0-20240611065828-3a4781585db6 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/collector v0.117.0 // indirect go.opentelemetry.io/collector/client v1.23.0 // indirect go.opentelemetry.io/collector/component/componentstatus v0.117.0 // indirect go.opentelemetry.io/collector/component/componenttest v0.117.0 // indirect go.opentelemetry.io/collector/config/configauth v0.117.0 // indirect go.opentelemetry.io/collector/config/configcompression v1.23.0 // indirect go.opentelemetry.io/collector/config/configgrpc v0.117.0 // indirect + go.opentelemetry.io/collector/config/confighttp v0.117.0 // indirect go.opentelemetry.io/collector/config/confignet v1.23.0 // indirect go.opentelemetry.io/collector/config/configopaque v1.23.0 // indirect go.opentelemetry.io/collector/config/configretry v1.23.0 // indirect @@ -128,6 +134,7 @@ require ( go.opentelemetry.io/contrib/bridges/otelzap v0.6.0 // indirect go.opentelemetry.io/contrib/config v0.10.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.31.0 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.7.0 // indirect diff --git a/loadgen/cmd/otelbench/go.sum b/loadgen/cmd/otelbench/go.sum index c4b4e175..7aff1007 100644 --- a/loadgen/cmd/otelbench/go.sum +++ b/loadgen/cmd/otelbench/go.sum @@ -236,6 +236,8 @@ go.opentelemetry.io/collector/exporter/exportertest v0.117.0 h1:u+loeqxpniMiJL1i go.opentelemetry.io/collector/exporter/exportertest v0.117.0/go.mod h1:GyHwJLsOPPau0m+TYrIA7jWD9/GU+ID+l/9sL0cAqhE= go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0 h1:A/qDjii7WN2Wdx+gtdLvSVpPu8to6ogVutxIggNBEio= go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0/go.mod h1:rW4Re7GGCPB4JwZoZjXaPqJ77GEIr8OjTz5YK59avJM= +go.opentelemetry.io/collector/exporter/otlphttpexporter v0.117.0 h1:sEpFjth0x9/gZ6JJfNce1T8RJuNzUWKnDU0TKcejKl0= +go.opentelemetry.io/collector/exporter/otlphttpexporter v0.117.0/go.mod h1:K1A36IRdkEktqESw1FioXuvzMYbQPmiju5T26UIo0Sc= go.opentelemetry.io/collector/exporter/xexporter v0.117.0 h1:BB8D0Dvb46CVAZrnPEg5nYgXO7LzONmXeGKEfzSIOZs= go.opentelemetry.io/collector/exporter/xexporter v0.117.0/go.mod h1:yo0T8WkvLCJ7NOqIquHGFe4Xpuc4CbDb8a06T2G5De4= go.opentelemetry.io/collector/extension v0.117.0 h1:B3cG7g+wbhmpMFugaDxOcyiPKeulaW8+EQdJbZxDfho= diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 0d4c94bb..3497d279 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -27,7 +27,6 @@ import ( func main() { Init() - flag.CommandLine = FlagSet testing.Init() flag.Parse() @@ -41,7 +40,7 @@ func main() { select { case <-stop: case <-ticker.C: - logs, metricPoints, spans, err := GetTelemetrySent() + logs, metricPoints, spans, err := GetTelemetrySent() // FIXME: exporter internal telemetry is broken on otlphttp if err != nil { b.Logf("error getting internal telemetry: %s", err) continue diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 27e1294e..8cb5b40c 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -16,13 +16,12 @@ var Config struct { Secure bool Headers map[string]string CollectorConfigPath string + Exporter string // should be one of [otlp, otlphttp] } -var FlagSet = flag.NewFlagSet("", flag.ExitOnError) - func Init() { // Server config - FlagSet.Func( + flag.Func( "server", "server URL (default http://127.0.0.1:8200)", func(server string) (err error) { @@ -31,10 +30,10 @@ func Init() { } return }) - FlagSet.StringVar(&Config.SecretToken, "secret-token", "", "secret token for APM Server") - FlagSet.StringVar(&Config.APIKey, "api-key", "", "API key for APM Server") - FlagSet.BoolVar(&Config.Secure, "secure", false, "validate the remote server TLS certificates") - FlagSet.Func("header", + flag.StringVar(&Config.SecretToken, "secret-token", "", "secret token for APM Server") + flag.StringVar(&Config.APIKey, "api-key", "", "API key for APM Server") + flag.BoolVar(&Config.Secure, "secure", false, "validate the remote server TLS certificates") + flag.Func("header", "extra headers to use when sending data to the server", func(s string) error { k, v, ok := strings.Cut(s, "=") @@ -49,7 +48,9 @@ func Init() { }, ) - FlagSet.StringVar(&Config.CollectorConfigPath, "config", "", "Collector config path") + flag.StringVar(&Config.CollectorConfigPath, "config", "", "Collector config path") + + flag.StringVar(&Config.Exporter, "exporter", "otlp", "exporter to use, one of [otlp, otlphttp]") // For configs that can be set via environment variables, set the required // flags from env if they are not explicitly provided via command line @@ -76,7 +77,7 @@ func setFlagsFromEnv() { } for k, v := range flagEnvMap { - FlagSet.Set(k, getEnvOrDefault(v[0], v[1])) + flag.Set(k, getEnvOrDefault(v[0], v[1])) } } @@ -89,8 +90,8 @@ func getEnvOrDefault(name, defaultValue string) string { } // CollectorConfigFilesFromConfig returns a slice of strings, each can be passed to the collector using --config -func CollectorConfigFilesFromConfig() (configFiles []string) { - sets := CollectorSetFromConfig() +func CollectorConfigFilesFromConfig(exporter string) (configFiles []string) { + sets := CollectorSetFromConfig(exporter) for _, s := range sets { idx := strings.Index(s, "=") if idx == -1 { @@ -103,18 +104,22 @@ func CollectorConfigFilesFromConfig() (configFiles []string) { } // CollectorSetFromConfig returns a slice of strings, each can be passed to the collector using --set -func CollectorSetFromConfig() (configSets []string) { - configSets = append(configSets, fmt.Sprintf("exporters.otlp.endpoint=%s", Config.ServerURL)) +func CollectorSetFromConfig(exporter string) (configSets []string) { + configSets = append(configSets, fmt.Sprintf("service.pipelines.logs.exporters=[%s]", exporter)) + configSets = append(configSets, fmt.Sprintf("service.pipelines.metrics.exporters=[%s]", exporter)) + configSets = append(configSets, fmt.Sprintf("service.pipelines.traces.exporters=[%s]", exporter)) + + configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) if v := getAuthorizationHeaderValue(Config.APIKey, Config.SecretToken); v != "" { - configSets = append(configSets, fmt.Sprintf("exporters.otlp.headers.Authorization=%s", v)) + configSets = append(configSets, fmt.Sprintf("exporters.%s.headers.Authorization=%s", exporter, v)) } for k, v := range Config.Headers { - configSets = append(configSets, fmt.Sprintf("exporters.otlp.headers.%s=%s", k, v)) + configSets = append(configSets, fmt.Sprintf("exporters.%s.headers.%s=%s", exporter, k, v)) } - configSets = append(configSets, fmt.Sprintf("exporters.otlp.tls.insecure=%v", !Config.Secure)) + configSets = append(configSets, fmt.Sprintf("exporters.%s.tls.insecure=%v", exporter, !Config.Secure)) return } @@ -122,6 +127,6 @@ func CollectorSetFromConfig() (configSets []string) { func Run(ctx context.Context, stop chan bool) error { var configFiles []string configFiles = append(configFiles, Config.CollectorConfigPath) - configFiles = append(configFiles, CollectorConfigFilesFromConfig()...) + configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter)...) return RunCollector(ctx, stop, configFiles) } diff --git a/loadgen/cmd/otelsoak/config.example.yaml b/loadgen/cmd/otelsoak/config.example.yaml index 027b047f..304e9d6d 100644 --- a/loadgen/cmd/otelsoak/config.example.yaml +++ b/loadgen/cmd/otelsoak/config.example.yaml @@ -10,6 +10,14 @@ exporters: sending_queue: enabled: false timeout: 60s + otlphttp: + endpoint: "${env:ELASTIC_APM_SERVER_URL}" + headers: + Authorization: "ApiKey ${env:ELASTIC_APM_API_KEY}" + # Authorization: "Bearer ${env:ELASTIC_APM_SECRET_TOKEN}" + sending_queue: + enabled: false + timeout: 60s debug: From 8bd575b3c6190855b846c6350a16b4fa6a3532d3 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 11:27:23 +0000 Subject: [PATCH 08/51] Benchmark signals separately --- loadgen/cmd/otelbench/config.yaml | 13 ----- loadgen/cmd/otelbench/main.go | 81 +++++++++++++++++++------------ loadgen/cmd/otelbench/runner.go | 28 +++++------ 3 files changed, 63 insertions(+), 59 deletions(-) diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml index 7b5dac41..7e40530a 100644 --- a/loadgen/cmd/otelbench/config.yaml +++ b/loadgen/cmd/otelbench/config.yaml @@ -23,19 +23,6 @@ processors: - set(trace_id.string, Substring(MD5(UUID()), 0, 32)) service: - pipelines: - logs: - receivers: [loadgen] - processors: [transform/rewrite] - exporters: [] - metrics: - receivers: [loadgen] - processors: [transform/rewrite] - exporters: [] - traces: - receivers: [loadgen] - processors: [transform/rewrite] - exporters: [] telemetry: metrics: readers: diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 3497d279..47350eb7 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -30,40 +30,57 @@ func main() { testing.Init() flag.Parse() - result := testing.Benchmark(func(b *testing.B) { - stop := make(chan bool) + var signals []string + if Config.Logs { + signals = append(signals, "logs") + } + if Config.Metrics { + signals = append(signals, "metrics") + } + if Config.Traces { + signals = append(signals, "traces") + } - go func() { - ticker := time.NewTicker(500 * time.Millisecond) - defer ticker.Stop() - for { - select { - case <-stop: - case <-ticker.C: - logs, metricPoints, spans, err := GetTelemetrySent() // FIXME: exporter internal telemetry is broken on otlphttp - if err != nil { - b.Logf("error getting internal telemetry: %s", err) - continue - } - total := logs + metricPoints + spans - if total > int64(b.N) { - b.StopTimer() - close(stop) - b.ReportMetric(float64(logs)/b.Elapsed().Seconds(), "logs/s") - b.ReportMetric(float64(metricPoints)/b.Elapsed().Seconds(), "metric_points/s") - b.ReportMetric(float64(spans)/b.Elapsed().Seconds(), "spans/s") - b.ReportMetric(float64(total)/b.Elapsed().Seconds(), "total/s") - return + for _, signal := range signals { + result := testing.Benchmark(func(b *testing.B) { + stop := make(chan bool) + + go func() { + ticker := time.NewTicker(500 * time.Millisecond) + defer ticker.Stop() + for { + select { + case <-stop: + case <-ticker.C: + logs, metricPoints, spans, err := GetTelemetrySent() // FIXME: exporter internal telemetry is broken on otlphttp + if err != nil { + b.Logf("error getting internal telemetry: %s", err) + continue + } + total := logs + metricPoints + spans + if total > int64(b.N) { + b.StopTimer() + close(stop) + b.ReportMetric(float64(logs)/b.Elapsed().Seconds(), "logs/s") + b.ReportMetric(float64(metricPoints)/b.Elapsed().Seconds(), "metric_points/s") + b.ReportMetric(float64(spans)/b.Elapsed().Seconds(), "spans/s") + b.ReportMetric(float64(total)/b.Elapsed().Seconds(), "total/s") + return + } } } - } - }() + }() - err := Run(context.Background(), stop) - if err != nil { - fmt.Println(err) - b.Log(err) - } - }) - fmt.Println(result.String()) + var configFiles []string + configFiles = append(configFiles, Config.CollectorConfigPath) + configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter, signal)...) + err := RunCollector(context.Background(), stop, configFiles) + if err != nil { + fmt.Println(err) + b.Log(err) + } + }) + fmt.Print(signal) + fmt.Println(result.String()) + } } diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 8cb5b40c..ead277bc 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -1,7 +1,6 @@ package main import ( - "context" "flag" "fmt" "net/url" @@ -17,6 +16,10 @@ var Config struct { Headers map[string]string CollectorConfigPath string Exporter string // should be one of [otlp, otlphttp] + + Logs bool + Metrics bool + Traces bool } func Init() { @@ -52,6 +55,10 @@ func Init() { flag.StringVar(&Config.Exporter, "exporter", "otlp", "exporter to use, one of [otlp, otlphttp]") + flag.BoolVar(&Config.Logs, "logs", true, "benchmark logs") + flag.BoolVar(&Config.Metrics, "metrics", true, "benchmark metrics") + flag.BoolVar(&Config.Traces, "traces", true, "benchmark traces") + // For configs that can be set via environment variables, set the required // flags from env if they are not explicitly provided via command line setFlagsFromEnv() @@ -90,8 +97,8 @@ func getEnvOrDefault(name, defaultValue string) string { } // CollectorConfigFilesFromConfig returns a slice of strings, each can be passed to the collector using --config -func CollectorConfigFilesFromConfig(exporter string) (configFiles []string) { - sets := CollectorSetFromConfig(exporter) +func CollectorConfigFilesFromConfig(exporter, signal string) (configFiles []string) { + sets := CollectorSetFromConfig(exporter, signal) for _, s := range sets { idx := strings.Index(s, "=") if idx == -1 { @@ -104,10 +111,10 @@ func CollectorConfigFilesFromConfig(exporter string) (configFiles []string) { } // CollectorSetFromConfig returns a slice of strings, each can be passed to the collector using --set -func CollectorSetFromConfig(exporter string) (configSets []string) { - configSets = append(configSets, fmt.Sprintf("service.pipelines.logs.exporters=[%s]", exporter)) - configSets = append(configSets, fmt.Sprintf("service.pipelines.metrics.exporters=[%s]", exporter)) - configSets = append(configSets, fmt.Sprintf("service.pipelines.traces.exporters=[%s]", exporter)) +func CollectorSetFromConfig(exporter, signal string) (configSets []string) { + configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.receivers=[loadgen]", signal)) + configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.processors=[transform/rewrite]", signal)) + configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.exporters=[%s]", signal, exporter)) configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) @@ -123,10 +130,3 @@ func CollectorSetFromConfig(exporter string) (configSets []string) { return } - -func Run(ctx context.Context, stop chan bool) error { - var configFiles []string - configFiles = append(configFiles, Config.CollectorConfigPath) - configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter)...) - return RunCollector(ctx, stop, configFiles) -} From 3e07de2dc4b1a09e46956bde24fe96ba93a1457a Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 13:38:07 +0000 Subject: [PATCH 09/51] Use b.N for iteration instead of record count, remove internal telemetry polling --- loadgen/cmd/otelbench/collector.go | 8 ++--- loadgen/cmd/otelbench/components.go | 4 +-- loadgen/cmd/otelbench/main.go | 30 +++++++++---------- loadgen/cmd/otelbench/runner.go | 8 +++-- receiver/loadgenreceiver/config.go | 4 +++ receiver/loadgenreceiver/factory.go | 28 +++++++++++++---- .../loadgenreceiver/internal/loopinglist.go | 12 ++++++-- receiver/loadgenreceiver/logs.go | 18 +++++++---- receiver/loadgenreceiver/metrics.go | 18 +++++++---- receiver/loadgenreceiver/traces.go | 18 +++++++---- 10 files changed, 100 insertions(+), 48 deletions(-) diff --git a/loadgen/cmd/otelbench/collector.go b/loadgen/cmd/otelbench/collector.go index 461a874c..4da507e8 100644 --- a/loadgen/cmd/otelbench/collector.go +++ b/loadgen/cmd/otelbench/collector.go @@ -36,8 +36,8 @@ const ( buildVersion = "0.0.1" ) -func RunCollector(ctx context.Context, stop chan bool, configFiles []string) error { - settings, err := NewCollectorSettings(configFiles) +func RunCollector(ctx context.Context, stop chan bool, configFiles []string, doneCh chan struct{}) error { + settings, err := NewCollectorSettings(configFiles, doneCh) if err != nil { return err } @@ -58,7 +58,7 @@ func RunCollector(ctx context.Context, stop chan bool, configFiles []string) err return svc.Run(cancelCtx) } -func NewCollectorSettings(configPaths []string) (otelcol.CollectorSettings, error) { +func NewCollectorSettings(configPaths []string, doneCh chan struct{}) (otelcol.CollectorSettings, error) { buildInfo := component.BuildInfo{ Command: os.Args[0], Description: buildDescription, @@ -79,7 +79,7 @@ func NewCollectorSettings(configPaths []string) (otelcol.CollectorSettings, erro } return otelcol.CollectorSettings{ - Factories: components, + Factories: func() (otelcol.Factories, error) { return components(doneCh) }, BuildInfo: buildInfo, ConfigProviderSettings: configProviderSettings, // we're handling DisableGracefulShutdown via the cancelCtx being passed diff --git a/loadgen/cmd/otelbench/components.go b/loadgen/cmd/otelbench/components.go index 29be1a89..bc74f65a 100644 --- a/loadgen/cmd/otelbench/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -33,13 +33,13 @@ import ( "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) -func components() (otelcol.Factories, error) { +func components(doneCh chan struct{}) (otelcol.Factories, error) { var err error factories := otelcol.Factories{} // Receivers factories.Receivers, err = receiver.MakeFactoryMap( - loadgenreceiver.NewFactory(), + loadgenreceiver.NewFactoryWithDone(doneCh), ) if err != nil { return otelcol.Factories{}, err diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 47350eb7..7d32050c 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -22,7 +22,6 @@ import ( "flag" "fmt" "testing" - "time" ) func main() { @@ -43,38 +42,37 @@ func main() { for _, signal := range signals { result := testing.Benchmark(func(b *testing.B) { + done := make(chan struct{}) // loadgenreceiver will close the channel after generating b.N stop := make(chan bool) go func() { - ticker := time.NewTicker(500 * time.Millisecond) - defer ticker.Stop() for { select { case <-stop: - case <-ticker.C: - logs, metricPoints, spans, err := GetTelemetrySent() // FIXME: exporter internal telemetry is broken on otlphttp + case <-done: + // TODO: calculate rate without using internal telemetry + // as it is broken on otlphttp + logs, metricPoints, spans, err := GetTelemetrySent() if err != nil { b.Logf("error getting internal telemetry: %s", err) continue } total := logs + metricPoints + spans - if total > int64(b.N) { - b.StopTimer() - close(stop) - b.ReportMetric(float64(logs)/b.Elapsed().Seconds(), "logs/s") - b.ReportMetric(float64(metricPoints)/b.Elapsed().Seconds(), "metric_points/s") - b.ReportMetric(float64(spans)/b.Elapsed().Seconds(), "spans/s") - b.ReportMetric(float64(total)/b.Elapsed().Seconds(), "total/s") - return - } + b.StopTimer() + close(stop) + b.ReportMetric(float64(logs)/b.Elapsed().Seconds(), "logs/s") + b.ReportMetric(float64(metricPoints)/b.Elapsed().Seconds(), "metric_points/s") + b.ReportMetric(float64(spans)/b.Elapsed().Seconds(), "spans/s") + b.ReportMetric(float64(total)/b.Elapsed().Seconds(), "total/s") + return } } }() var configFiles []string configFiles = append(configFiles, Config.CollectorConfigPath) - configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter, signal)...) - err := RunCollector(context.Background(), stop, configFiles) + configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter, signal, b.N)...) + err := RunCollector(context.Background(), stop, configFiles, done) if err != nil { fmt.Println(err) b.Log(err) diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index ead277bc..b0485547 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -97,8 +97,8 @@ func getEnvOrDefault(name, defaultValue string) string { } // CollectorConfigFilesFromConfig returns a slice of strings, each can be passed to the collector using --config -func CollectorConfigFilesFromConfig(exporter, signal string) (configFiles []string) { - sets := CollectorSetFromConfig(exporter, signal) +func CollectorConfigFilesFromConfig(exporter, signal string, iterations int) (configFiles []string) { + sets := CollectorSetFromConfig(exporter, signal, iterations) for _, s := range sets { idx := strings.Index(s, "=") if idx == -1 { @@ -111,11 +111,13 @@ func CollectorConfigFilesFromConfig(exporter, signal string) (configFiles []stri } // CollectorSetFromConfig returns a slice of strings, each can be passed to the collector using --set -func CollectorSetFromConfig(exporter, signal string) (configSets []string) { +func CollectorSetFromConfig(exporter, signal string, iterations int) (configSets []string) { configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.receivers=[loadgen]", signal)) configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.processors=[transform/rewrite]", signal)) configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.exporters=[%s]", signal, exporter)) + configSets = append(configSets, fmt.Sprintf("receivers.loadgen.%s.max_replay=%d", signal, iterations)) + configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) if v := getAuthorizationHeaderValue(Config.APIKey, Config.SecretToken); v != "" { diff --git a/receiver/loadgenreceiver/config.go b/receiver/loadgenreceiver/config.go index b659b69d..3f5232c9 100644 --- a/receiver/loadgenreceiver/config.go +++ b/receiver/loadgenreceiver/config.go @@ -30,24 +30,28 @@ type Config struct { Metrics MetricsConfig `mapstructure:"metrics"` Logs LogsConfig `mapstructure:"logs"` Traces TracesConfig `mapstructure:"traces"` + doneCh chan struct{} } type MetricsConfig struct { // JsonlFile is an optional configuration option to specify the path to // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` + MaxReplay int `mapstructure:"max_replay"` } type LogsConfig struct { // JsonlFile is an optional configuration option to specify the path to // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` + MaxReplay int `mapstructure:"max_replay"` } type TracesConfig struct { // JsonlFile is an optional configuration option to specify the path to // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` + MaxReplay int `mapstructure:"max_replay"` } var _ component.Config = (*Config)(nil) diff --git a/receiver/loadgenreceiver/factory.go b/receiver/loadgenreceiver/factory.go index 172a04a8..ecd17217 100644 --- a/receiver/loadgenreceiver/factory.go +++ b/receiver/loadgenreceiver/factory.go @@ -18,20 +18,36 @@ package loadgenreceiver // import "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" import ( - "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal/metadata" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/receiver" + + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal/metadata" ) -// CreateDefaultConfig creates the default configuration for the Scraper. -func createDefaultReceiverConfig() component.Config { - return &Config{} +func NewFactory() receiver.Factory { + return receiver.NewFactory( + metadata.Type, + func() component.Config { + return createDefaultReceiverConfig(nil) + }, + receiver.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment), + receiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment), + receiver.WithLogs(createLogsReceiver, component.StabilityLevelDevelopment), + ) } -func NewFactory() receiver.Factory { +func createDefaultReceiverConfig(doneCh chan struct{}) component.Config { + return &Config{ + doneCh: doneCh, + } +} + +func NewFactoryWithDone(doneCh chan struct{}) receiver.Factory { return receiver.NewFactory( metadata.Type, - createDefaultReceiverConfig, + func() component.Config { + return createDefaultReceiverConfig(doneCh) + }, receiver.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment), receiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment), receiver.WithLogs(createLogsReceiver, component.StabilityLevelDevelopment), diff --git a/receiver/loadgenreceiver/internal/loopinglist.go b/receiver/loadgenreceiver/internal/loopinglist.go index b0aaf46a..9cc4e9f0 100644 --- a/receiver/loadgenreceiver/internal/loopinglist.go +++ b/receiver/loadgenreceiver/internal/loopinglist.go @@ -18,8 +18,9 @@ package internal // import "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" type LoopingList[T any] struct { - items []T - idx int + items []T + idx int + loopCnt int } func NewLoopingList[T any](items []T) LoopingList[T] { @@ -31,6 +32,13 @@ func NewLoopingList[T any](items []T) LoopingList[T] { func (s *LoopingList[T]) Next() T { defer func() { s.idx = (s.idx + 1) % len(s.items) + if s.idx == 0 { + s.loopCnt++ + } }() return s.items[s.idx] } + +func (s *LoopingList[T]) LoopCount() int { + return s.loopCnt +} diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index c50b52e2..ce3553ef 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -25,13 +25,14 @@ import ( "os" "time" - "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" + + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" ) //go:embed testdata/logs.jsonl @@ -95,10 +96,13 @@ func (ar *logsGenerator) Start(ctx context.Context, _ component.Host) error { case <-startCtx.Done(): return default: - if err := ar.consumer.ConsumeLogs(startCtx, ar.nextLogs()); err != nil { - ar.logger.Error(err.Error()) - continue - } + } + if err := ar.consumer.ConsumeLogs(startCtx, ar.nextLogs()); err != nil { + ar.logger.Error(err.Error()) + } + if ar.isDone() { + close(ar.cfg.doneCh) + return } } }() @@ -130,3 +134,7 @@ func (ar *logsGenerator) nextLogs() plog.Logs { return nextLogs } + +func (ar *logsGenerator) isDone() bool { + return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() > ar.cfg.Logs.MaxReplay +} diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index 954b4784..f05d774f 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -25,13 +25,14 @@ import ( "os" "time" - "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" + + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" ) //go:embed testdata/metrics.jsonl @@ -95,10 +96,13 @@ func (ar *metricsGenerator) Start(ctx context.Context, _ component.Host) error { case <-startCtx.Done(): return default: - if err := ar.consumer.ConsumeMetrics(startCtx, ar.nextMetrics()); err != nil { - ar.logger.Error(err.Error()) - continue - } + } + if err := ar.consumer.ConsumeMetrics(startCtx, ar.nextMetrics()); err != nil { + ar.logger.Error(err.Error()) + } + if ar.isDone() { + close(ar.cfg.doneCh) + return } } }() @@ -162,3 +166,7 @@ func (ar *metricsGenerator) nextMetrics() pmetric.Metrics { return nextMetrics } + +func (ar *metricsGenerator) isDone() bool { + return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() > ar.cfg.Metrics.MaxReplay +} diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index ee8793a5..292eb40c 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -25,13 +25,14 @@ import ( "os" "time" - "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" "go.opentelemetry.io/collector/receiver" "go.uber.org/zap" + + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" ) //go:embed testdata/traces.jsonl @@ -95,10 +96,13 @@ func (ar *tracesGenerator) Start(ctx context.Context, _ component.Host) error { case <-startCtx.Done(): return default: - if err := ar.consumer.ConsumeTraces(startCtx, ar.nextTraces()); err != nil { - ar.logger.Error(err.Error()) - continue - } + } + if err := ar.consumer.ConsumeTraces(startCtx, ar.nextTraces()); err != nil { + ar.logger.Error(err.Error()) + } + if ar.isDone() { + close(ar.cfg.doneCh) + return } } }() @@ -132,3 +136,7 @@ func (ar *tracesGenerator) nextTraces() ptrace.Traces { return nextLogs } + +func (ar *tracesGenerator) isDone() bool { + return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() > ar.cfg.Traces.MaxReplay +} From 8a94d05442d322982ed16d93e68603c901ffe816 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 14:01:48 +0000 Subject: [PATCH 10/51] Do not use internal telemetry, pass channel directly to loadgenreceiver --- loadgen/cmd/otelbench/collector.go | 6 ++++-- loadgen/cmd/otelbench/components.go | 2 +- loadgen/cmd/otelbench/main.go | 22 +++++++++------------- receiver/loadgenreceiver/config.go | 2 +- receiver/loadgenreceiver/factory.go | 4 ++-- receiver/loadgenreceiver/logs.go | 20 +++++++++++++++----- receiver/loadgenreceiver/metrics.go | 20 +++++++++++++++----- receiver/loadgenreceiver/stats.go | 8 ++++++++ receiver/loadgenreceiver/traces.go | 20 +++++++++++++++----- 9 files changed, 70 insertions(+), 34 deletions(-) create mode 100644 receiver/loadgenreceiver/stats.go diff --git a/loadgen/cmd/otelbench/collector.go b/loadgen/cmd/otelbench/collector.go index 4da507e8..b459bd1b 100644 --- a/loadgen/cmd/otelbench/collector.go +++ b/loadgen/cmd/otelbench/collector.go @@ -29,6 +29,8 @@ import ( "go.opentelemetry.io/collector/confmap/provider/httpsprovider" "go.opentelemetry.io/collector/confmap/provider/yamlprovider" "go.opentelemetry.io/collector/otelcol" + + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) const ( @@ -36,7 +38,7 @@ const ( buildVersion = "0.0.1" ) -func RunCollector(ctx context.Context, stop chan bool, configFiles []string, doneCh chan struct{}) error { +func RunCollector(ctx context.Context, stop chan bool, configFiles []string, doneCh chan loadgenreceiver.TelemetryStats) error { settings, err := NewCollectorSettings(configFiles, doneCh) if err != nil { return err @@ -58,7 +60,7 @@ func RunCollector(ctx context.Context, stop chan bool, configFiles []string, don return svc.Run(cancelCtx) } -func NewCollectorSettings(configPaths []string, doneCh chan struct{}) (otelcol.CollectorSettings, error) { +func NewCollectorSettings(configPaths []string, doneCh chan loadgenreceiver.TelemetryStats) (otelcol.CollectorSettings, error) { buildInfo := component.BuildInfo{ Command: os.Args[0], Description: buildDescription, diff --git a/loadgen/cmd/otelbench/components.go b/loadgen/cmd/otelbench/components.go index bc74f65a..261fb661 100644 --- a/loadgen/cmd/otelbench/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -33,7 +33,7 @@ import ( "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) -func components(doneCh chan struct{}) (otelcol.Factories, error) { +func components(doneCh chan loadgenreceiver.TelemetryStats) (otelcol.Factories, error) { var err error factories := otelcol.Factories{} diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 7d32050c..173da909 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -22,6 +22,8 @@ import ( "flag" "fmt" "testing" + + "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) func main() { @@ -42,28 +44,22 @@ func main() { for _, signal := range signals { result := testing.Benchmark(func(b *testing.B) { - done := make(chan struct{}) // loadgenreceiver will close the channel after generating b.N + done := make(chan loadgenreceiver.TelemetryStats) // loadgenreceiver will send stats on generated telemetry stop := make(chan bool) go func() { for { select { case <-stop: - case <-done: - // TODO: calculate rate without using internal telemetry - // as it is broken on otlphttp - logs, metricPoints, spans, err := GetTelemetrySent() - if err != nil { - b.Logf("error getting internal telemetry: %s", err) - continue - } - total := logs + metricPoints + spans + case stats := <-done: b.StopTimer() close(stop) - b.ReportMetric(float64(logs)/b.Elapsed().Seconds(), "logs/s") - b.ReportMetric(float64(metricPoints)/b.Elapsed().Seconds(), "metric_points/s") - b.ReportMetric(float64(spans)/b.Elapsed().Seconds(), "spans/s") + total := stats.LogRecords + stats.MetricDataPoints + stats.Spans + b.ReportMetric(float64(stats.LogRecords)/b.Elapsed().Seconds(), "logs/s") + b.ReportMetric(float64(stats.MetricDataPoints)/b.Elapsed().Seconds(), "metric_points/s") + b.ReportMetric(float64(stats.Spans)/b.Elapsed().Seconds(), "spans/s") b.ReportMetric(float64(total)/b.Elapsed().Seconds(), "total/s") + b.ReportMetric(float64(stats.Requests)/b.Elapsed().Seconds(), "requests/s") return } } diff --git a/receiver/loadgenreceiver/config.go b/receiver/loadgenreceiver/config.go index 3f5232c9..7c775195 100644 --- a/receiver/loadgenreceiver/config.go +++ b/receiver/loadgenreceiver/config.go @@ -30,7 +30,7 @@ type Config struct { Metrics MetricsConfig `mapstructure:"metrics"` Logs LogsConfig `mapstructure:"logs"` Traces TracesConfig `mapstructure:"traces"` - doneCh chan struct{} + doneCh chan TelemetryStats } type MetricsConfig struct { diff --git a/receiver/loadgenreceiver/factory.go b/receiver/loadgenreceiver/factory.go index ecd17217..7d008569 100644 --- a/receiver/loadgenreceiver/factory.go +++ b/receiver/loadgenreceiver/factory.go @@ -36,13 +36,13 @@ func NewFactory() receiver.Factory { ) } -func createDefaultReceiverConfig(doneCh chan struct{}) component.Config { +func createDefaultReceiverConfig(doneCh chan TelemetryStats) component.Config { return &Config{ doneCh: doneCh, } } -func NewFactoryWithDone(doneCh chan struct{}) receiver.Factory { +func NewFactoryWithDone(doneCh chan TelemetryStats) receiver.Factory { return receiver.NewFactory( metadata.Type, func() component.Config { diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index ce3553ef..44d23c95 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -42,7 +42,9 @@ type logsGenerator struct { cfg *Config logger *zap.Logger - samples internal.LoopingList[plog.Logs] + samples internal.LoopingList[plog.Logs] + sampleStats TelemetryStats + consumer consumer.Logs cancelFn context.CancelFunc @@ -67,6 +69,7 @@ func createLogsReceiver( } } + var sampleStats TelemetryStats var samples []plog.Logs scanner := bufio.NewScanner(bytes.NewReader(sampleLogs)) for scanner.Scan() { @@ -76,13 +79,16 @@ func createLogsReceiver( return nil, err } samples = append(samples, lineLogs) + sampleStats.Requests++ + sampleStats.LogRecords += lineLogs.LogRecordCount() } return &logsGenerator{ - cfg: genConfig, - logger: set.Logger, - consumer: consumer, - samples: internal.NewLoopingList(samples), + cfg: genConfig, + logger: set.Logger, + consumer: consumer, + samples: internal.NewLoopingList(samples), + sampleStats: sampleStats, }, nil } @@ -101,6 +107,10 @@ func (ar *logsGenerator) Start(ctx context.Context, _ component.Host) error { ar.logger.Error(err.Error()) } if ar.isDone() { + ar.cfg.doneCh <- TelemetryStats{ + Requests: ar.sampleStats.Requests * ar.cfg.Logs.MaxReplay, + LogRecords: ar.sampleStats.LogRecords * ar.cfg.Logs.MaxReplay, + } close(ar.cfg.doneCh) return } diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index f05d774f..d2c73ae4 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -42,7 +42,9 @@ type metricsGenerator struct { cfg *Config logger *zap.Logger - samples internal.LoopingList[pmetric.Metrics] + samples internal.LoopingList[pmetric.Metrics] + sampleStats TelemetryStats + consumer consumer.Metrics cancelFn context.CancelFunc @@ -67,6 +69,7 @@ func createMetricsReceiver( } } + var sampleStats TelemetryStats var samples []pmetric.Metrics scanner := bufio.NewScanner(bytes.NewReader(sampleMetrics)) for scanner.Scan() { @@ -76,13 +79,16 @@ func createMetricsReceiver( return nil, err } samples = append(samples, lineMetrics) + sampleStats.Requests++ + sampleStats.MetricDataPoints += lineMetrics.DataPointCount() } return &metricsGenerator{ - cfg: genConfig, - logger: set.Logger, - consumer: consumer, - samples: internal.NewLoopingList(samples), + cfg: genConfig, + logger: set.Logger, + consumer: consumer, + samples: internal.NewLoopingList(samples), + sampleStats: sampleStats, }, nil } @@ -101,6 +107,10 @@ func (ar *metricsGenerator) Start(ctx context.Context, _ component.Host) error { ar.logger.Error(err.Error()) } if ar.isDone() { + ar.cfg.doneCh <- TelemetryStats{ + Requests: ar.sampleStats.Requests * ar.cfg.Metrics.MaxReplay, + MetricDataPoints: ar.sampleStats.MetricDataPoints * ar.cfg.Metrics.MaxReplay, + } close(ar.cfg.doneCh) return } diff --git a/receiver/loadgenreceiver/stats.go b/receiver/loadgenreceiver/stats.go new file mode 100644 index 00000000..43d8373a --- /dev/null +++ b/receiver/loadgenreceiver/stats.go @@ -0,0 +1,8 @@ +package loadgenreceiver + +type TelemetryStats struct { + Requests int + LogRecords int + MetricDataPoints int + Spans int +} diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index 292eb40c..ff595fce 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -42,7 +42,9 @@ type tracesGenerator struct { cfg *Config logger *zap.Logger - samples internal.LoopingList[ptrace.Traces] + samples internal.LoopingList[ptrace.Traces] + sampleStats TelemetryStats + consumer consumer.Traces cancelFn context.CancelFunc @@ -67,6 +69,7 @@ func createTracesReceiver( } } + var sampleStats TelemetryStats var samples []ptrace.Traces scanner := bufio.NewScanner(bytes.NewReader(sampleTraces)) for scanner.Scan() { @@ -76,13 +79,16 @@ func createTracesReceiver( return nil, err } samples = append(samples, lineTraces) + sampleStats.Requests++ + sampleStats.Spans += lineTraces.SpanCount() } return &tracesGenerator{ - cfg: genConfig, - logger: set.Logger, - consumer: consumer, - samples: internal.NewLoopingList(samples), + cfg: genConfig, + logger: set.Logger, + consumer: consumer, + samples: internal.NewLoopingList(samples), + sampleStats: sampleStats, }, nil } @@ -101,6 +107,10 @@ func (ar *tracesGenerator) Start(ctx context.Context, _ component.Host) error { ar.logger.Error(err.Error()) } if ar.isDone() { + ar.cfg.doneCh <- TelemetryStats{ + Requests: ar.sampleStats.Requests * ar.cfg.Traces.MaxReplay, + Spans: ar.sampleStats.Spans * ar.cfg.Traces.MaxReplay, + } close(ar.cfg.doneCh) return } From 275724fd13eb4d2ee60823615f8977d5eb82e85d Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 14:03:27 +0000 Subject: [PATCH 11/51] Delete prom scraper --- loadgen/cmd/otelbench/go.mod | 6 +-- loadgen/cmd/otelbench/go.sum | 8 ---- loadgen/cmd/otelbench/prom_scraper.go | 66 --------------------------- 3 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 loadgen/cmd/otelbench/prom_scraper.go diff --git a/loadgen/cmd/otelbench/go.mod b/loadgen/cmd/otelbench/go.mod index 34933852..508845cd 100644 --- a/loadgen/cmd/otelbench/go.mod +++ b/loadgen/cmd/otelbench/go.mod @@ -6,8 +6,6 @@ require ( github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor v0.0.0-00010101000000-000000000000 github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver v0.0.0-00010101000000-000000000000 github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor v0.117.0 - github.com/prometheus/client_model v0.6.1 - github.com/prometheus/prom2json v1.4.1 go.opentelemetry.io/collector/component v0.117.0 go.opentelemetry.io/collector/confmap v1.23.0 go.opentelemetry.io/collector/confmap/provider/envprovider v1.23.0 @@ -47,7 +45,6 @@ require ( github.com/goccy/go-json v0.10.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect @@ -63,7 +60,6 @@ require ( github.com/knadh/koanf/v2 v2.1.2 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magefile/mage v1.15.0 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -79,9 +75,9 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/client_golang v1.20.5 // indirect + github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.61.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/prometheus/prometheus v0.54.1 // indirect github.com/rs/cors v1.11.1 // indirect github.com/shirou/gopsutil/v4 v4.24.12 // indirect github.com/spf13/cobra v1.8.1 // indirect diff --git a/loadgen/cmd/otelbench/go.sum b/loadgen/cmd/otelbench/go.sum index 7aff1007..f4394d33 100644 --- a/loadgen/cmd/otelbench/go.sum +++ b/loadgen/cmd/otelbench/go.sum @@ -46,7 +46,6 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -94,8 +93,6 @@ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= @@ -140,10 +137,6 @@ github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFS github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/prometheus/prom2json v1.4.1 h1:7McxdrHgPEOtMwWjkKtd0v5AhpR2Q6QAnlHKVxq0+tQ= -github.com/prometheus/prom2json v1.4.1/go.mod h1:CzOQykSKFxXuC7ELUZHOHQvwKesQ3eN0p2PWLhFitQM= -github.com/prometheus/prometheus v0.54.1 h1:vKuwQNjnYN2/mDoWfHXDhAsz/68q/dQDb+YbcEqU7MQ= -github.com/prometheus/prometheus v0.54.1/go.mod h1:xlLByHhk2g3ycakQGrMaU8K7OySZx98BzeCR99991NY= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= @@ -371,7 +364,6 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/loadgen/cmd/otelbench/prom_scraper.go b/loadgen/cmd/otelbench/prom_scraper.go deleted file mode 100644 index 5b3eacb0..00000000 --- a/loadgen/cmd/otelbench/prom_scraper.go +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package main - -import ( - dto "github.com/prometheus/client_model/go" - "github.com/prometheus/prom2json" -) - -func GetTelemetrySent() (logs, metricPoints, spans int64, err error) { - done := make(chan struct{}) - mfChan := make(chan *dto.MetricFamily, 1024) - go func() { - for { - select { - case mf := <-mfChan: - if mf == nil { - close(done) - return - } - for _, m := range mf.GetMetric() { - var isOtlp bool - for _, l := range m.GetLabel() { - if l.GetName() == "exporter" && l.GetValue() == "otlp" { - isOtlp = true - } - } - if isOtlp { - v := int64(m.GetCounter().GetValue()) - switch mf.GetName() { - case "otelcol_exporter_sent_log_records": - logs = v - case "otelcol_exporter_sent_metric_points": - metricPoints = v - case "otelcol_exporter_sent_spans": - spans = v - } - } - } - - } - } - - }() - err = prom2json.FetchMetricFamilies("http://127.0.0.1:8888/metrics", mfChan, nil) - if err != nil { - return - } - <-done - return -} From 769876bb9c6f9258f27fd221700f0565576ff8f6 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 14:15:43 +0000 Subject: [PATCH 12/51] Clean up --- loadgen/cmd/otelbench/collector.go | 2 +- loadgen/cmd/otelbench/config.yaml | 10 --------- loadgen/cmd/otelbench/main.go | 33 +++++++++++++++--------------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/loadgen/cmd/otelbench/collector.go b/loadgen/cmd/otelbench/collector.go index b459bd1b..41addfeb 100644 --- a/loadgen/cmd/otelbench/collector.go +++ b/loadgen/cmd/otelbench/collector.go @@ -38,7 +38,7 @@ const ( buildVersion = "0.0.1" ) -func RunCollector(ctx context.Context, stop chan bool, configFiles []string, doneCh chan loadgenreceiver.TelemetryStats) error { +func RunCollector(ctx context.Context, stop chan struct{}, configFiles []string, doneCh chan loadgenreceiver.TelemetryStats) error { settings, err := NewCollectorSettings(configFiles, doneCh) if err != nil { return err diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml index 7e40530a..0937558c 100644 --- a/loadgen/cmd/otelbench/config.yaml +++ b/loadgen/cmd/otelbench/config.yaml @@ -21,13 +21,3 @@ processors: # The worst way to generate a random ID, but is the simplest in OTTL # Only randomize trace ID such that span relationships are still maintained - set(trace_id.string, Substring(MD5(UUID()), 0, 32)) - -service: - telemetry: - metrics: - readers: - - pull: - exporter: - prometheus: - host: '127.0.0.1' - port: 8888 diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 173da909..03fd41ce 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -44,25 +44,24 @@ func main() { for _, signal := range signals { result := testing.Benchmark(func(b *testing.B) { - done := make(chan loadgenreceiver.TelemetryStats) // loadgenreceiver will send stats on generated telemetry - stop := make(chan bool) + // loadgenreceiver will send stats about generated telemetry when it finishes sending b.N iterations + done := make(chan loadgenreceiver.TelemetryStats) + + stop := make(chan struct{}) // close channel to stop the loadgen collector go func() { - for { - select { - case <-stop: - case stats := <-done: - b.StopTimer() - close(stop) - total := stats.LogRecords + stats.MetricDataPoints + stats.Spans - b.ReportMetric(float64(stats.LogRecords)/b.Elapsed().Seconds(), "logs/s") - b.ReportMetric(float64(stats.MetricDataPoints)/b.Elapsed().Seconds(), "metric_points/s") - b.ReportMetric(float64(stats.Spans)/b.Elapsed().Seconds(), "spans/s") - b.ReportMetric(float64(total)/b.Elapsed().Seconds(), "total/s") - b.ReportMetric(float64(stats.Requests)/b.Elapsed().Seconds(), "requests/s") - return - } - } + stats := <-done + b.StopTimer() + + elapsedSeconds := b.Elapsed().Seconds() + total := stats.LogRecords + stats.MetricDataPoints + stats.Spans + b.ReportMetric(float64(stats.LogRecords)/elapsedSeconds, "logs/s") + b.ReportMetric(float64(stats.MetricDataPoints)/elapsedSeconds, "metric_points/s") + b.ReportMetric(float64(stats.Spans)/elapsedSeconds, "spans/s") + b.ReportMetric(float64(total)/elapsedSeconds, "total/s") + b.ReportMetric(float64(stats.Requests)/elapsedSeconds, "requests/s") + + close(stop) }() var configFiles []string From 5ee5590ade354ae0ac7325bf098bb00fb394460b Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 14:33:00 +0000 Subject: [PATCH 13/51] Make doneCh per signal --- loadgen/cmd/otelbench/collector.go | 8 ++++---- loadgen/cmd/otelbench/components.go | 4 ++-- loadgen/cmd/otelbench/main.go | 24 +++++++++++++++++++++--- receiver/loadgenreceiver/config.go | 4 +++- receiver/loadgenreceiver/factory.go | 18 +++++++++++++----- receiver/loadgenreceiver/logs.go | 4 ++-- receiver/loadgenreceiver/metrics.go | 4 ++-- receiver/loadgenreceiver/stats.go | 8 ++++++++ receiver/loadgenreceiver/traces.go | 4 ++-- 9 files changed, 57 insertions(+), 21 deletions(-) diff --git a/loadgen/cmd/otelbench/collector.go b/loadgen/cmd/otelbench/collector.go index 41addfeb..36c30a06 100644 --- a/loadgen/cmd/otelbench/collector.go +++ b/loadgen/cmd/otelbench/collector.go @@ -38,8 +38,8 @@ const ( buildVersion = "0.0.1" ) -func RunCollector(ctx context.Context, stop chan struct{}, configFiles []string, doneCh chan loadgenreceiver.TelemetryStats) error { - settings, err := NewCollectorSettings(configFiles, doneCh) +func RunCollector(ctx context.Context, stop chan struct{}, configFiles []string, logsDone, metricsDone, tracesDone chan loadgenreceiver.TelemetryStats) error { + settings, err := NewCollectorSettings(configFiles, logsDone, metricsDone, tracesDone) if err != nil { return err } @@ -60,7 +60,7 @@ func RunCollector(ctx context.Context, stop chan struct{}, configFiles []string, return svc.Run(cancelCtx) } -func NewCollectorSettings(configPaths []string, doneCh chan loadgenreceiver.TelemetryStats) (otelcol.CollectorSettings, error) { +func NewCollectorSettings(configPaths []string, logsDone, metricsDone, tracesDone chan loadgenreceiver.TelemetryStats) (otelcol.CollectorSettings, error) { buildInfo := component.BuildInfo{ Command: os.Args[0], Description: buildDescription, @@ -81,7 +81,7 @@ func NewCollectorSettings(configPaths []string, doneCh chan loadgenreceiver.Tele } return otelcol.CollectorSettings{ - Factories: func() (otelcol.Factories, error) { return components(doneCh) }, + Factories: func() (otelcol.Factories, error) { return components(logsDone, metricsDone, tracesDone) }, BuildInfo: buildInfo, ConfigProviderSettings: configProviderSettings, // we're handling DisableGracefulShutdown via the cancelCtx being passed diff --git a/loadgen/cmd/otelbench/components.go b/loadgen/cmd/otelbench/components.go index 261fb661..f2727958 100644 --- a/loadgen/cmd/otelbench/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -33,13 +33,13 @@ import ( "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) -func components(doneCh chan loadgenreceiver.TelemetryStats) (otelcol.Factories, error) { +func components(logsDone, metricsDone, tracesDone chan loadgenreceiver.TelemetryStats) (otelcol.Factories, error) { var err error factories := otelcol.Factories{} // Receivers factories.Receivers, err = receiver.MakeFactoryMap( - loadgenreceiver.NewFactoryWithDone(doneCh), + loadgenreceiver.NewFactoryWithDone(logsDone, metricsDone, tracesDone), ) if err != nil { return otelcol.Factories{}, err diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 03fd41ce..1e8fa46a 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -45,14 +45,32 @@ func main() { for _, signal := range signals { result := testing.Benchmark(func(b *testing.B) { // loadgenreceiver will send stats about generated telemetry when it finishes sending b.N iterations - done := make(chan loadgenreceiver.TelemetryStats) + logsDone := make(chan loadgenreceiver.TelemetryStats) + metricsDone := make(chan loadgenreceiver.TelemetryStats) + tracesDone := make(chan loadgenreceiver.TelemetryStats) + + switch signal { + case "logs": + close(metricsDone) + close(tracesDone) + case "metrics": + close(logsDone) + close(tracesDone) + case "traces": + close(logsDone) + close(metricsDone) + } stop := make(chan struct{}) // close channel to stop the loadgen collector go func() { - stats := <-done + logsStats := <-logsDone + metricsStats := <-metricsDone + tracesStats := <-tracesDone b.StopTimer() + stats := logsStats.Add(metricsStats).Add(tracesStats) + elapsedSeconds := b.Elapsed().Seconds() total := stats.LogRecords + stats.MetricDataPoints + stats.Spans b.ReportMetric(float64(stats.LogRecords)/elapsedSeconds, "logs/s") @@ -67,7 +85,7 @@ func main() { var configFiles []string configFiles = append(configFiles, Config.CollectorConfigPath) configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter, signal, b.N)...) - err := RunCollector(context.Background(), stop, configFiles, done) + err := RunCollector(context.Background(), stop, configFiles, logsDone, metricsDone, tracesDone) if err != nil { fmt.Println(err) b.Log(err) diff --git a/receiver/loadgenreceiver/config.go b/receiver/loadgenreceiver/config.go index 7c775195..3cf98bc3 100644 --- a/receiver/loadgenreceiver/config.go +++ b/receiver/loadgenreceiver/config.go @@ -30,7 +30,6 @@ type Config struct { Metrics MetricsConfig `mapstructure:"metrics"` Logs LogsConfig `mapstructure:"logs"` Traces TracesConfig `mapstructure:"traces"` - doneCh chan TelemetryStats } type MetricsConfig struct { @@ -38,6 +37,7 @@ type MetricsConfig struct { // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` MaxReplay int `mapstructure:"max_replay"` + doneCh chan TelemetryStats } type LogsConfig struct { @@ -45,6 +45,7 @@ type LogsConfig struct { // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` MaxReplay int `mapstructure:"max_replay"` + doneCh chan TelemetryStats } type TracesConfig struct { @@ -52,6 +53,7 @@ type TracesConfig struct { // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` MaxReplay int `mapstructure:"max_replay"` + doneCh chan TelemetryStats } var _ component.Config = (*Config)(nil) diff --git a/receiver/loadgenreceiver/factory.go b/receiver/loadgenreceiver/factory.go index 7d008569..388f2cb7 100644 --- a/receiver/loadgenreceiver/factory.go +++ b/receiver/loadgenreceiver/factory.go @@ -28,7 +28,7 @@ func NewFactory() receiver.Factory { return receiver.NewFactory( metadata.Type, func() component.Config { - return createDefaultReceiverConfig(nil) + return createDefaultReceiverConfig(nil, nil, nil) }, receiver.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment), receiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment), @@ -36,17 +36,25 @@ func NewFactory() receiver.Factory { ) } -func createDefaultReceiverConfig(doneCh chan TelemetryStats) component.Config { +func createDefaultReceiverConfig(logsDone, metricsDone, tracesDone chan TelemetryStats) component.Config { return &Config{ - doneCh: doneCh, + Logs: LogsConfig{ + doneCh: logsDone, + }, + Metrics: MetricsConfig{ + doneCh: metricsDone, + }, + Traces: TracesConfig{ + doneCh: tracesDone, + }, } } -func NewFactoryWithDone(doneCh chan TelemetryStats) receiver.Factory { +func NewFactoryWithDone(logsDone, metricsDone, tracesDone chan TelemetryStats) receiver.Factory { return receiver.NewFactory( metadata.Type, func() component.Config { - return createDefaultReceiverConfig(doneCh) + return createDefaultReceiverConfig(logsDone, metricsDone, tracesDone) }, receiver.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment), receiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment), diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index 44d23c95..282d7f00 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -107,11 +107,11 @@ func (ar *logsGenerator) Start(ctx context.Context, _ component.Host) error { ar.logger.Error(err.Error()) } if ar.isDone() { - ar.cfg.doneCh <- TelemetryStats{ + ar.cfg.Logs.doneCh <- TelemetryStats{ Requests: ar.sampleStats.Requests * ar.cfg.Logs.MaxReplay, LogRecords: ar.sampleStats.LogRecords * ar.cfg.Logs.MaxReplay, } - close(ar.cfg.doneCh) + close(ar.cfg.Logs.doneCh) return } } diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index d2c73ae4..6fd609a0 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -107,11 +107,11 @@ func (ar *metricsGenerator) Start(ctx context.Context, _ component.Host) error { ar.logger.Error(err.Error()) } if ar.isDone() { - ar.cfg.doneCh <- TelemetryStats{ + ar.cfg.Metrics.doneCh <- TelemetryStats{ Requests: ar.sampleStats.Requests * ar.cfg.Metrics.MaxReplay, MetricDataPoints: ar.sampleStats.MetricDataPoints * ar.cfg.Metrics.MaxReplay, } - close(ar.cfg.doneCh) + close(ar.cfg.Metrics.doneCh) return } } diff --git a/receiver/loadgenreceiver/stats.go b/receiver/loadgenreceiver/stats.go index 43d8373a..0c81d729 100644 --- a/receiver/loadgenreceiver/stats.go +++ b/receiver/loadgenreceiver/stats.go @@ -6,3 +6,11 @@ type TelemetryStats struct { MetricDataPoints int Spans int } + +func (s TelemetryStats) Add(other TelemetryStats) TelemetryStats { + s.Requests += other.Requests + s.LogRecords += other.LogRecords + s.MetricDataPoints += other.MetricDataPoints + s.Spans += other.Spans + return s +} diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index ff595fce..fd582a58 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -107,11 +107,11 @@ func (ar *tracesGenerator) Start(ctx context.Context, _ component.Host) error { ar.logger.Error(err.Error()) } if ar.isDone() { - ar.cfg.doneCh <- TelemetryStats{ + ar.cfg.Traces.doneCh <- TelemetryStats{ Requests: ar.sampleStats.Requests * ar.cfg.Traces.MaxReplay, Spans: ar.sampleStats.Spans * ar.cfg.Traces.MaxReplay, } - close(ar.cfg.doneCh) + close(ar.cfg.Traces.doneCh) return } } From 006d08e2bc17f806ae0f4c6302348242f99ca30f Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 15:47:54 +0000 Subject: [PATCH 14/51] Maintain a single config yaml and disable accordingly --- loadgen/cmd/otelbench/components.go | 4 ++++ loadgen/cmd/otelbench/config.yaml | 17 +++++++++++++++++ loadgen/cmd/otelbench/go.mod | 2 ++ loadgen/cmd/otelbench/go.sum | 4 ++++ loadgen/cmd/otelbench/main.go | 22 +++++++++++++--------- loadgen/cmd/otelbench/runner.go | 19 ++++++++++++++----- 6 files changed, 54 insertions(+), 14 deletions(-) diff --git a/loadgen/cmd/otelbench/components.go b/loadgen/cmd/otelbench/components.go index f2727958..d391ddf3 100644 --- a/loadgen/cmd/otelbench/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -22,12 +22,14 @@ import ( "go.opentelemetry.io/collector/connector" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/debugexporter" + "go.opentelemetry.io/collector/exporter/nopexporter" "go.opentelemetry.io/collector/exporter/otlpexporter" "go.opentelemetry.io/collector/exporter/otlphttpexporter" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/otelcol" "go.opentelemetry.io/collector/processor" "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/nopreceiver" "github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor" "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" @@ -40,6 +42,7 @@ func components(logsDone, metricsDone, tracesDone chan loadgenreceiver.Telemetry // Receivers factories.Receivers, err = receiver.MakeFactoryMap( loadgenreceiver.NewFactoryWithDone(logsDone, metricsDone, tracesDone), + nopreceiver.NewFactory(), ) if err != nil { return otelcol.Factories{}, err @@ -59,6 +62,7 @@ func components(logsDone, metricsDone, tracesDone chan loadgenreceiver.Telemetry otlpexporter.NewFactory(), otlphttpexporter.NewFactory(), debugexporter.NewFactory(), + nopexporter.NewFactory(), ) if err != nil { return otelcol.Factories{}, err diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml index 0937558c..0cdd572a 100644 --- a/loadgen/cmd/otelbench/config.yaml +++ b/loadgen/cmd/otelbench/config.yaml @@ -1,5 +1,6 @@ receivers: loadgen: + nop: exporters: otlp: @@ -12,6 +13,7 @@ exporters: sending_queue: enabled: false timeout: 60s + nop: processors: transform/rewrite: # Rewrite telemetry to increase cardinality @@ -21,3 +23,18 @@ processors: # The worst way to generate a random ID, but is the simplest in OTTL # Only randomize trace ID such that span relationships are still maintained - set(trace_id.string, Substring(MD5(UUID()), 0, 32)) + +service: + pipelines: + logs: + receivers: [loadgen] + processors: [transform/rewrite] + exporters: [otlp] # this will be set dynamically to otlp or otlphttp depending on config + metrics: + receivers: [loadgen] + processors: [transform/rewrite] + exporters: [otlp] # this will be set dynamically to otlp or otlphttp depending on config + traces: + receivers: [loadgen] + processors: [transform/rewrite] + exporters: [otlp] # this will be set dynamically to otlp or otlphttp depending on config diff --git a/loadgen/cmd/otelbench/go.mod b/loadgen/cmd/otelbench/go.mod index 508845cd..4cff0e9f 100644 --- a/loadgen/cmd/otelbench/go.mod +++ b/loadgen/cmd/otelbench/go.mod @@ -16,12 +16,14 @@ require ( go.opentelemetry.io/collector/connector v0.117.0 go.opentelemetry.io/collector/exporter v0.117.0 go.opentelemetry.io/collector/exporter/debugexporter v0.117.0 + go.opentelemetry.io/collector/exporter/nopexporter v0.117.0 go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0 go.opentelemetry.io/collector/exporter/otlphttpexporter v0.117.0 go.opentelemetry.io/collector/extension v0.117.0 go.opentelemetry.io/collector/otelcol v0.117.0 go.opentelemetry.io/collector/processor v0.117.0 go.opentelemetry.io/collector/receiver v0.117.0 + go.opentelemetry.io/collector/receiver/nopreceiver v0.117.0 ) require ( diff --git a/loadgen/cmd/otelbench/go.sum b/loadgen/cmd/otelbench/go.sum index f4394d33..a129a49b 100644 --- a/loadgen/cmd/otelbench/go.sum +++ b/loadgen/cmd/otelbench/go.sum @@ -227,6 +227,8 @@ go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0 h go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0/go.mod h1:TkPEGX28zDvGAqlJRZQhKohG+82iN2lWPjF+dTuzS9Q= go.opentelemetry.io/collector/exporter/exportertest v0.117.0 h1:u+loeqxpniMiJL1iqc/lCCcfniWrqHBgJTAjXfqVBqQ= go.opentelemetry.io/collector/exporter/exportertest v0.117.0/go.mod h1:GyHwJLsOPPau0m+TYrIA7jWD9/GU+ID+l/9sL0cAqhE= +go.opentelemetry.io/collector/exporter/nopexporter v0.117.0 h1:y+QWWzEtGCR5mV+LhNVICVjWFis1N+okoDP51D2g8nw= +go.opentelemetry.io/collector/exporter/nopexporter v0.117.0/go.mod h1:6BFmKj25MIs6rdyGAP0USk/ZXjLHBTOMn7mNacLE8dQ= go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0 h1:A/qDjii7WN2Wdx+gtdLvSVpPu8to6ogVutxIggNBEio= go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0/go.mod h1:rW4Re7GGCPB4JwZoZjXaPqJ77GEIr8OjTz5YK59avJM= go.opentelemetry.io/collector/exporter/otlphttpexporter v0.117.0 h1:sEpFjth0x9/gZ6JJfNce1T8RJuNzUWKnDU0TKcejKl0= @@ -271,6 +273,8 @@ go.opentelemetry.io/collector/processor/xprocessor v0.117.0 h1:yGBjlY8HRb2AqYo1Q go.opentelemetry.io/collector/processor/xprocessor v0.117.0/go.mod h1:MnyEaS47cqol7Cph6LnYIp0g2Km4M+I1vWTwiDeuBN0= go.opentelemetry.io/collector/receiver v0.117.0 h1:jm+b2G2IKKwGE213lB9cviKEdeATvYtNSY1kO0XdpMM= go.opentelemetry.io/collector/receiver v0.117.0/go.mod h1:fZXigB3afp54OE+ogPcup/RPwI7j+CwZh9Mz6ObB/Cg= +go.opentelemetry.io/collector/receiver/nopreceiver v0.117.0 h1:j5cbMzH2TZI7N4hputwOHKF6efcpJ4L+Cabo5kjHJmk= +go.opentelemetry.io/collector/receiver/nopreceiver v0.117.0/go.mod h1:7r3PlDoL0ITvktjpO6OnEcubprSDzBoM40C4EWWRgZg= go.opentelemetry.io/collector/receiver/receivertest v0.117.0 h1:aN4zOuWsiARa+RG9f89JyIrJbx5wsQ71Y0giiHsO1z8= go.opentelemetry.io/collector/receiver/receivertest v0.117.0/go.mod h1:1wnGEowDmlO89feq1P+b4tQI2G/+iJxRrMallw7zeJE= go.opentelemetry.io/collector/receiver/xreceiver v0.117.0 h1:HJjBj6P3/WQoYaRKZkWZHnUUCVFpBieqGKzKHcT6HUw= diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 1e8fa46a..0283d3c4 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -26,6 +26,8 @@ import ( "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) +var allSignals = []string{"logs", "metrics", "traces"} + func main() { Init() testing.Init() @@ -48,18 +50,15 @@ func main() { logsDone := make(chan loadgenreceiver.TelemetryStats) metricsDone := make(chan loadgenreceiver.TelemetryStats) tracesDone := make(chan loadgenreceiver.TelemetryStats) - - switch signal { - case "logs": - close(metricsDone) - close(tracesDone) - case "metrics": - close(logsDone) - close(tracesDone) - case "traces": + if signal != "logs" { close(logsDone) + } + if signal != "metrics" { close(metricsDone) } + if signal != "traces" { + close(tracesDone) + } stop := make(chan struct{}) // close channel to stop the loadgen collector @@ -84,6 +83,11 @@ func main() { var configFiles []string configFiles = append(configFiles, Config.CollectorConfigPath) + for _, s := range allSignals { + if signal != s { + configFiles = append(configFiles, DisableSignal(s)...) + } + } configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter, signal, b.N)...) err := RunCollector(context.Background(), stop, configFiles, logsDone, metricsDone, tracesDone) if err != nil { diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index b0485547..fdf0ca30 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -99,10 +99,16 @@ func getEnvOrDefault(name, defaultValue string) string { // CollectorConfigFilesFromConfig returns a slice of strings, each can be passed to the collector using --config func CollectorConfigFilesFromConfig(exporter, signal string, iterations int) (configFiles []string) { sets := CollectorSetFromConfig(exporter, signal, iterations) + configFiles = setsToConfigs(sets) + return +} + +// setsToConfigs converts --set to --config +func setsToConfigs(sets []string) (configFiles []string) { for _, s := range sets { idx := strings.Index(s, "=") if idx == -1 { - panic("missing = in --set") // Should never happen as all the strings are hardcoded below. + panic("missing = in --set") // Should never happen as all the strings are hardcoded in this file } v := "yaml:" + strings.TrimSpace(strings.ReplaceAll(s[:idx], ".", "::")) + ": " + strings.TrimSpace(s[idx+1:]) configFiles = append(configFiles, v) @@ -112,10 +118,6 @@ func CollectorConfigFilesFromConfig(exporter, signal string, iterations int) (co // CollectorSetFromConfig returns a slice of strings, each can be passed to the collector using --set func CollectorSetFromConfig(exporter, signal string, iterations int) (configSets []string) { - configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.receivers=[loadgen]", signal)) - configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.processors=[transform/rewrite]", signal)) - configSets = append(configSets, fmt.Sprintf("service.pipelines.%s.exporters=[%s]", signal, exporter)) - configSets = append(configSets, fmt.Sprintf("receivers.loadgen.%s.max_replay=%d", signal, iterations)) configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) @@ -132,3 +134,10 @@ func CollectorSetFromConfig(exporter, signal string, iterations int) (configSets return } + +func DisableSignal(signal string) (configFiles []string) { + return setsToConfigs([]string{ + fmt.Sprintf("service.pipelines.%s.receivers=[nop]", signal), + fmt.Sprintf("service.pipelines.%s.exporters=[nop]", signal), + }) +} From 9b9681e5c3845570a2573b37e298bbaadd369507 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 15:58:42 +0000 Subject: [PATCH 15/51] Refactor --- loadgen/cmd/otelbench/main.go | 22 +++++++++++++--------- loadgen/cmd/otelbench/runner.go | 20 ++++++++++++++------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 0283d3c4..018ab37b 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -81,15 +81,7 @@ func main() { close(stop) }() - var configFiles []string - configFiles = append(configFiles, Config.CollectorConfigPath) - for _, s := range allSignals { - if signal != s { - configFiles = append(configFiles, DisableSignal(s)...) - } - } - configFiles = append(configFiles, CollectorConfigFilesFromConfig(Config.Exporter, signal, b.N)...) - err := RunCollector(context.Background(), stop, configFiles, logsDone, metricsDone, tracesDone) + err := RunCollector(context.Background(), stop, configs(Config.Exporter, signal, b.N), logsDone, metricsDone, tracesDone) if err != nil { fmt.Println(err) b.Log(err) @@ -99,3 +91,15 @@ func main() { fmt.Println(result.String()) } } + +func configs(exporter, signal string, iterations int) (configFiles []string) { + configFiles = append(configFiles, Config.CollectorConfigPath) + configFiles = append(configFiles, SetIterations(iterations)...) + for _, s := range allSignals { + if signal != s { + configFiles = append(configFiles, DisableSignal(s)...) + } + } + configFiles = append(configFiles, CollectorConfigFilesFromConfig(exporter)...) + return +} diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index fdf0ca30..8a4fd502 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -97,8 +97,8 @@ func getEnvOrDefault(name, defaultValue string) string { } // CollectorConfigFilesFromConfig returns a slice of strings, each can be passed to the collector using --config -func CollectorConfigFilesFromConfig(exporter, signal string, iterations int) (configFiles []string) { - sets := CollectorSetFromConfig(exporter, signal, iterations) +func CollectorConfigFilesFromConfig(exporter string) (configFiles []string) { + sets := CollectorSetFromConfig(exporter) configFiles = setsToConfigs(sets) return } @@ -117,10 +117,10 @@ func setsToConfigs(sets []string) (configFiles []string) { } // CollectorSetFromConfig returns a slice of strings, each can be passed to the collector using --set -func CollectorSetFromConfig(exporter, signal string, iterations int) (configSets []string) { - configSets = append(configSets, fmt.Sprintf("receivers.loadgen.%s.max_replay=%d", signal, iterations)) - - configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) +func CollectorSetFromConfig(exporter string) (configSets []string) { + if Config.ServerURL != nil { + configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) + } if v := getAuthorizationHeaderValue(Config.APIKey, Config.SecretToken); v != "" { configSets = append(configSets, fmt.Sprintf("exporters.%s.headers.Authorization=%s", exporter, v)) @@ -141,3 +141,11 @@ func DisableSignal(signal string) (configFiles []string) { fmt.Sprintf("service.pipelines.%s.exporters=[nop]", signal), }) } + +func SetIterations(iterations int) (configFiles []string) { + return setsToConfigs([]string{ + fmt.Sprintf("receivers.loadgen.logs.max_replay=%d", iterations), + fmt.Sprintf("receivers.loadgen.metrics.max_replay=%d", iterations), + fmt.Sprintf("receivers.loadgen.traces.max_replay=%d", iterations), + }) +} From 139c371d7953b36a1e9aa23d847975856b004694 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 16:26:25 +0000 Subject: [PATCH 16/51] Run otlp and otlphttp --- loadgen/cmd/otelbench/main.go | 113 ++++++++++++++++++-------------- loadgen/cmd/otelbench/runner.go | 24 +++---- 2 files changed, 76 insertions(+), 61 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 018ab37b..9e26357c 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -26,14 +26,8 @@ import ( "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) -var allSignals = []string{"logs", "metrics", "traces"} - -func main() { - Init() - testing.Init() - flag.Parse() - - var signals []string +// getSignal returns a slice of signal names to be benchmarked according to Config +func getSignals() (signals []string) { if Config.Logs { signals = append(signals, "logs") } @@ -43,63 +37,84 @@ func main() { if Config.Traces { signals = append(signals, "traces") } + return +} - for _, signal := range signals { - result := testing.Benchmark(func(b *testing.B) { - // loadgenreceiver will send stats about generated telemetry when it finishes sending b.N iterations - logsDone := make(chan loadgenreceiver.TelemetryStats) - metricsDone := make(chan loadgenreceiver.TelemetryStats) - tracesDone := make(chan loadgenreceiver.TelemetryStats) - if signal != "logs" { - close(logsDone) - } - if signal != "metrics" { - close(metricsDone) - } - if signal != "traces" { - close(tracesDone) - } +// getExporters returns a slice of exporter names to be benchmarked according to Config +func getExporters() (exporters []string) { + if Config.ExporterOTLP { + exporters = append(exporters, "otlp") + } + if Config.ExporterOTLPHTTP { + exporters = append(exporters, "otlphttp") + } + return +} - stop := make(chan struct{}) // close channel to stop the loadgen collector +func main() { + Init() + testing.Init() + flag.Parse() + + for _, signal := range getSignals() { + for _, exporter := range getExporters() { + result := testing.Benchmark(func(b *testing.B) { + // loadgenreceiver will send stats about generated telemetry when it finishes sending b.N iterations + logsDone := make(chan loadgenreceiver.TelemetryStats) + metricsDone := make(chan loadgenreceiver.TelemetryStats) + tracesDone := make(chan loadgenreceiver.TelemetryStats) + if signal != "logs" { + close(logsDone) + } + if signal != "metrics" { + close(metricsDone) + } + if signal != "traces" { + close(tracesDone) + } - go func() { - logsStats := <-logsDone - metricsStats := <-metricsDone - tracesStats := <-tracesDone - b.StopTimer() + stop := make(chan struct{}) // close channel to stop the loadgen collector - stats := logsStats.Add(metricsStats).Add(tracesStats) + go func() { + logsStats := <-logsDone + metricsStats := <-metricsDone + tracesStats := <-tracesDone + b.StopTimer() - elapsedSeconds := b.Elapsed().Seconds() - total := stats.LogRecords + stats.MetricDataPoints + stats.Spans - b.ReportMetric(float64(stats.LogRecords)/elapsedSeconds, "logs/s") - b.ReportMetric(float64(stats.MetricDataPoints)/elapsedSeconds, "metric_points/s") - b.ReportMetric(float64(stats.Spans)/elapsedSeconds, "spans/s") - b.ReportMetric(float64(total)/elapsedSeconds, "total/s") - b.ReportMetric(float64(stats.Requests)/elapsedSeconds, "requests/s") + stats := logsStats.Add(metricsStats).Add(tracesStats) - close(stop) - }() + elapsedSeconds := b.Elapsed().Seconds() + total := stats.LogRecords + stats.MetricDataPoints + stats.Spans + b.ReportMetric(float64(stats.LogRecords)/elapsedSeconds, "logs/s") + b.ReportMetric(float64(stats.MetricDataPoints)/elapsedSeconds, "metric_points/s") + b.ReportMetric(float64(stats.Spans)/elapsedSeconds, "spans/s") + b.ReportMetric(float64(total)/elapsedSeconds, "total/s") + b.ReportMetric(float64(stats.Requests)/elapsedSeconds, "requests/s") - err := RunCollector(context.Background(), stop, configs(Config.Exporter, signal, b.N), logsDone, metricsDone, tracesDone) - if err != nil { - fmt.Println(err) - b.Log(err) - } - }) - fmt.Print(signal) - fmt.Println(result.String()) + close(stop) + }() + + err := RunCollector(context.Background(), stop, configs(exporter, signal, b.N), logsDone, metricsDone, tracesDone) + if err != nil { + fmt.Println(err) + b.Log(err) + } + }) + fmt.Print(fmt.Sprintf("%s-%s", signal, exporter)) + fmt.Print("\t") + fmt.Println(result.String()) + } } } func configs(exporter, signal string, iterations int) (configFiles []string) { configFiles = append(configFiles, Config.CollectorConfigPath) + configFiles = append(configFiles, ExporterConfigs(exporter)...) configFiles = append(configFiles, SetIterations(iterations)...) - for _, s := range allSignals { + for _, s := range []string{"logs", "metrics", "traces"} { if signal != s { configFiles = append(configFiles, DisableSignal(s)...) } } - configFiles = append(configFiles, CollectorConfigFilesFromConfig(exporter)...) return } diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 8a4fd502..def75042 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -15,11 +15,13 @@ var Config struct { Secure bool Headers map[string]string CollectorConfigPath string - Exporter string // should be one of [otlp, otlphttp] Logs bool Metrics bool Traces bool + + ExporterOTLP bool + ExporterOTLPHTTP bool } func Init() { @@ -53,7 +55,8 @@ func Init() { flag.StringVar(&Config.CollectorConfigPath, "config", "", "Collector config path") - flag.StringVar(&Config.Exporter, "exporter", "otlp", "exporter to use, one of [otlp, otlphttp]") + flag.BoolVar(&Config.ExporterOTLP, "exporter-otlp", true, "benchmark exporter otlp") + flag.BoolVar(&Config.ExporterOTLPHTTP, "exporter-otlphttp", true, "benchmark exporter otlphttp") flag.BoolVar(&Config.Logs, "logs", true, "benchmark logs") flag.BoolVar(&Config.Metrics, "metrics", true, "benchmark metrics") @@ -96,13 +99,6 @@ func getEnvOrDefault(name, defaultValue string) string { return defaultValue } -// CollectorConfigFilesFromConfig returns a slice of strings, each can be passed to the collector using --config -func CollectorConfigFilesFromConfig(exporter string) (configFiles []string) { - sets := CollectorSetFromConfig(exporter) - configFiles = setsToConfigs(sets) - return -} - // setsToConfigs converts --set to --config func setsToConfigs(sets []string) (configFiles []string) { for _, s := range sets { @@ -116,8 +112,12 @@ func setsToConfigs(sets []string) (configFiles []string) { return } -// CollectorSetFromConfig returns a slice of strings, each can be passed to the collector using --set -func CollectorSetFromConfig(exporter string) (configSets []string) { +func ExporterConfigs(exporter string) (configFiles []string) { + var configSets []string + configSets = append(configSets, fmt.Sprintf("service.pipelines.logs.exporters=[%s]", exporter)) + configSets = append(configSets, fmt.Sprintf("service.pipelines.metrics.exporters=[%s]", exporter)) + configSets = append(configSets, fmt.Sprintf("service.pipelines.traces.exporters=[%s]", exporter)) + if Config.ServerURL != nil { configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) } @@ -132,7 +132,7 @@ func CollectorSetFromConfig(exporter string) (configSets []string) { configSets = append(configSets, fmt.Sprintf("exporters.%s.tls.insecure=%v", exporter, !Config.Secure)) - return + return setsToConfigs(configSets) } func DisableSignal(signal string) (configFiles []string) { From ad4486e93e37f22eb0e53202c36afb811679257c Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 16:45:18 +0000 Subject: [PATCH 17/51] Remove total as benchmark is per signal --- loadgen/cmd/otelbench/main.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 9e26357c..fa86eb4d 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -84,11 +84,9 @@ func main() { stats := logsStats.Add(metricsStats).Add(tracesStats) elapsedSeconds := b.Elapsed().Seconds() - total := stats.LogRecords + stats.MetricDataPoints + stats.Spans b.ReportMetric(float64(stats.LogRecords)/elapsedSeconds, "logs/s") b.ReportMetric(float64(stats.MetricDataPoints)/elapsedSeconds, "metric_points/s") b.ReportMetric(float64(stats.Spans)/elapsedSeconds, "spans/s") - b.ReportMetric(float64(total)/elapsedSeconds, "total/s") b.ReportMetric(float64(stats.Requests)/elapsedSeconds, "requests/s") close(stop) From ed76ad84b50b7d2da983cab9f1dfe2ef208fb696 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 17:06:03 +0000 Subject: [PATCH 18/51] Surface failed counts --- loadgen/cmd/otelbench/main.go | 4 ++++ receiver/loadgenreceiver/logs.go | 31 ++++++++++++++--------------- receiver/loadgenreceiver/metrics.go | 31 ++++++++++++++--------------- receiver/loadgenreceiver/stats.go | 12 ++++++++++- receiver/loadgenreceiver/traces.go | 31 ++++++++++++++--------------- 5 files changed, 60 insertions(+), 49 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index fa86eb4d..c5c23d48 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -88,6 +88,10 @@ func main() { b.ReportMetric(float64(stats.MetricDataPoints)/elapsedSeconds, "metric_points/s") b.ReportMetric(float64(stats.Spans)/elapsedSeconds, "spans/s") b.ReportMetric(float64(stats.Requests)/elapsedSeconds, "requests/s") + b.ReportMetric(float64(stats.FailedLogRecords)/elapsedSeconds, "failed_logs/s") + b.ReportMetric(float64(stats.FailedMetricDataPoints)/elapsedSeconds, "failed_metric_points/s") + b.ReportMetric(float64(stats.FailedSpans)/elapsedSeconds, "failed_spans/s") + b.ReportMetric(float64(stats.FailedRequests)/elapsedSeconds, "failed_requests/s") close(stop) }() diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index 282d7f00..43779ea6 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -42,8 +42,9 @@ type logsGenerator struct { cfg *Config logger *zap.Logger - samples internal.LoopingList[plog.Logs] - sampleStats TelemetryStats + samples internal.LoopingList[plog.Logs] + + stats TelemetryStats consumer consumer.Logs @@ -69,7 +70,6 @@ func createLogsReceiver( } } - var sampleStats TelemetryStats var samples []plog.Logs scanner := bufio.NewScanner(bytes.NewReader(sampleLogs)) for scanner.Scan() { @@ -79,16 +79,13 @@ func createLogsReceiver( return nil, err } samples = append(samples, lineLogs) - sampleStats.Requests++ - sampleStats.LogRecords += lineLogs.LogRecordCount() } return &logsGenerator{ - cfg: genConfig, - logger: set.Logger, - consumer: consumer, - samples: internal.NewLoopingList(samples), - sampleStats: sampleStats, + cfg: genConfig, + logger: set.Logger, + consumer: consumer, + samples: internal.NewLoopingList(samples), }, nil } @@ -103,15 +100,17 @@ func (ar *logsGenerator) Start(ctx context.Context, _ component.Host) error { return default: } - if err := ar.consumer.ConsumeLogs(startCtx, ar.nextLogs()); err != nil { + m := ar.nextLogs() + if err := ar.consumer.ConsumeLogs(startCtx, m); err != nil { ar.logger.Error(err.Error()) + ar.stats.FailedRequests++ + ar.stats.FailedLogRecords += m.LogRecordCount() + } else { + ar.stats.Requests++ + ar.stats.LogRecords += m.LogRecordCount() } if ar.isDone() { - ar.cfg.Logs.doneCh <- TelemetryStats{ - Requests: ar.sampleStats.Requests * ar.cfg.Logs.MaxReplay, - LogRecords: ar.sampleStats.LogRecords * ar.cfg.Logs.MaxReplay, - } - close(ar.cfg.Logs.doneCh) + ar.cfg.Logs.doneCh <- ar.stats return } } diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index 6fd609a0..6ac81577 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -42,8 +42,9 @@ type metricsGenerator struct { cfg *Config logger *zap.Logger - samples internal.LoopingList[pmetric.Metrics] - sampleStats TelemetryStats + samples internal.LoopingList[pmetric.Metrics] + + stats TelemetryStats consumer consumer.Metrics @@ -69,7 +70,6 @@ func createMetricsReceiver( } } - var sampleStats TelemetryStats var samples []pmetric.Metrics scanner := bufio.NewScanner(bytes.NewReader(sampleMetrics)) for scanner.Scan() { @@ -79,16 +79,13 @@ func createMetricsReceiver( return nil, err } samples = append(samples, lineMetrics) - sampleStats.Requests++ - sampleStats.MetricDataPoints += lineMetrics.DataPointCount() } return &metricsGenerator{ - cfg: genConfig, - logger: set.Logger, - consumer: consumer, - samples: internal.NewLoopingList(samples), - sampleStats: sampleStats, + cfg: genConfig, + logger: set.Logger, + consumer: consumer, + samples: internal.NewLoopingList(samples), }, nil } @@ -103,15 +100,17 @@ func (ar *metricsGenerator) Start(ctx context.Context, _ component.Host) error { return default: } - if err := ar.consumer.ConsumeMetrics(startCtx, ar.nextMetrics()); err != nil { + m := ar.nextMetrics() + if err := ar.consumer.ConsumeMetrics(startCtx, m); err != nil { ar.logger.Error(err.Error()) + ar.stats.FailedRequests++ + ar.stats.FailedMetricDataPoints += m.DataPointCount() + } else { + ar.stats.Requests++ + ar.stats.MetricDataPoints += m.DataPointCount() } if ar.isDone() { - ar.cfg.Metrics.doneCh <- TelemetryStats{ - Requests: ar.sampleStats.Requests * ar.cfg.Metrics.MaxReplay, - MetricDataPoints: ar.sampleStats.MetricDataPoints * ar.cfg.Metrics.MaxReplay, - } - close(ar.cfg.Metrics.doneCh) + ar.cfg.Metrics.doneCh <- ar.stats return } } diff --git a/receiver/loadgenreceiver/stats.go b/receiver/loadgenreceiver/stats.go index 0c81d729..7a5ede03 100644 --- a/receiver/loadgenreceiver/stats.go +++ b/receiver/loadgenreceiver/stats.go @@ -1,16 +1,26 @@ package loadgenreceiver type TelemetryStats struct { - Requests int + Requests int + FailedRequests int + LogRecords int MetricDataPoints int Spans int + + FailedLogRecords int + FailedMetricDataPoints int + FailedSpans int } func (s TelemetryStats) Add(other TelemetryStats) TelemetryStats { s.Requests += other.Requests + s.FailedRequests += other.FailedRequests s.LogRecords += other.LogRecords s.MetricDataPoints += other.MetricDataPoints s.Spans += other.Spans + s.FailedLogRecords += other.FailedLogRecords + s.FailedMetricDataPoints += other.FailedMetricDataPoints + s.FailedSpans += other.FailedSpans return s } diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index fd582a58..4cfc74fe 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -42,8 +42,9 @@ type tracesGenerator struct { cfg *Config logger *zap.Logger - samples internal.LoopingList[ptrace.Traces] - sampleStats TelemetryStats + samples internal.LoopingList[ptrace.Traces] + + stats TelemetryStats consumer consumer.Traces @@ -69,7 +70,6 @@ func createTracesReceiver( } } - var sampleStats TelemetryStats var samples []ptrace.Traces scanner := bufio.NewScanner(bytes.NewReader(sampleTraces)) for scanner.Scan() { @@ -79,16 +79,13 @@ func createTracesReceiver( return nil, err } samples = append(samples, lineTraces) - sampleStats.Requests++ - sampleStats.Spans += lineTraces.SpanCount() } return &tracesGenerator{ - cfg: genConfig, - logger: set.Logger, - consumer: consumer, - samples: internal.NewLoopingList(samples), - sampleStats: sampleStats, + cfg: genConfig, + logger: set.Logger, + consumer: consumer, + samples: internal.NewLoopingList(samples), }, nil } @@ -103,15 +100,17 @@ func (ar *tracesGenerator) Start(ctx context.Context, _ component.Host) error { return default: } - if err := ar.consumer.ConsumeTraces(startCtx, ar.nextTraces()); err != nil { + m := ar.nextTraces() + if err := ar.consumer.ConsumeTraces(startCtx, m); err != nil { ar.logger.Error(err.Error()) + ar.stats.FailedRequests++ + ar.stats.FailedSpans += m.SpanCount() + } else { + ar.stats.Requests++ + ar.stats.Spans += m.SpanCount() } if ar.isDone() { - ar.cfg.Traces.doneCh <- TelemetryStats{ - Requests: ar.sampleStats.Requests * ar.cfg.Traces.MaxReplay, - Spans: ar.sampleStats.Spans * ar.cfg.Traces.MaxReplay, - } - close(ar.cfg.Traces.doneCh) + ar.cfg.Traces.doneCh <- ar.stats return } } From 7624ee59a6bbcf74e4f2ae19e9a7ee2bf7fe190c Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 17:14:43 +0000 Subject: [PATCH 19/51] Improve config and defaults --- loadgen/cmd/otelbench/config.yaml | 4 ++-- loadgen/cmd/otelbench/runner.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml index 0cdd572a..73a39abe 100644 --- a/loadgen/cmd/otelbench/config.yaml +++ b/loadgen/cmd/otelbench/config.yaml @@ -4,12 +4,12 @@ receivers: exporters: otlp: - endpoint: "localhost:0" + endpoint: "http://localhost:8200" sending_queue: enabled: false timeout: 60s otlphttp: - endpoint: "localhost:0" + endpoint: "http://localhost:8200" sending_queue: enabled: false timeout: 60s diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index def75042..35226c97 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -27,16 +27,16 @@ var Config struct { func Init() { // Server config flag.Func( - "server", - "server URL (default http://127.0.0.1:8200)", + "endpoint", + "target server URL", func(server string) (err error) { if server != "" { Config.ServerURL, err = url.Parse(server) } return }) - flag.StringVar(&Config.SecretToken, "secret-token", "", "secret token for APM Server") - flag.StringVar(&Config.APIKey, "api-key", "", "API key for APM Server") + flag.StringVar(&Config.SecretToken, "secret-token", "", "secret token for target server") + flag.StringVar(&Config.APIKey, "api-key", "", "API key for target server") flag.BoolVar(&Config.Secure, "secure", false, "validate the remote server TLS certificates") flag.Func("header", "extra headers to use when sending data to the server", @@ -53,7 +53,7 @@ func Init() { }, ) - flag.StringVar(&Config.CollectorConfigPath, "config", "", "Collector config path") + flag.StringVar(&Config.CollectorConfigPath, "config", "", "collector config path") flag.BoolVar(&Config.ExporterOTLP, "exporter-otlp", true, "benchmark exporter otlp") flag.BoolVar(&Config.ExporterOTLPHTTP, "exporter-otlphttp", true, "benchmark exporter otlphttp") @@ -80,7 +80,7 @@ func setFlagsFromEnv() { // value[0] is environment key // value[1] is default value flagEnvMap := map[string][]string{ - "server": {"ELASTIC_APM_SERVER_URL", "http://127.0.0.1:8200"}, + "server": {"ELASTIC_APM_SERVER_URL", ""}, "secret-token": {"ELASTIC_APM_SECRET_TOKEN", ""}, "api-key": {"ELASTIC_APM_API_KEY", ""}, "secure": {"ELASTIC_APM_VERIFY_SERVER_CERT", "false"}, From 3e31bf24cca722bce019b98e92ffe8fa199111e6 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 18:10:51 +0000 Subject: [PATCH 20/51] Fix command line options --- loadgen/cmd/otelbench/config.yaml | 9 +++++++++ loadgen/cmd/otelbench/runner.go | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml index 73a39abe..e2ec2b87 100644 --- a/loadgen/cmd/otelbench/config.yaml +++ b/loadgen/cmd/otelbench/config.yaml @@ -5,11 +5,20 @@ receivers: exporters: otlp: endpoint: "http://localhost:8200" + tls: + # As otlpexporter ignores the protocol in `endpoint`, + # `tls::insecure` needs to be explicitly set to true if target server does not use TLS + insecure: false + insecure_skip_verify: false sending_queue: enabled: false timeout: 60s otlphttp: endpoint: "http://localhost:8200" + tls: + # As long as the endpoint contains the correct protocol, `tls::insecure` does not matter. + insecure: false + insecure_skip_verify: false sending_queue: enabled: false timeout: 60s diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 35226c97..6d701cf3 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -12,7 +12,8 @@ var Config struct { ServerURL *url.URL SecretToken string APIKey string - Secure bool + Insecure bool + InsecureSkipVerify bool Headers map[string]string CollectorConfigPath string @@ -28,7 +29,7 @@ func Init() { // Server config flag.Func( "endpoint", - "target server URL", + "target server URL (defaults to value in config yaml)", func(server string) (err error) { if server != "" { Config.ServerURL, err = url.Parse(server) @@ -37,7 +38,10 @@ func Init() { }) flag.StringVar(&Config.SecretToken, "secret-token", "", "secret token for target server") flag.StringVar(&Config.APIKey, "api-key", "", "API key for target server") - flag.BoolVar(&Config.Secure, "secure", false, "validate the remote server TLS certificates") + + flag.BoolVar(&Config.Insecure, "insecure", false, "disable TLS, ignored by otlphttp exporter (defaults to value in config yaml)") + flag.BoolVar(&Config.InsecureSkipVerify, "insecure-skip-verify", false, "skip validating the remote server TLS certificates (defaults to value in config yaml)") + flag.Func("header", "extra headers to use when sending data to the server", func(s string) error { @@ -53,7 +57,7 @@ func Init() { }, ) - flag.StringVar(&Config.CollectorConfigPath, "config", "", "collector config path") + flag.StringVar(&Config.CollectorConfigPath, "config", "config.yaml", "path collector config yaml") flag.BoolVar(&Config.ExporterOTLP, "exporter-otlp", true, "benchmark exporter otlp") flag.BoolVar(&Config.ExporterOTLPHTTP, "exporter-otlphttp", true, "benchmark exporter otlphttp") @@ -130,7 +134,13 @@ func ExporterConfigs(exporter string) (configFiles []string) { configSets = append(configSets, fmt.Sprintf("exporters.%s.headers.%s=%s", exporter, k, v)) } - configSets = append(configSets, fmt.Sprintf("exporters.%s.tls.insecure=%v", exporter, !Config.Secure)) + // Only set insecure and insecure_skip_verify on true, so that corresponding config value in yaml is used on default. + if Config.Insecure { + configSets = append(configSets, fmt.Sprintf("exporters.%s.tls.insecure=%v", exporter, Config.Insecure)) + } + if Config.InsecureSkipVerify { + configSets = append(configSets, fmt.Sprintf("exporters.%s.tls.insecure_skip_verify=%v", exporter, Config.InsecureSkipVerify)) + } return setsToConfigs(configSets) } From c71a9837824471203faa4a8b0a082516855693d8 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 18:18:08 +0000 Subject: [PATCH 21/51] Separate otlp and otlphttp --- loadgen/cmd/otelbench/runner.go | 39 +++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 6d701cf3..8765a4e0 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -9,7 +9,9 @@ import ( ) var Config struct { - ServerURL *url.URL + ServerURLOTLP *url.URL + ServerURLOTLPHTTP *url.URL + SecretToken string APIKey string Insecure bool @@ -29,18 +31,37 @@ func Init() { // Server config flag.Func( "endpoint", - "target server URL (defaults to value in config yaml)", + "target server endpoint for both otlp and otlphttp exporters (default to value in config yaml), equivalent to setting both -endpoint-otlp and -endpoint-otlphttp", + func(server string) (err error) { + if server != "" { + Config.ServerURLOTLP, err = url.Parse(server) + Config.ServerURLOTLPHTTP, err = url.Parse(server) + } + return + }) + flag.Func( + "endpoint-otlp", + "target server endpoint for otlp exporter (default to value in config yaml)", func(server string) (err error) { if server != "" { - Config.ServerURL, err = url.Parse(server) + Config.ServerURLOTLP, err = url.Parse(server) + } + return + }) + flag.Func( + "endpoint-otlphttp", + "target server endpoint for otlphttp exporter (default to value in config yaml)", + func(server string) (err error) { + if server != "" { + Config.ServerURLOTLPHTTP, err = url.Parse(server) } return }) flag.StringVar(&Config.SecretToken, "secret-token", "", "secret token for target server") flag.StringVar(&Config.APIKey, "api-key", "", "API key for target server") - flag.BoolVar(&Config.Insecure, "insecure", false, "disable TLS, ignored by otlphttp exporter (defaults to value in config yaml)") - flag.BoolVar(&Config.InsecureSkipVerify, "insecure-skip-verify", false, "skip validating the remote server TLS certificates (defaults to value in config yaml)") + flag.BoolVar(&Config.Insecure, "insecure", false, "disable TLS, ignored by otlphttp exporter (default to value in config yaml)") + flag.BoolVar(&Config.InsecureSkipVerify, "insecure-skip-verify", false, "skip validating the remote server TLS certificates (default to value in config yaml)") flag.Func("header", "extra headers to use when sending data to the server", @@ -122,8 +143,12 @@ func ExporterConfigs(exporter string) (configFiles []string) { configSets = append(configSets, fmt.Sprintf("service.pipelines.metrics.exporters=[%s]", exporter)) configSets = append(configSets, fmt.Sprintf("service.pipelines.traces.exporters=[%s]", exporter)) - if Config.ServerURL != nil { - configSets = append(configSets, fmt.Sprintf("exporters.%s.endpoint=%s", exporter, Config.ServerURL)) + if Config.ServerURLOTLP != nil { + configSets = append(configSets, fmt.Sprintf("exporters.otlp.endpoint=%s", Config.ServerURLOTLP)) + } + + if Config.ServerURLOTLPHTTP != nil { + configSets = append(configSets, fmt.Sprintf("exporters.otlphttp.endpoint=%s", Config.ServerURLOTLPHTTP)) } if v := getAuthorizationHeaderValue(Config.APIKey, Config.SecretToken); v != "" { From 7f69f60bc40c3f17e764c88e950ab51324824dfe Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 19:05:15 +0000 Subject: [PATCH 22/51] Add README --- README.md | 2 +- loadgen/README.md | 26 +++---- loadgen/cmd/otelbench/README.md | 129 ++++++++++++++++++++++++++++++++ loadgen/cmd/otelsoak/README.md | 25 +++++++ 4 files changed, 164 insertions(+), 18 deletions(-) create mode 100644 loadgen/cmd/otelbench/README.md create mode 100644 loadgen/cmd/otelsoak/README.md diff --git a/README.md b/README.md index 0f5c46a3..8695465f 100644 --- a/README.md +++ b/README.md @@ -35,5 +35,5 @@ In order to build a collector with a custom component, e.g. for testing purposes ## Load generator -See [./loadgen/README.md](./loadgen/README.md). +See [./loadgen/README.md](loadgen/cmd/otelsoak/README.md). diff --git a/loadgen/README.md b/loadgen/README.md index e70462c4..235f1362 100644 --- a/loadgen/README.md +++ b/loadgen/README.md @@ -1,19 +1,11 @@ -# loadgen: the load generator based on OTel collector +# loadgen: OTel load generation tooling -To generate load to an OTLP target, run Elastic collector components distro with specific pipelines to replay canned data at a configurable rate. +In `cmd/` directory, there are +- [otelsoak](./otelsoak/README.md) + - Load generator that is exactly an OTel collector. It sends load to an endpoint and never terminates. + - Suitable for soak testing +- [otelbench](./otelbench/README.md) + - Load generator based on OTel collector and Go benchmarking. It sends load to an endpoint, terminates after a configured duration, and outputs statistics. + - Suitable for benchmarking -See an example configuration at `config.example.yaml`. There are rate limiting and trace ID rewriting by default. - -## Usage - -``` -../_build/elastic-collector-components --config config.example.yaml --set "exporter.otlp.endpoint=http://localhost:8200" --set "exporter.otlp.headers.Authorization=ApiKey xxx" --set "exporter.otlp.headers.X-FOO-HEADER=bar" -``` - -Alternatively, there's `ELASTIC_APM_SERVER_URL` and `ELASTIC_APM_API_KEY` env var handling out of the box. `ELASTIC_APM_SECRET_TOKEN` is NOT supported without changing `config.example.yaml`. - -``` -ELASTIC_APM_SERVER_URL=http://localhost:8200 ELASTIC_APM_API_KEY=some_api_key ../_build/elastic-collector-components --config config.example.yaml -``` - -Even better, create your own `config.yaml` from `config.example.yaml` to fit your needs. +otelsoak and otelbench is synonymous to apmsoak and apmbench in [elastic/apm-perf](https://github.com/elastic/apm-perf). diff --git a/loadgen/cmd/otelbench/README.md b/loadgen/cmd/otelbench/README.md new file mode 100644 index 00000000..c5e79b3f --- /dev/null +++ b/loadgen/cmd/otelbench/README.md @@ -0,0 +1,129 @@ +# otelbench + +otelbench wraps the collector inside a Go test benchmark. It outputs throughput numbers in standard Go benchmark format. It uses a collector config yaml as a base, and apply some overrides from command line options. + +## Usage + +``` +Usage of ./otelbench: + -api-key string + API key for target server + -config string + path collector config yaml (default "config.yaml") + -endpoint value + target server endpoint for both otlp and otlphttp exporters (default to value in config yaml), equivalent to setting both -endpoint-otlp and -endpoint-otlphttp + -endpoint-otlp value + target server endpoint for otlp exporter (default to value in config yaml) + -endpoint-otlphttp value + target server endpoint for otlphttp exporter (default to value in config yaml) + -exporter-otlp + benchmark exporter otlp (default true) + -exporter-otlphttp + benchmark exporter otlphttp (default true) + -header value + extra headers to use when sending data to the server + -insecure + disable TLS, ignored by otlphttp exporter (default to value in config yaml) + -insecure-skip-verify + skip validating the remote server TLS certificates (default to value in config yaml) + -logs + benchmark logs (default true) + -metrics + benchmark metrics (default true) + -secret-token string + secret token for target server + -test.bench regexp + run only benchmarks matching regexp + -test.benchmem + print memory allocations for benchmarks + -test.benchtime d + run each benchmark for duration d or N times if `d` is of the form Nx (default 1s) + -test.blockprofile file + write a goroutine blocking profile to file + -test.blockprofilerate rate + set blocking profile rate (see runtime.SetBlockProfileRate) (default 1) + -test.count n + run tests and benchmarks n times (default 1) + -test.coverprofile file + write a coverage profile to file + -test.cpu list + comma-separated list of cpu counts to run each test with + -test.cpuprofile file + write a cpu profile to file + -test.failfast + do not start new tests after the first test failure + -test.fullpath + show full file names in error messages + -test.fuzz regexp + run the fuzz test matching regexp + -test.fuzzcachedir string + directory where interesting fuzzing inputs are stored (for use only by cmd/go) + -test.fuzzminimizetime value + time to spend minimizing a value after finding a failing input (default 1m0s) + -test.fuzztime value + time to spend fuzzing; default is to run indefinitely + -test.fuzzworker + coordinate with the parent process to fuzz random values (for use only by cmd/go) + -test.gocoverdir string + write coverage intermediate files to this directory + -test.list regexp + list tests, examples, and benchmarks matching regexp then exit + -test.memprofile file + write an allocation profile to file + -test.memprofilerate rate + set memory allocation profiling rate (see runtime.MemProfileRate) + -test.mutexprofile string + write a mutex contention profile to the named file after execution + -test.mutexprofilefraction int + if >= 0, calls runtime.SetMutexProfileFraction() (default 1) + -test.outputdir dir + write profiles to dir + -test.paniconexit0 + panic on call to os.Exit(0) + -test.parallel n + run at most n tests in parallel (default 16) + -test.run regexp + run only tests and examples matching regexp + -test.short + run smaller test suite to save time + -test.shuffle string + randomize the execution order of tests and benchmarks (default "off") + -test.skip regexp + do not list or run tests matching regexp + -test.testlogfile file + write test action log to file (for use only by cmd/go) + -test.timeout d + panic test binary after duration d (default 0, timeout disabled) + -test.trace file + write an execution trace to file + -test.v + verbose: print additional output + -traces + benchmark traces (default true) +``` + +## Example usage + +To send to a local apm-server + +```shell +./otelbench -config=./config.yaml -endpoint=http://localhost:8200 -secret-token=foobar -insecure +``` + +To send to an ESS apm-server + +```shell +./otelbench -test.benchtime=1m -config=./config.yaml -endpoint=https://foobar.apm.europe-west2.gcp.elastic-cloud.com:443 -api-key=some_api_key +``` + +To send to an OTel collector with a special otlphttp path + +```shell +./otelbench -config=./config.yaml -endpoint-otlp=localhost:4317 -endpoint-otlphttp=https://localhost:4318/prefix -api-key some_api_key +``` + +It is possible to run with a customized config to avoid passing in command line options every time + +```shell +./otelbench -config=./my-custom-config.yaml +``` diff --git a/loadgen/cmd/otelsoak/README.md b/loadgen/cmd/otelsoak/README.md new file mode 100644 index 00000000..c6632db8 --- /dev/null +++ b/loadgen/cmd/otelsoak/README.md @@ -0,0 +1,25 @@ +# otelsoak + +otelsoak is just an OTel collector. + +To generate load to an OTLP target, run Elastic collector components distro with specific pipelines to replay canned data at a configurable rate. + +See an example configuration at [`config.example.yaml`](./config.example.yaml). There are rate limiting and trace ID rewriting by default. + +## Usage + +1. Build the Elastic collector components distro by running `make genelasticcol` at the root of this repository. +2. Run `otelsoak`, which is a symlink to the collector binary. + +To override any config, use `--config` or `--set`. See [official OTel configuration documentation](https://opentelemetry.io/docs/collector/configuration/). +``` +./otelsoak --config config.example.yaml --set "exporter.otlp.endpoint=http://localhost:8200" --set "exporter.otlp.headers.Authorization=ApiKey xxx" --set "exporter.otlp.headers.X-FOO-HEADER=bar" +``` + +Alternatively, there's `ELASTIC_APM_SERVER_URL` and `ELASTIC_APM_API_KEY` env var handling out of the box in the example config yaml. Note that `ELASTIC_APM_SECRET_TOKEN` is NOT supported without changing `config.example.yaml`. + +``` +ELASTIC_APM_SERVER_URL=http://localhost:8200 ELASTIC_APM_API_KEY=some_api_key ./otelsoak --config config.example.yaml +``` + +It is recommended to create your own `config.yaml` from `config.example.yaml` to fit your needs. From c2bbf4e39077c5ab0e9a336e44afbd14b74efcd9 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 19:07:40 +0000 Subject: [PATCH 23/51] Remove support for ELASTIC_APM_VERIFY_SERVER_CERT --- loadgen/cmd/otelbench/runner.go | 1 - 1 file changed, 1 deletion(-) diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 8765a4e0..653150ec 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -108,7 +108,6 @@ func setFlagsFromEnv() { "server": {"ELASTIC_APM_SERVER_URL", ""}, "secret-token": {"ELASTIC_APM_SECRET_TOKEN", ""}, "api-key": {"ELASTIC_APM_API_KEY", ""}, - "secure": {"ELASTIC_APM_VERIFY_SERVER_CERT", "false"}, } for k, v := range flagEnvMap { From e57618da17da8175b6cc2a2778627707a832b65a Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 19:08:10 +0000 Subject: [PATCH 24/51] Fix env var support --- loadgen/cmd/otelbench/runner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 653150ec..87b688cd 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -105,7 +105,7 @@ func setFlagsFromEnv() { // value[0] is environment key // value[1] is default value flagEnvMap := map[string][]string{ - "server": {"ELASTIC_APM_SERVER_URL", ""}, + "endpoint": {"ELASTIC_APM_SERVER_URL", ""}, "secret-token": {"ELASTIC_APM_SECRET_TOKEN", ""}, "api-key": {"ELASTIC_APM_API_KEY", ""}, } From 8341587ca9e141500a13aa00767c7105b01dfb30 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 21:40:03 +0000 Subject: [PATCH 25/51] Use b.Fatal --- loadgen/cmd/otelbench/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index c5c23d48..dec5b8eb 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -98,8 +98,7 @@ func main() { err := RunCollector(context.Background(), stop, configs(exporter, signal, b.N), logsDone, metricsDone, tracesDone) if err != nil { - fmt.Println(err) - b.Log(err) + b.Fatal(err) } }) fmt.Print(fmt.Sprintf("%s-%s", signal, exporter)) From 55064d720d11405ec5f040e13664e663a2c800d9 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 21:59:49 +0000 Subject: [PATCH 26/51] Use ERROR level to reduce log noise --- loadgen/cmd/otelbench/config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/loadgen/cmd/otelbench/config.yaml b/loadgen/cmd/otelbench/config.yaml index e2ec2b87..6336a4e0 100644 --- a/loadgen/cmd/otelbench/config.yaml +++ b/loadgen/cmd/otelbench/config.yaml @@ -47,3 +47,6 @@ service: receivers: [loadgen] processors: [transform/rewrite] exporters: [otlp] # this will be set dynamically to otlp or otlphttp depending on config + telemetry: + logs: + level: ERROR From 31db7fa97bf58eebb893298244d6c4659cb52c4e Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:02:19 +0000 Subject: [PATCH 27/51] Add TODO --- loadgen/cmd/otelbench/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index dec5b8eb..861c0c75 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -56,9 +56,14 @@ func main() { testing.Init() flag.Parse() + // TODO(carsonip): configurable warm up + for _, signal := range getSignals() { for _, exporter := range getExporters() { result := testing.Benchmark(func(b *testing.B) { + // TODO(carsonip): simulate > 1 agents for higher load + // https://github.com/elastic/opentelemetry-collector-components/issues/305 + // loadgenreceiver will send stats about generated telemetry when it finishes sending b.N iterations logsDone := make(chan loadgenreceiver.TelemetryStats) metricsDone := make(chan loadgenreceiver.TelemetryStats) From 77c4d4989032f3e329ce67578098afdb37480f13 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:03:02 +0000 Subject: [PATCH 28/51] Add TODO --- loadgen/cmd/otelsoak/config.example.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loadgen/cmd/otelsoak/config.example.yaml b/loadgen/cmd/otelsoak/config.example.yaml index 304e9d6d..8e481b0c 100644 --- a/loadgen/cmd/otelsoak/config.example.yaml +++ b/loadgen/cmd/otelsoak/config.example.yaml @@ -36,6 +36,8 @@ processors: burst: 5000 throttle_behavior: delay +# TODO(carsonip): simulate > 1 agents for higher load +# https://github.com/elastic/opentelemetry-collector-components/issues/305 service: pipelines: From e5b34e02952540d31ae220adaca7c5f45fa54e11 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:10:47 +0000 Subject: [PATCH 29/51] Rename --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d24a9223..f267ed84 100644 --- a/Makefile +++ b/Makefile @@ -92,11 +92,11 @@ builddocker: docker build -t $$IMAGE_NAME -f distributions/elastic-components/Dockerfile . # Validate that the Elastic components collector can run with the example otelsoak configuration. -.PHONY: loadgencol-validate -loadgen-validate: genelasticcol +.PHONY: otelsoak-validate +otelsoak-validate: genelasticcol ELASTIC_APM_SERVER_URL=http://localhost:8200 ELASTIC_APM_API_KEY=foobar ./loadgen/cmd/otelsoak/otelsoak validate --config ./loadgen/cmd/otelsoak/config.example.yaml -# Run loadgen -.PHONY: loadgencol-run -loadgen-run: genelasticcol +# Run otelsoak +.PHONY: otelsoak-run +otelsoak-run: genelasticcol ./loadgen/cmd/otelsoak/otelsoak --config ./loadgen/cmd/otelsoak/config.example.yaml $(ARGS) From 3f13a7f78debf201627fc2c07120afc688ae0b4d Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:12:01 +0000 Subject: [PATCH 30/51] Add nil check to doneCh --- receiver/loadgenreceiver/logs.go | 4 +++- receiver/loadgenreceiver/metrics.go | 4 +++- receiver/loadgenreceiver/traces.go | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index 43779ea6..a395b88f 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -110,7 +110,9 @@ func (ar *logsGenerator) Start(ctx context.Context, _ component.Host) error { ar.stats.LogRecords += m.LogRecordCount() } if ar.isDone() { - ar.cfg.Logs.doneCh <- ar.stats + if ar.cfg.Logs.doneCh != nil { + ar.cfg.Logs.doneCh <- ar.stats + } return } } diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index 6ac81577..52da3d28 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -110,7 +110,9 @@ func (ar *metricsGenerator) Start(ctx context.Context, _ component.Host) error { ar.stats.MetricDataPoints += m.DataPointCount() } if ar.isDone() { - ar.cfg.Metrics.doneCh <- ar.stats + if ar.cfg.Metrics.doneCh != nil { + ar.cfg.Metrics.doneCh <- ar.stats + } return } } diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index 4cfc74fe..f0b68d0f 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -110,7 +110,9 @@ func (ar *tracesGenerator) Start(ctx context.Context, _ component.Host) error { ar.stats.Spans += m.SpanCount() } if ar.isDone() { - ar.cfg.Traces.doneCh <- ar.stats + if ar.cfg.Traces.doneCh != nil { + ar.cfg.Traces.doneCh <- ar.stats + } return } } From 9ee4dd131781a0b0e20910dc81ec46eefa7c79bd Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:18:56 +0000 Subject: [PATCH 31/51] Fix replay count off-by-one and document --- receiver/loadgenreceiver/config.go | 18 +++++++++++++++--- receiver/loadgenreceiver/logs.go | 2 +- receiver/loadgenreceiver/metrics.go | 2 +- receiver/loadgenreceiver/traces.go | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/receiver/loadgenreceiver/config.go b/receiver/loadgenreceiver/config.go index 3cf98bc3..02b71e17 100644 --- a/receiver/loadgenreceiver/config.go +++ b/receiver/loadgenreceiver/config.go @@ -36,24 +36,36 @@ type MetricsConfig struct { // JsonlFile is an optional configuration option to specify the path to // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` + + // MaxReplay is an optional configuration to specify the number of times the file is replayed. MaxReplay int `mapstructure:"max_replay"` - doneCh chan TelemetryStats + // doneCh is only non-nil when the receiver is created with NewFactoryWithDone. + // It is to notify the caller of collector that receiver finished replaying the file for MaxReplay number of times. + doneCh chan TelemetryStats } type LogsConfig struct { // JsonlFile is an optional configuration option to specify the path to // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` + + // MaxReplay is an optional configuration to specify the number of times the file is replayed. MaxReplay int `mapstructure:"max_replay"` - doneCh chan TelemetryStats + // doneCh is only non-nil when the receiver is created with NewFactoryWithDone. + // It is to notify the caller of collector that receiver finished replaying the file for MaxReplay number of times. + doneCh chan TelemetryStats } type TracesConfig struct { // JsonlFile is an optional configuration option to specify the path to // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` + + // MaxReplay is an optional configuration to specify the number of times the file is replayed. MaxReplay int `mapstructure:"max_replay"` - doneCh chan TelemetryStats + // doneCh is only non-nil when the receiver is created with NewFactoryWithDone. + // It is to notify the caller of collector that receiver finished replaying the file for MaxReplay number of times. + doneCh chan TelemetryStats } var _ component.Config = (*Config)(nil) diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index a395b88f..c5e14dbd 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -147,5 +147,5 @@ func (ar *logsGenerator) nextLogs() plog.Logs { } func (ar *logsGenerator) isDone() bool { - return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() > ar.cfg.Logs.MaxReplay + return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() >= ar.cfg.Logs.MaxReplay } diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index 52da3d28..dfd3efdc 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -179,5 +179,5 @@ func (ar *metricsGenerator) nextMetrics() pmetric.Metrics { } func (ar *metricsGenerator) isDone() bool { - return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() > ar.cfg.Metrics.MaxReplay + return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() >= ar.cfg.Metrics.MaxReplay } diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index f0b68d0f..f498dccc 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -149,5 +149,5 @@ func (ar *tracesGenerator) nextTraces() ptrace.Traces { } func (ar *tracesGenerator) isDone() bool { - return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() > ar.cfg.Traces.MaxReplay + return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() >= ar.cfg.Traces.MaxReplay } From 8625ff07033b140214f92fd68c3bdf46b1b9fe82 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:31:38 +0000 Subject: [PATCH 32/51] Fix lint --- loadgen/cmd/otelbench/main.go | 2 +- loadgen/cmd/otelbench/runner.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 861c0c75..06342af6 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -106,7 +106,7 @@ func main() { b.Fatal(err) } }) - fmt.Print(fmt.Sprintf("%s-%s", signal, exporter)) + fmt.Printf("%s-%s", signal, exporter) fmt.Print("\t") fmt.Println(result.String()) } diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index 87b688cd..ed4a55ac 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -35,7 +35,7 @@ func Init() { func(server string) (err error) { if server != "" { Config.ServerURLOTLP, err = url.Parse(server) - Config.ServerURLOTLPHTTP, err = url.Parse(server) + Config.ServerURLOTLPHTTP = Config.ServerURLOTLP } return }) @@ -111,7 +111,9 @@ func setFlagsFromEnv() { } for k, v := range flagEnvMap { - flag.Set(k, getEnvOrDefault(v[0], v[1])) + if err := flag.Set(k, getEnvOrDefault(v[0], v[1])); err != nil { + panic(fmt.Errorf("error setting flag %q from env var %q with value %q: %w", k, v[0], v[1], err)) + } } } From 782540783109ac778f8eace8d575d2d0a6d213b5 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:47:54 +0000 Subject: [PATCH 33/51] Fix benchmark name printing --- loadgen/cmd/otelbench/main.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 06342af6..e026812d 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -51,6 +51,10 @@ func getExporters() (exporters []string) { return } +func fullBenchmarkName(signal, exporter string) string { + return fmt.Sprintf("%s-%s", signal, exporter) +} + func main() { Init() testing.Init() @@ -58,8 +62,16 @@ func main() { // TODO(carsonip): configurable warm up + var maxLen int + for _, signal := range getSignals() { + for _, exporter := range getExporters() { + maxLen = max(maxLen, len(fullBenchmarkName(signal, exporter))) + } + } + for _, signal := range getSignals() { for _, exporter := range getExporters() { + benchName := fullBenchmarkName(signal, exporter) result := testing.Benchmark(func(b *testing.B) { // TODO(carsonip): simulate > 1 agents for higher load // https://github.com/elastic/opentelemetry-collector-components/issues/305 @@ -106,9 +118,7 @@ func main() { b.Fatal(err) } }) - fmt.Printf("%s-%s", signal, exporter) - fmt.Print("\t") - fmt.Println(result.String()) + fmt.Printf("%-*s\t%s\n", maxLen, benchName, result.String()) } } } From 46777c6628086afac2db803a9cfc8f4ad3b2e2ca Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:51:36 +0000 Subject: [PATCH 34/51] Explain stdout --- loadgen/cmd/otelbench/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index e026812d..3458c5d3 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -118,6 +118,7 @@ func main() { b.Fatal(err) } }) + // write benchmark result to stdout, as stderr may be cluttered with collector logs fmt.Printf("%-*s\t%s\n", maxLen, benchName, result.String()) } } From 32f410ea24f3fa7bd5684d07f82f4e6bb6749178 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 22:52:53 +0000 Subject: [PATCH 35/51] Add TODO --- loadgen/cmd/otelbench/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index 3458c5d3..e4fc036d 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -109,6 +109,7 @@ func main() { b.ReportMetric(float64(stats.FailedMetricDataPoints)/elapsedSeconds, "failed_metric_points/s") b.ReportMetric(float64(stats.FailedSpans)/elapsedSeconds, "failed_spans/s") b.ReportMetric(float64(stats.FailedRequests)/elapsedSeconds, "failed_requests/s") + // TODO(carsonip): optionally retrieve metrics (e.g. memory, cpu) of target server from Elasticsearch close(stop) }() From 4fd0d45bd7d54c88fafdf45b0ecc7e5407b87152 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:09:16 +0000 Subject: [PATCH 36/51] Fix setFlagsFromEnv panic --- loadgen/cmd/otelbench/main.go | 7 ++++++- loadgen/cmd/otelbench/runner.go | 13 ++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index e4fc036d..abb074a9 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -21,6 +21,7 @@ import ( "context" "flag" "fmt" + "os" "testing" "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" @@ -56,8 +57,12 @@ func fullBenchmarkName(signal, exporter string) string { } func main() { - Init() testing.Init() + if err := Init(); err != nil { + fmt.Fprintln(os.Stderr, err) + flag.Usage() + os.Exit(2) + } flag.Parse() // TODO(carsonip): configurable warm up diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/runner.go index ed4a55ac..985c271f 100644 --- a/loadgen/cmd/otelbench/runner.go +++ b/loadgen/cmd/otelbench/runner.go @@ -27,7 +27,7 @@ var Config struct { ExporterOTLPHTTP bool } -func Init() { +func Init() error { // Server config flag.Func( "endpoint", @@ -89,7 +89,7 @@ func Init() { // For configs that can be set via environment variables, set the required // flags from env if they are not explicitly provided via command line - setFlagsFromEnv() + return setFlagsFromEnv() } func getAuthorizationHeaderValue(apiKey, secretToken string) string { @@ -101,7 +101,8 @@ func getAuthorizationHeaderValue(apiKey, secretToken string) string { return "" } -func setFlagsFromEnv() { +// setFlagsFromEnv sets flags from some Elastic APM env vars +func setFlagsFromEnv() error { // value[0] is environment key // value[1] is default value flagEnvMap := map[string][]string{ @@ -111,10 +112,12 @@ func setFlagsFromEnv() { } for k, v := range flagEnvMap { - if err := flag.Set(k, getEnvOrDefault(v[0], v[1])); err != nil { - panic(fmt.Errorf("error setting flag %q from env var %q with value %q: %w", k, v[0], v[1], err)) + envVarValue := getEnvOrDefault(v[0], v[1]) + if err := flag.Set(k, envVarValue); err != nil { + return fmt.Errorf("error setting flag \"-%s\" from env var %q with value %q: %w", k, v[0], envVarValue, err) } } + return nil } func getEnvOrDefault(name, defaultValue string) string { From 0dfb62752d5eea8cc38843c4a244fd4c30aa3bee Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:09:46 +0000 Subject: [PATCH 37/51] Rename --- loadgen/cmd/otelbench/{runner.go => flags.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename loadgen/cmd/otelbench/{runner.go => flags.go} (100%) diff --git a/loadgen/cmd/otelbench/runner.go b/loadgen/cmd/otelbench/flags.go similarity index 100% rename from loadgen/cmd/otelbench/runner.go rename to loadgen/cmd/otelbench/flags.go From c4c2fcf9345d9f6b01e8aabda2355889f3f12476 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:13:11 +0000 Subject: [PATCH 38/51] make license-update --- loadgen/cmd/otelbench/flags.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/loadgen/cmd/otelbench/flags.go b/loadgen/cmd/otelbench/flags.go index 985c271f..246c41ce 100644 --- a/loadgen/cmd/otelbench/flags.go +++ b/loadgen/cmd/otelbench/flags.go @@ -1,3 +1,20 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package main import ( From fafe428a3fce42cd22d97cc625498fa387a7bb18 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:15:24 +0000 Subject: [PATCH 39/51] make license-update, make porto --- receiver/loadgenreceiver/stats.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/receiver/loadgenreceiver/stats.go b/receiver/loadgenreceiver/stats.go index 7a5ede03..040e76d6 100644 --- a/receiver/loadgenreceiver/stats.go +++ b/receiver/loadgenreceiver/stats.go @@ -1,4 +1,21 @@ -package loadgenreceiver +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package loadgenreceiver // import "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" type TelemetryStats struct { Requests int From 8730735d829b55757c98017d674dd7549e3f6132 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:26:20 +0000 Subject: [PATCH 40/51] make -j2 gogenerate && make -j2 license-update --- receiver/loadgenreceiver/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receiver/loadgenreceiver/config.go b/receiver/loadgenreceiver/config.go index 02b71e17..c979dd89 100644 --- a/receiver/loadgenreceiver/config.go +++ b/receiver/loadgenreceiver/config.go @@ -36,7 +36,7 @@ type MetricsConfig struct { // JsonlFile is an optional configuration option to specify the path to // get the base generated signals from. JsonlFile `mapstructure:"jsonl_file"` - + // MaxReplay is an optional configuration to specify the number of times the file is replayed. MaxReplay int `mapstructure:"max_replay"` // doneCh is only non-nil when the receiver is created with NewFactoryWithDone. From 11d4b79e2de0341e3fa43d09624244d5db1f05ee Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:29:21 +0000 Subject: [PATCH 41/51] Fix links --- README.md | 2 +- loadgen/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8695465f..0f5c46a3 100644 --- a/README.md +++ b/README.md @@ -35,5 +35,5 @@ In order to build a collector with a custom component, e.g. for testing purposes ## Load generator -See [./loadgen/README.md](loadgen/cmd/otelsoak/README.md). +See [./loadgen/README.md](./loadgen/README.md). diff --git a/loadgen/README.md b/loadgen/README.md index 235f1362..32ca622a 100644 --- a/loadgen/README.md +++ b/loadgen/README.md @@ -1,10 +1,10 @@ # loadgen: OTel load generation tooling In `cmd/` directory, there are -- [otelsoak](./otelsoak/README.md) +- [otelsoak](./cmd/otelsoak/README.md) - Load generator that is exactly an OTel collector. It sends load to an endpoint and never terminates. - Suitable for soak testing -- [otelbench](./otelbench/README.md) +- [otelbench](./cmd/otelbench/README.md) - Load generator based on OTel collector and Go benchmarking. It sends load to an endpoint, terminates after a configured duration, and outputs statistics. - Suitable for benchmarking From 48ae64597a58b58fff72e3c2d973cb0d123383b0 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:33:41 +0000 Subject: [PATCH 42/51] Fix CI make otelsoak-validate --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 90a6cf6d..7e17f125 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -227,5 +227,5 @@ jobs: - uses: actions/checkout@v4 - name: Build testing component's collector and validate example configuration run: make elasticcol-validate - - name: Validate loadgen example config - run: make loadgen-validate + - name: Validate otelsoak example config + run: make otelsoak-validate From 4516b9802f886243a9e9e75e857b49b82db44565 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Thu, 16 Jan 2025 23:36:19 +0000 Subject: [PATCH 43/51] Rename TelemetryStats to Stats --- loadgen/cmd/otelbench/collector.go | 4 ++-- loadgen/cmd/otelbench/components.go | 2 +- loadgen/cmd/otelbench/main.go | 6 +++--- receiver/loadgenreceiver/config.go | 6 +++--- receiver/loadgenreceiver/factory.go | 4 ++-- receiver/loadgenreceiver/logs.go | 2 +- receiver/loadgenreceiver/metrics.go | 2 +- receiver/loadgenreceiver/stats.go | 5 +++-- receiver/loadgenreceiver/traces.go | 2 +- 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/loadgen/cmd/otelbench/collector.go b/loadgen/cmd/otelbench/collector.go index 36c30a06..23ffa96a 100644 --- a/loadgen/cmd/otelbench/collector.go +++ b/loadgen/cmd/otelbench/collector.go @@ -38,7 +38,7 @@ const ( buildVersion = "0.0.1" ) -func RunCollector(ctx context.Context, stop chan struct{}, configFiles []string, logsDone, metricsDone, tracesDone chan loadgenreceiver.TelemetryStats) error { +func RunCollector(ctx context.Context, stop chan struct{}, configFiles []string, logsDone, metricsDone, tracesDone chan loadgenreceiver.Stats) error { settings, err := NewCollectorSettings(configFiles, logsDone, metricsDone, tracesDone) if err != nil { return err @@ -60,7 +60,7 @@ func RunCollector(ctx context.Context, stop chan struct{}, configFiles []string, return svc.Run(cancelCtx) } -func NewCollectorSettings(configPaths []string, logsDone, metricsDone, tracesDone chan loadgenreceiver.TelemetryStats) (otelcol.CollectorSettings, error) { +func NewCollectorSettings(configPaths []string, logsDone, metricsDone, tracesDone chan loadgenreceiver.Stats) (otelcol.CollectorSettings, error) { buildInfo := component.BuildInfo{ Command: os.Args[0], Description: buildDescription, diff --git a/loadgen/cmd/otelbench/components.go b/loadgen/cmd/otelbench/components.go index d391ddf3..38772b26 100644 --- a/loadgen/cmd/otelbench/components.go +++ b/loadgen/cmd/otelbench/components.go @@ -35,7 +35,7 @@ import ( "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" ) -func components(logsDone, metricsDone, tracesDone chan loadgenreceiver.TelemetryStats) (otelcol.Factories, error) { +func components(logsDone, metricsDone, tracesDone chan loadgenreceiver.Stats) (otelcol.Factories, error) { var err error factories := otelcol.Factories{} diff --git a/loadgen/cmd/otelbench/main.go b/loadgen/cmd/otelbench/main.go index abb074a9..c16a153e 100644 --- a/loadgen/cmd/otelbench/main.go +++ b/loadgen/cmd/otelbench/main.go @@ -82,9 +82,9 @@ func main() { // https://github.com/elastic/opentelemetry-collector-components/issues/305 // loadgenreceiver will send stats about generated telemetry when it finishes sending b.N iterations - logsDone := make(chan loadgenreceiver.TelemetryStats) - metricsDone := make(chan loadgenreceiver.TelemetryStats) - tracesDone := make(chan loadgenreceiver.TelemetryStats) + logsDone := make(chan loadgenreceiver.Stats) + metricsDone := make(chan loadgenreceiver.Stats) + tracesDone := make(chan loadgenreceiver.Stats) if signal != "logs" { close(logsDone) } diff --git a/receiver/loadgenreceiver/config.go b/receiver/loadgenreceiver/config.go index c979dd89..e5b15964 100644 --- a/receiver/loadgenreceiver/config.go +++ b/receiver/loadgenreceiver/config.go @@ -41,7 +41,7 @@ type MetricsConfig struct { MaxReplay int `mapstructure:"max_replay"` // doneCh is only non-nil when the receiver is created with NewFactoryWithDone. // It is to notify the caller of collector that receiver finished replaying the file for MaxReplay number of times. - doneCh chan TelemetryStats + doneCh chan Stats } type LogsConfig struct { @@ -53,7 +53,7 @@ type LogsConfig struct { MaxReplay int `mapstructure:"max_replay"` // doneCh is only non-nil when the receiver is created with NewFactoryWithDone. // It is to notify the caller of collector that receiver finished replaying the file for MaxReplay number of times. - doneCh chan TelemetryStats + doneCh chan Stats } type TracesConfig struct { @@ -65,7 +65,7 @@ type TracesConfig struct { MaxReplay int `mapstructure:"max_replay"` // doneCh is only non-nil when the receiver is created with NewFactoryWithDone. // It is to notify the caller of collector that receiver finished replaying the file for MaxReplay number of times. - doneCh chan TelemetryStats + doneCh chan Stats } var _ component.Config = (*Config)(nil) diff --git a/receiver/loadgenreceiver/factory.go b/receiver/loadgenreceiver/factory.go index 388f2cb7..18cdaf65 100644 --- a/receiver/loadgenreceiver/factory.go +++ b/receiver/loadgenreceiver/factory.go @@ -36,7 +36,7 @@ func NewFactory() receiver.Factory { ) } -func createDefaultReceiverConfig(logsDone, metricsDone, tracesDone chan TelemetryStats) component.Config { +func createDefaultReceiverConfig(logsDone, metricsDone, tracesDone chan Stats) component.Config { return &Config{ Logs: LogsConfig{ doneCh: logsDone, @@ -50,7 +50,7 @@ func createDefaultReceiverConfig(logsDone, metricsDone, tracesDone chan Telemetr } } -func NewFactoryWithDone(logsDone, metricsDone, tracesDone chan TelemetryStats) receiver.Factory { +func NewFactoryWithDone(logsDone, metricsDone, tracesDone chan Stats) receiver.Factory { return receiver.NewFactory( metadata.Type, func() component.Config { diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index c5e14dbd..66584967 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -44,7 +44,7 @@ type logsGenerator struct { samples internal.LoopingList[plog.Logs] - stats TelemetryStats + stats Stats consumer consumer.Logs diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index dfd3efdc..29679eee 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -44,7 +44,7 @@ type metricsGenerator struct { samples internal.LoopingList[pmetric.Metrics] - stats TelemetryStats + stats Stats consumer consumer.Metrics diff --git a/receiver/loadgenreceiver/stats.go b/receiver/loadgenreceiver/stats.go index 040e76d6..be2f059d 100644 --- a/receiver/loadgenreceiver/stats.go +++ b/receiver/loadgenreceiver/stats.go @@ -17,7 +17,8 @@ package loadgenreceiver // import "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" -type TelemetryStats struct { +// Stats holds statistics about telemetry generated and sent by loadgenreceiver +type Stats struct { Requests int FailedRequests int @@ -30,7 +31,7 @@ type TelemetryStats struct { FailedSpans int } -func (s TelemetryStats) Add(other TelemetryStats) TelemetryStats { +func (s Stats) Add(other Stats) Stats { s.Requests += other.Requests s.FailedRequests += other.FailedRequests s.LogRecords += other.LogRecords diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index f498dccc..6826a936 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -44,7 +44,7 @@ type tracesGenerator struct { samples internal.LoopingList[ptrace.Traces] - stats TelemetryStats + stats Stats consumer consumer.Traces From ded56bcf4d561ae5d2959de9b5a40646d6c89e21 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 10:11:02 +0000 Subject: [PATCH 44/51] Handle MaxReplay==0 --- receiver/loadgenreceiver/logs.go | 2 +- receiver/loadgenreceiver/metrics.go | 2 +- receiver/loadgenreceiver/traces.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index 66584967..07202e99 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -147,5 +147,5 @@ func (ar *logsGenerator) nextLogs() plog.Logs { } func (ar *logsGenerator) isDone() bool { - return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() >= ar.cfg.Logs.MaxReplay + return ar.cfg.Logs.MaxReplay > 0 && ar.samples.LoopCount() >= ar.cfg.Logs.MaxReplay } diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index 29679eee..9ce3a24a 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -179,5 +179,5 @@ func (ar *metricsGenerator) nextMetrics() pmetric.Metrics { } func (ar *metricsGenerator) isDone() bool { - return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() >= ar.cfg.Metrics.MaxReplay + return ar.cfg.Metrics.MaxReplay > 0 && ar.samples.LoopCount() >= ar.cfg.Metrics.MaxReplay } diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index 6826a936..26207516 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -149,5 +149,5 @@ func (ar *tracesGenerator) nextTraces() ptrace.Traces { } func (ar *tracesGenerator) isDone() bool { - return ar.samples.LoopCount() > 0 && ar.samples.LoopCount() >= ar.cfg.Traces.MaxReplay + return ar.cfg.Traces.MaxReplay > 0 && ar.samples.LoopCount() >= ar.cfg.Traces.MaxReplay } From 39969eb4c3a7d4d57956299db3948fccb082e7a2 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 10:11:40 +0000 Subject: [PATCH 45/51] Update loadgen/README.md Co-authored-by: Andrew Wilkins --- loadgen/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loadgen/README.md b/loadgen/README.md index 32ca622a..5af837b6 100644 --- a/loadgen/README.md +++ b/loadgen/README.md @@ -8,4 +8,4 @@ In `cmd/` directory, there are - Load generator based on OTel collector and Go benchmarking. It sends load to an endpoint, terminates after a configured duration, and outputs statistics. - Suitable for benchmarking -otelsoak and otelbench is synonymous to apmsoak and apmbench in [elastic/apm-perf](https://github.com/elastic/apm-perf). +otelsoak and otelbench are synonymous to apmsoak and apmbench in [elastic/apm-perf](https://github.com/elastic/apm-perf). From 4ba980c3d52fa694960d6a0aac5c83fc70544ca4 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 10:11:48 +0000 Subject: [PATCH 46/51] Update loadgen/cmd/otelbench/README.md Co-authored-by: Andrew Wilkins --- loadgen/cmd/otelbench/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loadgen/cmd/otelbench/README.md b/loadgen/cmd/otelbench/README.md index c5e79b3f..75f098f0 100644 --- a/loadgen/cmd/otelbench/README.md +++ b/loadgen/cmd/otelbench/README.md @@ -1,6 +1,6 @@ # otelbench -otelbench wraps the collector inside a Go test benchmark. It outputs throughput numbers in standard Go benchmark format. It uses a collector config yaml as a base, and apply some overrides from command line options. +otelbench wraps the collector inside a Go test benchmark. It outputs throughput numbers in standard Go benchmark format. It uses a collector config yaml as a base, and applies some overrides from command line options. ## Usage From d78460e2d9d54909f6f68943d970de7c44b32d1b Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 10:12:11 +0000 Subject: [PATCH 47/51] Update receiver/loadgenreceiver/factory.go Co-authored-by: Andrew Wilkins --- receiver/loadgenreceiver/factory.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/receiver/loadgenreceiver/factory.go b/receiver/loadgenreceiver/factory.go index 18cdaf65..63cef4b2 100644 --- a/receiver/loadgenreceiver/factory.go +++ b/receiver/loadgenreceiver/factory.go @@ -25,15 +25,7 @@ import ( ) func NewFactory() receiver.Factory { - return receiver.NewFactory( - metadata.Type, - func() component.Config { - return createDefaultReceiverConfig(nil, nil, nil) - }, - receiver.WithMetrics(createMetricsReceiver, component.StabilityLevelDevelopment), - receiver.WithTraces(createTracesReceiver, component.StabilityLevelDevelopment), - receiver.WithLogs(createLogsReceiver, component.StabilityLevelDevelopment), - ) + return NewFactoryWithDone(nil, nil, nil) } func createDefaultReceiverConfig(logsDone, metricsDone, tracesDone chan Stats) component.Config { From 3fca7c893082d7fff6d617e109db888b4ff7b4ec Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 10:24:23 +0000 Subject: [PATCH 48/51] Update flag usage --- loadgen/cmd/otelbench/README.md | 4 ++-- loadgen/cmd/otelbench/flags.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/loadgen/cmd/otelbench/README.md b/loadgen/cmd/otelbench/README.md index 75f098f0..cfd3bd2b 100644 --- a/loadgen/cmd/otelbench/README.md +++ b/loadgen/cmd/otelbench/README.md @@ -9,7 +9,7 @@ Usage of ./otelbench: -api-key string API key for target server -config string - path collector config yaml (default "config.yaml") + path to collector config yaml (default "config.yaml") -endpoint value target server endpoint for both otlp and otlphttp exporters (default to value in config yaml), equivalent to setting both -endpoint-otlp and -endpoint-otlphttp -endpoint-otlp value @@ -21,7 +21,7 @@ Usage of ./otelbench: -exporter-otlphttp benchmark exporter otlphttp (default true) -header value - extra headers to use when sending data to the server + extra headers in key=value format when sending data to the server. Can be repeated. e.g. -header X-FIRST-HEADER=foo -header X-SECOND-HEADER=bar -insecure disable TLS, ignored by otlphttp exporter (default to value in config yaml) -insecure-skip-verify diff --git a/loadgen/cmd/otelbench/flags.go b/loadgen/cmd/otelbench/flags.go index 246c41ce..f479ad4c 100644 --- a/loadgen/cmd/otelbench/flags.go +++ b/loadgen/cmd/otelbench/flags.go @@ -81,7 +81,7 @@ func Init() error { flag.BoolVar(&Config.InsecureSkipVerify, "insecure-skip-verify", false, "skip validating the remote server TLS certificates (default to value in config yaml)") flag.Func("header", - "extra headers to use when sending data to the server", + "extra headers in key=value format when sending data to the server. Can be repeated. e.g. -header X-FIRST-HEADER=foo -header X-SECOND-HEADER=bar", func(s string) error { k, v, ok := strings.Cut(s, "=") if !ok { @@ -95,7 +95,7 @@ func Init() error { }, ) - flag.StringVar(&Config.CollectorConfigPath, "config", "config.yaml", "path collector config yaml") + flag.StringVar(&Config.CollectorConfigPath, "config", "config.yaml", "path to collector config yaml") flag.BoolVar(&Config.ExporterOTLP, "exporter-otlp", true, "benchmark exporter otlp") flag.BoolVar(&Config.ExporterOTLPHTTP, "exporter-otlphttp", true, "benchmark exporter otlphttp") From 5b550ae44bcd3b26ea9014a5ab47d22e7232ae7e Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 11:12:22 +0000 Subject: [PATCH 49/51] Add test and fix scanner token too long --- receiver/loadgenreceiver/logs.go | 4 ++ receiver/loadgenreceiver/logs_test.go | 52 ++++++++++++++++++++++++ receiver/loadgenreceiver/metrics.go | 4 ++ receiver/loadgenreceiver/metrics_test.go | 52 ++++++++++++++++++++++++ receiver/loadgenreceiver/traces.go | 6 +++ receiver/loadgenreceiver/traces_test.go | 52 ++++++++++++++++++++++++ 6 files changed, 170 insertions(+) create mode 100644 receiver/loadgenreceiver/logs_test.go create mode 100644 receiver/loadgenreceiver/metrics_test.go create mode 100644 receiver/loadgenreceiver/traces_test.go diff --git a/receiver/loadgenreceiver/logs.go b/receiver/loadgenreceiver/logs.go index 07202e99..ce5f14da 100644 --- a/receiver/loadgenreceiver/logs.go +++ b/receiver/loadgenreceiver/logs.go @@ -72,6 +72,7 @@ func createLogsReceiver( var samples []plog.Logs scanner := bufio.NewScanner(bytes.NewReader(sampleLogs)) + scanner.Buffer(make([]byte, 0, maxScannerBufSize), maxScannerBufSize) for scanner.Scan() { logBytes := scanner.Bytes() lineLogs, err := parser.UnmarshalLogs(logBytes) @@ -80,6 +81,9 @@ func createLogsReceiver( } samples = append(samples, lineLogs) } + if err := scanner.Err(); err != nil { + return nil, err + } return &logsGenerator{ cfg: genConfig, diff --git a/receiver/loadgenreceiver/logs_test.go b/receiver/loadgenreceiver/logs_test.go new file mode 100644 index 00000000..9fcdffa9 --- /dev/null +++ b/receiver/loadgenreceiver/logs_test.go @@ -0,0 +1,52 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package loadgenreceiver // import "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" + +import ( + "bytes" + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.uber.org/zap" +) + +func TestLogsGenerator_doneCh(t *testing.T) { + const maxReplay = 2 + doneCh := make(chan Stats) + sink := &consumertest.LogsSink{} + r, _ := createLogsReceiver(context.Background(), receiver.Settings{ + ID: component.ID{}, + TelemetrySettings: component.TelemetrySettings{ + Logger: zap.NewNop(), + }, + BuildInfo: component.BuildInfo{}, + }, &Config{Logs: LogsConfig{ + MaxReplay: maxReplay, + doneCh: doneCh, + }}, sink) + err := r.Start(context.Background(), componenttest.NewNopHost()) + assert.NoError(t, err) + defer r.Shutdown(context.Background()) + stats := <-doneCh + assert.Equal(t, maxReplay*bytes.Count(demoLogs, []byte("\n")), stats.Requests) +} diff --git a/receiver/loadgenreceiver/metrics.go b/receiver/loadgenreceiver/metrics.go index 9ce3a24a..a9c31f82 100644 --- a/receiver/loadgenreceiver/metrics.go +++ b/receiver/loadgenreceiver/metrics.go @@ -72,6 +72,7 @@ func createMetricsReceiver( var samples []pmetric.Metrics scanner := bufio.NewScanner(bytes.NewReader(sampleMetrics)) + scanner.Buffer(make([]byte, 0, maxScannerBufSize), maxScannerBufSize) for scanner.Scan() { metricBytes := scanner.Bytes() lineMetrics, err := parser.UnmarshalMetrics(metricBytes) @@ -80,6 +81,9 @@ func createMetricsReceiver( } samples = append(samples, lineMetrics) } + if err := scanner.Err(); err != nil { + return nil, err + } return &metricsGenerator{ cfg: genConfig, diff --git a/receiver/loadgenreceiver/metrics_test.go b/receiver/loadgenreceiver/metrics_test.go new file mode 100644 index 00000000..b731da3e --- /dev/null +++ b/receiver/loadgenreceiver/metrics_test.go @@ -0,0 +1,52 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package loadgenreceiver // import "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" + +import ( + "bytes" + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.uber.org/zap" +) + +func TestMetricsGenerator_doneCh(t *testing.T) { + const maxReplay = 2 + doneCh := make(chan Stats) + sink := &consumertest.MetricsSink{} + r, _ := createMetricsReceiver(context.Background(), receiver.Settings{ + ID: component.ID{}, + TelemetrySettings: component.TelemetrySettings{ + Logger: zap.NewNop(), + }, + BuildInfo: component.BuildInfo{}, + }, &Config{Metrics: MetricsConfig{ + MaxReplay: maxReplay, + doneCh: doneCh, + }}, sink) + err := r.Start(context.Background(), componenttest.NewNopHost()) + assert.NoError(t, err) + defer r.Shutdown(context.Background()) + stats := <-doneCh + assert.Equal(t, maxReplay*bytes.Count(demoMetrics, []byte("\n")), stats.Requests) +} diff --git a/receiver/loadgenreceiver/traces.go b/receiver/loadgenreceiver/traces.go index 26207516..80426f19 100644 --- a/receiver/loadgenreceiver/traces.go +++ b/receiver/loadgenreceiver/traces.go @@ -35,6 +35,8 @@ import ( "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver/internal" ) +const maxScannerBufSize = 1024 * 1024 + //go:embed testdata/traces.jsonl var demoTraces []byte @@ -72,6 +74,7 @@ func createTracesReceiver( var samples []ptrace.Traces scanner := bufio.NewScanner(bytes.NewReader(sampleTraces)) + scanner.Buffer(make([]byte, 0, maxScannerBufSize), maxScannerBufSize) for scanner.Scan() { traceBytes := scanner.Bytes() lineTraces, err := parser.UnmarshalTraces(traceBytes) @@ -80,6 +83,9 @@ func createTracesReceiver( } samples = append(samples, lineTraces) } + if err := scanner.Err(); err != nil { + return nil, err + } return &tracesGenerator{ cfg: genConfig, diff --git a/receiver/loadgenreceiver/traces_test.go b/receiver/loadgenreceiver/traces_test.go new file mode 100644 index 00000000..6898603d --- /dev/null +++ b/receiver/loadgenreceiver/traces_test.go @@ -0,0 +1,52 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package loadgenreceiver // import "github.com/elastic/opentelemetry-collector-components/receiver/loadgenreceiver" + +import ( + "bytes" + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.uber.org/zap" +) + +func TestTracesGenerator_doneCh(t *testing.T) { + const maxReplay = 2 + doneCh := make(chan Stats) + sink := &consumertest.TracesSink{} + r, _ := createTracesReceiver(context.Background(), receiver.Settings{ + ID: component.ID{}, + TelemetrySettings: component.TelemetrySettings{ + Logger: zap.NewNop(), + }, + BuildInfo: component.BuildInfo{}, + }, &Config{Traces: TracesConfig{ + MaxReplay: maxReplay, + doneCh: doneCh, + }}, sink) + err := r.Start(context.Background(), componenttest.NewNopHost()) + assert.NoError(t, err) + defer r.Shutdown(context.Background()) + stats := <-doneCh + assert.Equal(t, maxReplay*bytes.Count(demoTraces, []byte("\n")), stats.Requests) +} From 55628ae71a62bf4b240c49edd7eaa79a4e7f6fbb Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 11:22:29 +0000 Subject: [PATCH 50/51] make lint --- receiver/loadgenreceiver/logs_test.go | 4 +++- receiver/loadgenreceiver/metrics_test.go | 4 +++- receiver/loadgenreceiver/traces_test.go | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/receiver/loadgenreceiver/logs_test.go b/receiver/loadgenreceiver/logs_test.go index 9fcdffa9..ad07bfb8 100644 --- a/receiver/loadgenreceiver/logs_test.go +++ b/receiver/loadgenreceiver/logs_test.go @@ -46,7 +46,9 @@ func TestLogsGenerator_doneCh(t *testing.T) { }}, sink) err := r.Start(context.Background(), componenttest.NewNopHost()) assert.NoError(t, err) - defer r.Shutdown(context.Background()) + defer func() { + assert.NoError(t, r.Shutdown(context.Background())) + }() stats := <-doneCh assert.Equal(t, maxReplay*bytes.Count(demoLogs, []byte("\n")), stats.Requests) } diff --git a/receiver/loadgenreceiver/metrics_test.go b/receiver/loadgenreceiver/metrics_test.go index b731da3e..630e5b58 100644 --- a/receiver/loadgenreceiver/metrics_test.go +++ b/receiver/loadgenreceiver/metrics_test.go @@ -46,7 +46,9 @@ func TestMetricsGenerator_doneCh(t *testing.T) { }}, sink) err := r.Start(context.Background(), componenttest.NewNopHost()) assert.NoError(t, err) - defer r.Shutdown(context.Background()) + defer func() { + assert.NoError(t, r.Shutdown(context.Background())) + }() stats := <-doneCh assert.Equal(t, maxReplay*bytes.Count(demoMetrics, []byte("\n")), stats.Requests) } diff --git a/receiver/loadgenreceiver/traces_test.go b/receiver/loadgenreceiver/traces_test.go index 6898603d..8d19d7bd 100644 --- a/receiver/loadgenreceiver/traces_test.go +++ b/receiver/loadgenreceiver/traces_test.go @@ -46,7 +46,9 @@ func TestTracesGenerator_doneCh(t *testing.T) { }}, sink) err := r.Start(context.Background(), componenttest.NewNopHost()) assert.NoError(t, err) - defer r.Shutdown(context.Background()) + defer func() { + assert.NoError(t, r.Shutdown(context.Background())) + }() stats := <-doneCh assert.Equal(t, maxReplay*bytes.Count(demoTraces, []byte("\n")), stats.Requests) } From d72aa29333d0c294f7ebf5106f27121601fd6557 Mon Sep 17 00:00:00 2001 From: Carson Ip Date: Fri, 17 Jan 2025 11:30:12 +0000 Subject: [PATCH 51/51] Assert more --- receiver/loadgenreceiver/logs_test.go | 5 ++++- receiver/loadgenreceiver/metrics_test.go | 5 ++++- receiver/loadgenreceiver/traces_test.go | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/receiver/loadgenreceiver/logs_test.go b/receiver/loadgenreceiver/logs_test.go index ad07bfb8..dc08e48a 100644 --- a/receiver/loadgenreceiver/logs_test.go +++ b/receiver/loadgenreceiver/logs_test.go @@ -50,5 +50,8 @@ func TestLogsGenerator_doneCh(t *testing.T) { assert.NoError(t, r.Shutdown(context.Background())) }() stats := <-doneCh - assert.Equal(t, maxReplay*bytes.Count(demoLogs, []byte("\n")), stats.Requests) + want := maxReplay * bytes.Count(demoLogs, []byte("\n")) + assert.Equal(t, want, stats.Requests) + assert.Equal(t, want, len(sink.AllLogs())) + assert.Equal(t, sink.LogRecordCount(), stats.LogRecords) } diff --git a/receiver/loadgenreceiver/metrics_test.go b/receiver/loadgenreceiver/metrics_test.go index 630e5b58..e7ee4350 100644 --- a/receiver/loadgenreceiver/metrics_test.go +++ b/receiver/loadgenreceiver/metrics_test.go @@ -50,5 +50,8 @@ func TestMetricsGenerator_doneCh(t *testing.T) { assert.NoError(t, r.Shutdown(context.Background())) }() stats := <-doneCh - assert.Equal(t, maxReplay*bytes.Count(demoMetrics, []byte("\n")), stats.Requests) + want := maxReplay * bytes.Count(demoMetrics, []byte("\n")) + assert.Equal(t, want, stats.Requests) + assert.Equal(t, want, len(sink.AllMetrics())) + assert.Equal(t, sink.DataPointCount(), stats.MetricDataPoints) } diff --git a/receiver/loadgenreceiver/traces_test.go b/receiver/loadgenreceiver/traces_test.go index 8d19d7bd..c191ee36 100644 --- a/receiver/loadgenreceiver/traces_test.go +++ b/receiver/loadgenreceiver/traces_test.go @@ -50,5 +50,8 @@ func TestTracesGenerator_doneCh(t *testing.T) { assert.NoError(t, r.Shutdown(context.Background())) }() stats := <-doneCh - assert.Equal(t, maxReplay*bytes.Count(demoTraces, []byte("\n")), stats.Requests) + want := maxReplay * bytes.Count(demoTraces, []byte("\n")) + assert.Equal(t, want, stats.Requests) + assert.Equal(t, want, len(sink.AllTraces())) + assert.Equal(t, sink.SpanCount(), stats.Spans) }