diff --git a/cmd/apmbench/main.go b/cmd/apmbench/main.go index 0601c10..41fe71a 100644 --- a/cmd/apmbench/main.go +++ b/cmd/apmbench/main.go @@ -94,9 +94,11 @@ func main() { ); err != nil { logger.Fatal("failed to run benchmarks", zap.Error(err)) } + logger.Info("finished running benchmarks") // If server-mode is enabled then keep the otel collector running if cfg.ServerMode { + logger.Info("continuing to serve OTEL collector endpoints") c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) <-c diff --git a/go.mod b/go.mod index bdead88..3397583 100644 --- a/go.mod +++ b/go.mod @@ -13,14 +13,18 @@ require ( go.elastic.co/apm/v2 v2.4.1 go.elastic.co/ecszap v1.0.1 go.elastic.co/fastjson v1.1.0 - go.opentelemetry.io/collector v0.83.0 - go.opentelemetry.io/collector/component v0.83.0 - go.opentelemetry.io/collector/config/configtelemetry v0.83.0 - go.opentelemetry.io/collector/consumer v0.83.0 - go.opentelemetry.io/collector/exporter v0.83.0 + go.opentelemetry.io/collector v0.84.0 + go.opentelemetry.io/collector/component v0.84.0 + go.opentelemetry.io/collector/config/configgrpc v0.83.0 + go.opentelemetry.io/collector/config/configopaque v0.83.0 + go.opentelemetry.io/collector/config/configtelemetry v0.84.0 + go.opentelemetry.io/collector/consumer v0.84.0 + go.opentelemetry.io/collector/exporter v0.84.0 + go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0 go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 - go.opentelemetry.io/collector/processor v0.83.0 - go.opentelemetry.io/collector/receiver v0.83.0 + go.opentelemetry.io/collector/processor v0.84.0 + go.opentelemetry.io/collector/processor/batchprocessor v0.84.0 + go.opentelemetry.io/collector/receiver v0.84.0 go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 @@ -53,8 +57,8 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/google/uuid v1.3.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jcchavezs/porto v0.1.0 // indirect github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect @@ -91,18 +95,16 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/collector/config/configauth v0.83.0 // indirect go.opentelemetry.io/collector/config/configcompression v0.83.0 // indirect - go.opentelemetry.io/collector/config/configgrpc v0.83.0 // indirect go.opentelemetry.io/collector/config/confighttp v0.83.0 // indirect - go.opentelemetry.io/collector/config/confignet v0.83.0 // indirect - go.opentelemetry.io/collector/config/configopaque v0.83.0 // indirect + go.opentelemetry.io/collector/config/confignet v0.84.0 // indirect go.opentelemetry.io/collector/config/configtls v0.83.0 // indirect go.opentelemetry.io/collector/config/internal v0.83.0 // indirect - go.opentelemetry.io/collector/confmap v0.83.0 // indirect - go.opentelemetry.io/collector/connector v0.83.0 // indirect - go.opentelemetry.io/collector/extension v0.83.0 // indirect + go.opentelemetry.io/collector/confmap v0.84.0 // indirect + go.opentelemetry.io/collector/connector v0.84.0 // indirect + go.opentelemetry.io/collector/extension v0.84.0 // indirect go.opentelemetry.io/collector/extension/auth v0.83.0 // indirect go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 // indirect - go.opentelemetry.io/collector/semconv v0.83.0 // indirect + go.opentelemetry.io/collector/semconv v0.84.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.17.0 // indirect @@ -112,6 +114,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.39.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 // indirect @@ -125,9 +128,9 @@ require ( golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.12.0 // indirect golang.org/x/tools v0.7.0 // indirect - gonum.org/v1/gonum v0.13.0 // indirect - google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect + gonum.org/v1/gonum v0.14.0 // indirect + google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 8745431..2f4a8d6 100644 --- a/go.sum +++ b/go.sum @@ -213,14 +213,15 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -475,10 +476,10 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/collector v0.83.0 h1:rKFch1CANepajPwBTvzYj/hKz7RsMyUkPPPNjRCpJ/I= -go.opentelemetry.io/collector v0.83.0/go.mod h1:MNN79VDXXaRP2ZqcDVOfWH0Jl8BbcMttJ3SY/pU6vxo= -go.opentelemetry.io/collector/component v0.83.0 h1:7bMbOHQezVx9RhSLu9KQRBhjXmO+CbOVhBk5uySb0fY= -go.opentelemetry.io/collector/component v0.83.0/go.mod h1:Qy2mIP32UKN1x8rsjJbkgB9obAVu4hRusc1wKNFeV+o= +go.opentelemetry.io/collector v0.84.0 h1:zzsegdPlDR0iJufPsHTJhXkv9q2kbpTTTI6nTyya2wA= +go.opentelemetry.io/collector v0.84.0/go.mod h1:+cv/zxludfiiDuK3z+5eXkxAJhkCCcy8Chtvv0nOlr0= +go.opentelemetry.io/collector/component v0.84.0 h1:bh4Is5Z7TjuyF7Mab0rSNh2q3y15fImdNDRXqrqGlbA= +go.opentelemetry.io/collector/component v0.84.0/go.mod h1:uXteRaacYXXYhzeCJe5ClLz5gLzleXWz01IZ730w7FA= go.opentelemetry.io/collector/config/configauth v0.83.0 h1:caIkUszP+kTRVx9HW6z7x05CMnzlaBoP2BKyWDIr2ag= go.opentelemetry.io/collector/config/configauth v0.83.0/go.mod h1:PqSIaQryPWiPVMuxlNPEvTpuvhdRq8ySN9nKlk3YbH4= go.opentelemetry.io/collector/config/configcompression v0.83.0 h1:WwGfHyGey8JSUsBGUmRHaOzwllrLmsjjo5SZCYfSP14= @@ -487,41 +488,45 @@ go.opentelemetry.io/collector/config/configgrpc v0.83.0 h1:bmX6M/L0+gtBSqAvPGh2c go.opentelemetry.io/collector/config/configgrpc v0.83.0/go.mod h1:VpRhSIukmgVjx0HISN5r+y6EYQNGDYLU8j8hVUlcMjc= go.opentelemetry.io/collector/config/confighttp v0.83.0 h1:yBra00XanzqXL0kLs3Aaas7RLoL50bM/Za8223vwJik= go.opentelemetry.io/collector/config/confighttp v0.83.0/go.mod h1:Eu2WVZa8cy3F8mlxXIFPgzeAeLnaVc5UZzcEtufrOWs= -go.opentelemetry.io/collector/config/confignet v0.83.0 h1:xaQkMXvId8y7o6ke2qVRZZDqNc315CGkIcZ6LSVxDE0= -go.opentelemetry.io/collector/config/confignet v0.83.0/go.mod h1:I0iJQDhns1GgXBIumB64WHLPMmJpNdDaEDHQnmaaqsU= +go.opentelemetry.io/collector/config/confignet v0.84.0 h1:AGaAdhKgV/lxNxHL/RqqpKjVGuIPSO8whTZyBbP3KK0= +go.opentelemetry.io/collector/config/confignet v0.84.0/go.mod h1:cpO8JYWGONaViOygKVw+Hd2UoBcn2cUiyi0WWeFTwJY= go.opentelemetry.io/collector/config/configopaque v0.83.0 h1:nhYguW1zVFnQlaZWhwbXJS4/+WEPdQSEL8kTF/j/zeI= go.opentelemetry.io/collector/config/configopaque v0.83.0/go.mod h1:Ga1x7xLQXWmwxfW1pPqjI4qT+eNxf9wu2/Mx7O2u01U= -go.opentelemetry.io/collector/config/configtelemetry v0.83.0 h1:Dx+POy68CFsec9JDYd7cxQPULLfSOAG8ma5Jl3ZZ3+Y= -go.opentelemetry.io/collector/config/configtelemetry v0.83.0/go.mod h1:8wZuTKLdcWwdB82Jd07TOHsHKuv8l47T+MUGEsPe4z4= +go.opentelemetry.io/collector/config/configtelemetry v0.84.0 h1:pnZiYtppJN6SlzJNcrkA8R+Ur63e33qMO260m8JbK18= +go.opentelemetry.io/collector/config/configtelemetry v0.84.0/go.mod h1:+LAXM5WFMW/UbTlAuSs6L/W72WC+q8TBJt/6z39FPOU= go.opentelemetry.io/collector/config/configtls v0.83.0 h1:qeAqwvw7qs3fY8wVZzN54E+SNMES7YdATY0ASEbJlUw= go.opentelemetry.io/collector/config/configtls v0.83.0/go.mod h1:YMf+YSUhPB/LD5pZSyb3wRi7x6vbiMbONXOWFQnJnZ4= go.opentelemetry.io/collector/config/internal v0.83.0 h1:yQZegCOPl4dWUVkr/fscVFU/AjANT5+Tu5XpKztTTSA= go.opentelemetry.io/collector/config/internal v0.83.0/go.mod h1:BQs+X52s4BCIshht8qgbT4dqCM5YM2h6RQWln6zWhRA= -go.opentelemetry.io/collector/confmap v0.83.0 h1:eUaiFdhTLkFdNpMi5FLSHSQ6X2FcEHe0KfEUt9ZtVlI= -go.opentelemetry.io/collector/confmap v0.83.0/go.mod h1:ZsmLyJ+4VeO+qz5o1RKadRoY4Db+d8PYwiLCJ3Z5Et8= -go.opentelemetry.io/collector/connector v0.83.0 h1:wUxpqBTjJ9WSgZnosU26ALGYtwPVzEQxQk7w+mKSOs4= -go.opentelemetry.io/collector/connector v0.83.0/go.mod h1:o9xnA7C+2JzYQMSyWIJz/28tc3lGs3JkKLpckpAdzB8= -go.opentelemetry.io/collector/consumer v0.83.0 h1:8wg0UfFxxaGYsTkQGWuf1pE7C/dTvPkkYmBtR6N5BKc= -go.opentelemetry.io/collector/consumer v0.83.0/go.mod h1:YLbmTqvgIOYUlEeWun8wQ4RZ0HaYjsABWKw7nwU9F3c= -go.opentelemetry.io/collector/exporter v0.83.0 h1:1MPrMaCFvEvl291pAE0hTgPb7YybjSak9O5akzXqnXs= -go.opentelemetry.io/collector/exporter v0.83.0/go.mod h1:5XIrrkfRI7Ndt5FnH0CC6It0VxTHRviGv/I350EWGBs= -go.opentelemetry.io/collector/extension v0.83.0 h1:O47qpJTeav6jATvnIUvUrO5KBMqa6ySMA5i+7XXW7GY= -go.opentelemetry.io/collector/extension v0.83.0/go.mod h1:gPfwNimQiscUpaUGC/pUniTn4b5O+8IxHVKHDUkGqSI= +go.opentelemetry.io/collector/confmap v0.84.0 h1:fS62yIRrsTQwe1gyuEc8TQM0yUNfSAzPVi0A1665ZpQ= +go.opentelemetry.io/collector/confmap v0.84.0/go.mod h1:/SNHqYkLagF0TjBjQyCy2Gt3ZF6hTK8VKbaan/ZHuJs= +go.opentelemetry.io/collector/connector v0.84.0 h1:glvKR5FCHX/KuXKrItzVhSNaP3/n19LHrewaaFaRnWI= +go.opentelemetry.io/collector/connector v0.84.0/go.mod h1:VzBR1lHPntgGZkTYry35xyEtJLeHB8nQ/pcEeSt54H0= +go.opentelemetry.io/collector/consumer v0.84.0 h1:sz8mXIdPACJArlRyFNXA1SScVoo954IU1qp9V78VUxc= +go.opentelemetry.io/collector/consumer v0.84.0/go.mod h1:Mu+KeuorwHHWd6iGxU7DMAhgsHZmmzmQgf3sSWkugmM= +go.opentelemetry.io/collector/exporter v0.84.0 h1:OWvHJghs7/R6Qwr2fh7HrgEqsIUbCgLddLQsmqN95kM= +go.opentelemetry.io/collector/exporter v0.84.0/go.mod h1:Bz7MTaVosTIz6ZISszKYLDOewjathUJuVgT5W4Ee/wU= +go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0 h1:k5bJVlXJCJGraslJtOcQPELbRE3gB5MCzzvYurp5aF4= +go.opentelemetry.io/collector/exporter/otlpexporter v0.83.0/go.mod h1:MIGlrd6rhbfsRUgFqGfu7xWfBlG72ZFNGUj2ZR53LGE= +go.opentelemetry.io/collector/extension v0.84.0 h1:HN4otmncTE/eaeRcvBGTf0ApcX+dIQWsnShs6bgiKYA= +go.opentelemetry.io/collector/extension v0.84.0/go.mod h1:FoUzonXMAjVbFuSLM06F1260iVcbnMLMAEQk/xBfN1Y= go.opentelemetry.io/collector/extension/auth v0.83.0 h1:H0orp7a7/NZae4/ymnC5JpuvO6GNcGLNz+nEDAw9ciU= go.opentelemetry.io/collector/extension/auth v0.83.0/go.mod h1:Br0OyLU0p+2xS0UvQRvgWmH0Kv/4kPkNVr9AMzee5GM= -go.opentelemetry.io/collector/extension/zpagesextension v0.83.0 h1:a2Avt+yjaJbHPbiST3I/4GgfxrB3iEpTtgIEGermItw= +go.opentelemetry.io/collector/extension/zpagesextension v0.84.0 h1:huytVHKFVKDQBnLvy5tL/AUmzE3ydOwPClOZq1iZp50= go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 h1:C9o0mbP0MyygqFnKueVQK/v9jef6zvuttmTGlKaqhgw= go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014/go.mod h1:0mE3mDLmUrOXVoNsuvj+7dV14h/9HFl/Fy9YTLoLObo= go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 h1:iT5qH0NLmkGeIdDtnBogYDx7L58t6CaWGL378DEo2QY= go.opentelemetry.io/collector/pdata v1.0.0-rcv0014/go.mod h1:BRvDrx43kiSoUx3mr7SoA7h9B8+OY99mUK+CZSQFWW4= -go.opentelemetry.io/collector/processor v0.83.0 h1:oWMpPzHLkzlPXRIa27UsfsaDSbXaF/0qeiCn3BaesGo= -go.opentelemetry.io/collector/processor v0.83.0/go.mod h1:sLxTTqkIhmNtekO0HebXgVclPpm/xoQ4+g8CbzgYBCM= -go.opentelemetry.io/collector/receiver v0.83.0 h1:T2LI6BGNGMGBN8DLWUy7KyFXVaQR8ah+7ssCwb8OqNs= -go.opentelemetry.io/collector/receiver v0.83.0/go.mod h1:yEo8Mv57a53Psd2BvUbP/he5ZtdrwHezeLUCTUtf6PA= +go.opentelemetry.io/collector/processor v0.84.0 h1:6VM5HLdkroeqNZ/jvjxA4nsgweJ87FDMsnNnzVBHpcY= +go.opentelemetry.io/collector/processor v0.84.0/go.mod h1:KWgBNQuA6wmmRqJwfvPaRybK2Di9X8nE2fraGuVLNJo= +go.opentelemetry.io/collector/processor/batchprocessor v0.84.0 h1:U7M0bhno88+zSDUdatJnhP8B3B9H2YHazo4N9KNDZxY= +go.opentelemetry.io/collector/processor/batchprocessor v0.84.0/go.mod h1:oH0ruRQ7lFbPSu8G87yVM2H8XBHaKHbqj5pXfswYWTY= +go.opentelemetry.io/collector/receiver v0.84.0 h1:5bN0A18UMAVu9AsFv5AYDgzEFEJ/nFaD1OK2rk7Ygy0= +go.opentelemetry.io/collector/receiver v0.84.0/go.mod h1:QvjpfmMUA4tW59QJBagoNEbRT5JGYZN333GAOuWIRr4= go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0 h1:A0xNr1N/d5jkO+42G9CQ7C69UZhcTsnAibo1FzRA/PA= go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0/go.mod h1:h+WL9WneDgX4uHVBdt/yVINSB/NUzVTOqukoBF1F7uc= -go.opentelemetry.io/collector/semconv v0.83.0 h1:zfBJaGiC7XI8dLD/8QIyKre98RHcq3DaG1g1B+U/Dow= -go.opentelemetry.io/collector/semconv v0.83.0/go.mod h1:j/8THcqVxFna1FpvA2zYIsUperEtOaRaqoLYIN4doWw= +go.opentelemetry.io/collector/semconv v0.84.0 h1:sI1B8ebHhfJPd87iyba66TDnluVFvYu8CEpSjKHqIDc= +go.opentelemetry.io/collector/semconv v0.84.0/go.mod h1:j/8THcqVxFna1FpvA2zYIsUperEtOaRaqoLYIN4doWw= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 h1:mdcNStUIXngF/mH3xxAo4nbR4g65IXqLL1SvYMjz7JQ= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17/go.mod h1:N2Nw/UmmvQn0yCnaUzvsWzTWIeffYIdFteg6mxqCWII= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 h1:pginetY7+onl4qN1vl0xW/V/v6OBZ0vVdH+esuJgvmM= @@ -545,6 +550,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 h1:cbsD4cUcviQGXdw8+bo go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0/go.mod h1:JgXSGah17croqhJfhByOLVY719k1emAXC8MVhCIJlRs= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 h1:TVQp/bboR4mhZSav+MdgXB8FaRho1RC8UwVn3T0vjVc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0/go.mod h1:I33vtIe0sR96wfrUcilIzLoA3mLHhRmz9S9Te0S3gDo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0 h1:iqjq9LAB8aK++sKVcELezzn655JnBNdsDhghU4G/So8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.16.0/go.mod h1:hGXzO5bhhSHZnKvrDaXB82Y9DRFour0Nz/KrBh7reWw= go.opentelemetry.io/otel/exporters/prometheus v0.39.0 h1:whAaiHxOatgtKd+w0dOi//1KUxj3KoPINZdtDaDj3IA= go.opentelemetry.io/otel/exporters/prometheus v0.39.0/go.mod h1:4jo5Q4CROlCpSPsXLhymi+LYrDXd2ObU5wbKayfZs7Y= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 h1:fl2WmyenEf6LYYlfHAtCUEDyGcpwJNqD4dHGO7PVm4w= @@ -589,7 +596,7 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQJHQdp89IZBA/+azVC4= +golang.org/x/exp v0.0.0-20230711023510-fffb14384f22 h1:FqrVOBQxQ8r/UwwXibI0KMolVhvFiGobSfdE33deHJM= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -820,8 +827,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T 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.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= -gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -878,10 +885,10 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 h1:9NWlQfY2ePejTmfwUH1OWwmznFa+0kKcHGPDvcPza9M= -google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 h1:m8v1xLLLzMe1m5P+gCTF8nJB9epwZQUBERm20Oy1poQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdLy/60bS+52xfymkE72wv1asokgtao= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= diff --git a/internal/otelcollector/collector.go b/internal/otelcollector/collector.go index 6fbe33a..852e8ea 100644 --- a/internal/otelcollector/collector.go +++ b/internal/otelcollector/collector.go @@ -15,10 +15,14 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configgrpc" + "go.opentelemetry.io/collector/config/configopaque" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/exporter" + "go.opentelemetry.io/collector/exporter/otlpexporter" "go.opentelemetry.io/collector/otelcol" "go.opentelemetry.io/collector/processor" + "go.opentelemetry.io/collector/processor/batchprocessor" "go.opentelemetry.io/collector/receiver" otlpreceiver "go.opentelemetry.io/collector/receiver/otlpreceiver" "go.opentelemetry.io/collector/service" @@ -53,12 +57,18 @@ func New(cfg CollectorConfig, logger *zap.Logger) (*Collector, error) { return nil, fmt.Errorf("failed to create collector: %w", err) } - factories.Processors, err = processor.MakeFactoryMap(cumulativetodeltaprocessor.NewFactory()) + factories.Processors, err = processor.MakeFactoryMap( + cumulativetodeltaprocessor.NewFactory(), + batchprocessor.NewFactory(), + ) if err != nil { return nil, fmt.Errorf("failed to create collector: %w", err) } - factories.Exporters, err = exporter.MakeFactoryMap(inmemexporter.NewFactory(store)) + factories.Exporters, err = exporter.MakeFactoryMap( + inmemexporter.NewFactory(store), + otlpexporter.NewFactory(), + ) if err != nil { return nil, fmt.Errorf("failed to create collector: %w", err) } @@ -73,9 +83,11 @@ func New(cfg CollectorConfig, logger *zap.Logger) (*Collector, error) { collector, err := otelcol.NewCollector(otelcol.CollectorSettings{ BuildInfo: component.NewDefaultBuildInfo(), Factories: factories, - ConfigProvider: staticConfigProvider{ - otlpReceiverConfig: otlpReceiverCfg, - }, + ConfigProvider: newStaticConfigProvider( + otlpReceiverCfg, + cfg.OTLPExporterEndpoint, + cfg.OTLPExporterHeaders, + ), }) if err != nil { return nil, fmt.Errorf("failed to create collector: %w", err) @@ -133,7 +145,25 @@ func (c *Collector) Reset() { } type staticConfigProvider struct { - otlpReceiverConfig *otlpreceiver.Config + otlpReceiverConfig *otlpreceiver.Config + otlpExporterEndpoint string + otlpExporterHeaders map[string]configopaque.String +} + +func newStaticConfigProvider( + otlpReceiverConfig *otlpreceiver.Config, + otlpExporterEndpoint string, + otlpExporterHeaders map[string]string, +) staticConfigProvider { + exporterHeaders := make(map[string]configopaque.String, len(otlpExporterHeaders)) + for k, v := range otlpExporterHeaders { + exporterHeaders[k] = configopaque.String(v) + } + return staticConfigProvider{ + otlpReceiverConfig: otlpReceiverConfig, + otlpExporterEndpoint: otlpExporterEndpoint, + otlpExporterHeaders: exporterHeaders, + } } func (p staticConfigProvider) Get( @@ -141,27 +171,11 @@ func (p staticConfigProvider) Get( factories otelcol.Factories, ) (*otelcol.Config, error) { return &otelcol.Config{ - Receivers: map[component.ID]component.Config{ - component.NewID("otlp"): p.otlpReceiverConfig, - }, - Processors: map[component.ID]component.Config{ - component.NewID("cumulativetodelta"): &cumulativetodeltaprocessor.Config{}, - }, - Exporters: map[component.ID]component.Config{ - component.NewID("inmem"): &inmemexporter.Config{}, - }, + Receivers: p.getReceivers(), + Processors: p.getProcessors(), + Exporters: p.getExporters(), Service: service.Config{ - Pipelines: map[component.ID]*pipelines.PipelineConfig{ - component.NewID("metrics"): &pipelines.PipelineConfig{ - Receivers: []component.ID{component.NewID("otlp")}, - Processors: []component.ID{component.NewID("cumulativetodelta")}, - Exporters: []component.ID{component.NewID("inmem")}, - }, - component.NewID("traces"): &pipelines.PipelineConfig{ - Receivers: []component.ID{component.NewID("otlp")}, - Exporters: []component.ID{component.NewID("inmem")}, - }, - }, + Pipelines: p.getPipelines(), Telemetry: telemetry.Config{ Logs: telemetry.LogsConfig{ Level: zapcore.InfoLevel, @@ -186,3 +200,65 @@ func (p staticConfigProvider) Watch() <-chan error { func (p staticConfigProvider) Shutdown(ctx context.Context) error { return nil } + +func (p staticConfigProvider) getReceivers() map[component.ID]component.Config { + return map[component.ID]component.Config{ + component.NewID("otlp"): p.otlpReceiverConfig, + } +} + +func (p staticConfigProvider) getProcessors() map[component.ID]component.Config { + return map[component.ID]component.Config{ + component.NewID("cumulativetodelta"): &cumulativetodeltaprocessor.Config{}, + component.NewID("batch"): &batchprocessor.Config{ + SendBatchMaxSize: 4 << 20, // 4MB + }, + } +} + +func (p staticConfigProvider) getExporters() map[component.ID]component.Config { + exporters := map[component.ID]component.Config{ + component.NewID("inmem"): &inmemexporter.Config{}, + } + if p.otlpExporterEndpoint != "" { + exporters[component.NewID("otlp")] = &otlpexporter.Config{ + GRPCClientSettings: configgrpc.GRPCClientSettings{ + Endpoint: p.otlpExporterEndpoint, + Headers: p.otlpExporterHeaders, + }, + } + } + return exporters +} + +func (p staticConfigProvider) getPipelines() map[component.ID]*pipelines.PipelineConfig { + pipes := map[component.ID]*pipelines.PipelineConfig{ + component.NewID("metrics"): &pipelines.PipelineConfig{ + Receivers: []component.ID{component.NewID("otlp")}, + Processors: []component.ID{component.NewID("cumulativetodelta")}, + Exporters: []component.ID{component.NewID("inmem")}, + }, + } + if p.otlpExporterEndpoint != "" { + pipes[component.NewIDWithName("metrics", "2")] = &pipelines.PipelineConfig{ + Receivers: []component.ID{component.NewID("otlp")}, + Processors: []component.ID{ + component.NewID("cumulativetodelta"), + component.NewID("batch"), + }, + Exporters: []component.ID{component.NewID("otlp")}, + } + pipes[component.NewID("traces")] = &pipelines.PipelineConfig{ + Receivers: []component.ID{component.NewID("otlp")}, + Processors: []component.ID{component.NewID("batch")}, + Exporters: []component.ID{component.NewID("otlp")}, + } + } else { + // Enable traces endpoint with a noOp if no otlp exporter is configured + pipes[component.NewID("traces")] = &pipelines.PipelineConfig{ + Receivers: []component.ID{component.NewID("otlp")}, + Exporters: []component.ID{component.NewID("inmem")}, + } + } + return pipes +} diff --git a/internal/otelcollector/config.go b/internal/otelcollector/config.go index d35d976..3f938f8 100644 --- a/internal/otelcollector/config.go +++ b/internal/otelcollector/config.go @@ -6,6 +6,7 @@ package otelcollector import ( "fmt" + "net/url" "os" "go.uber.org/zap/zapcore" @@ -16,9 +17,11 @@ import ( // CollectorConfig defines the configuration to customize the collector. type CollectorConfig struct { - HTTPEndpoint string `yaml:"http_endpoint"` - GRPCEndpoint string `yaml:"grpc_endpoint"` - InMemoryStoreConfig []inmemexporter.AggregationConfig `yaml:"store"` + HTTPEndpoint string `yaml:"http_endpoint"` + GRPCEndpoint string `yaml:"grpc_endpoint"` + InMemoryStoreConfig []inmemexporter.AggregationConfig `yaml:"store"` + OTLPExporterEndpoint string `yaml:"otlp_exporter_endpoint"` + OTLPExporterHeaders map[string]string `yaml:"otlp_exporter_headers"` } // LoadConfigFromYamlFile loads collector configuration from an yaml file. @@ -35,6 +38,16 @@ func (cfg *CollectorConfig) LoadConfigFromYamlFile(path string) error { if err := dec.Decode(cfg); err != nil { return fmt.Errorf("failed to decode config file: %w", err) } + if cfg.OTLPExporterEndpoint != "" { + ep, err := url.Parse(cfg.OTLPExporterEndpoint) + if err != nil { + return fmt.Errorf("invalid OTLP exporter endpoint specified: %w", err) + } + cfg.OTLPExporterEndpoint = ep.Host + if ep.Port() == "" { + cfg.OTLPExporterEndpoint += ":443" + } + } return nil } diff --git a/internal/otelcollector/config_test.go b/internal/otelcollector/config_test.go index 12c6243..3ad86d4 100644 --- a/internal/otelcollector/config_test.go +++ b/internal/otelcollector/config_test.go @@ -29,10 +29,13 @@ func TestLoadConfigFromYamlFile(t *testing.T) { errMsg: "failed to decode config file", }, { - name: "valid_yaml", + name: "valid_yaml_without_exporter_ep_port", input: []byte(` http_endpoint: localhost:8181 grpc_endpoint: localhost:8182 +otlp_exporter_endpoint: https://apm-server +otlp_exporter_headers: + Authorization: Bearer secret_token store: - name: test.metric.count alias: events/s @@ -40,8 +43,45 @@ store: k_1: v_1 k_2: v_2`), output: CollectorConfig{ - HTTPEndpoint: "localhost:8181", - GRPCEndpoint: "localhost:8182", + HTTPEndpoint: "localhost:8181", + GRPCEndpoint: "localhost:8182", + OTLPExporterEndpoint: "apm-server:443", + OTLPExporterHeaders: map[string]string{ + "Authorization": "Bearer secret_token", + }, + InMemoryStoreConfig: []inmemexporter.AggregationConfig{ + { + Name: "test.metric.count", + Alias: "events/s", + MatchLabelValues: map[string]string{ + "k_1": "v_1", + "k_2": "v_2", + }, + }, + }, + }, + }, + { + name: "valid_yaml_with_exporter_ep_port", + input: []byte(` +http_endpoint: localhost:8181 +grpc_endpoint: localhost:8182 +otlp_exporter_endpoint: https://apm-server:4171 +otlp_exporter_headers: + Authorization: Bearer secret_token +store: + - name: test.metric.count + alias: events/s + match_label_values: + k_1: v_1 + k_2: v_2`), + output: CollectorConfig{ + HTTPEndpoint: "localhost:8181", + GRPCEndpoint: "localhost:8182", + OTLPExporterEndpoint: "apm-server:4171", + OTLPExporterHeaders: map[string]string{ + "Authorization": "Bearer secret_token", + }, InMemoryStoreConfig: []inmemexporter.AggregationConfig{ { Name: "test.metric.count",