diff --git a/cloudprober_test.go b/cloudprober_test.go index 8c572d28a37..e1e6d9392b9 100644 --- a/cloudprober_test.go +++ b/cloudprober_test.go @@ -248,8 +248,11 @@ func TestCloudproberConfig(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { configSrc := config.ConfigSourceWithFile(tt.fileName) + + cloudProber.Lock() cloudProber.configSource = configSrc cloudProber.config, _ = configSrc.GetConfig() + cloudProber.Unlock() assert.Equal(t, tt.wantProbename, GetConfig().GetProbe()[0].GetName(), "GetConfig()") assert.Equal(t, tt.wantRawConfig, GetRawConfig(), "GetRawConfig()") diff --git a/go.mod b/go.mod index b1f15c0a585..80a735f596d 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,12 @@ require ( github.com/kylelemons/godebug v1.1.0 github.com/lib/pq v1.8.0 github.com/miekg/dns v1.1.33 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 golang.org/x/net v0.19.0 golang.org/x/oauth2 v0.11.0 golang.org/x/sys v0.15.0 @@ -49,15 +55,19 @@ require ( github.com/aws/aws-sdk-go-v2/service/sts v1.16.12 // indirect github.com/aws/smithy-go v1.12.1 // indirect github.com/bufbuild/protocompile v0.4.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/goccy/go-json v0.9.11 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/huandu/xstrings v1.3.3 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/itchyny/timefmt-go v0.1.4 // indirect @@ -73,6 +83,9 @@ require ( github.com/shopspring/decimal v1.2.0 // indirect github.com/spf13/cast v1.3.1 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect @@ -89,7 +102,7 @@ require ( github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/itchyny/gojq v0.12.9 github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/mod v0.14.0 // indirect diff --git a/go.sum b/go.sum index 8e3c191d38c..4f3bc0544a0 100644 --- a/go.sum +++ b/go.sum @@ -96,6 +96,8 @@ github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= @@ -136,9 +138,16 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/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/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -183,8 +192,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +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/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= @@ -210,6 +219,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hoisie/redis v0.0.0-20160730154456-b5c6e81454e0 h1:mjZV3MTu2A5gwfT5G9IIiLGdwZNciyVq5qqnmJJZ2JI= @@ -244,11 +255,12 @@ github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHU github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg= @@ -270,8 +282,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= @@ -286,8 +298,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= @@ -300,7 +312,25 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0 h1:jd0+5t/YynESZqsSyPz+7PAFdEop0dlN0+PkyHYo8oI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.44.0/go.mod h1:U707O40ee1FpQGyhvqnzmCJm1Wh6OX6GGBVn0E6Uyyk= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0 h1:bflGWrfYyuulcdxf14V6n9+CoQcu5SAAdHmDPAJnlps= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0/go.mod h1:qcTO4xHAxZLaLxPd60TdE88rxtItPHgHWqOhOGRr0as= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 h1:dEZWPjVN22urgYCza3PXRUGEyCB++y1sAqm6guWFesk= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0/go.mod h1:sTt30Evb7hJB/gEk27qLb1+l9n4Tb8HvHkR0Wx3S6CU= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/sdk/metric v1.21.0 h1:smhI5oD714d6jHE6Tie36fPx4WDFIg+Y6RfAY4ICcR0= +go.opentelemetry.io/otel/sdk/metric v1.21.0/go.mod h1:FJ8RAsoPGv/wYMgBdUJXOm+6pzFY3YdljnXtv1SBE8Q= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/surfacers/internal/otel/otel.go b/surfacers/internal/otel/otel.go new file mode 100644 index 00000000000..9f7a2900140 --- /dev/null +++ b/surfacers/internal/otel/otel.go @@ -0,0 +1,353 @@ +// Copyright 2023 The Cloudprober Authors. +// +// Licensed 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 otel provides an OpenTelemetry surfacer for Cloudprober. It can +export metrics to OpenTelemetry Collector over gRPC or HTTP. + +This surfacer holds the incoming EventMetrics in memory and periodically +(default: 10s) exports them the configured HTTP or gRPC endpoint. +*/ +package otel + +import ( + "context" + "crypto/tls" + "fmt" + "net" + "net/url" + "sort" + "sync" + "time" + + "github.com/cloudprober/cloudprober/internal/tlsconfig" + "github.com/cloudprober/cloudprober/logger" + "github.com/cloudprober/cloudprober/metrics" + "github.com/cloudprober/cloudprober/surfacers/internal/common/options" + configpb "github.com/cloudprober/cloudprober/surfacers/internal/otel/proto" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "google.golang.org/grpc/credentials" +) + +// OtelSurfacer implements OpenTelemetry surfacer for Cloudprober. +type OtelSurfacer struct { + c *configpb.SurfacerConf // Configuration + opts *options.Options + l *logger.Logger + + // Otel metrics + mu sync.Mutex + scopeMetrics map[string]*metricdata.ScopeMetrics + + startTime time.Time +} + +func getExporter(ctx context.Context, config *configpb.SurfacerConf, l *logger.Logger) (metric.Exporter, error) { + if config.GetOtlpHttpExporter() != nil { + expConf := config.GetOtlpHttpExporter() + + var opts []otlpmetrichttp.Option + + if expConf.GetEndpointUrl() == "" { + u, err := url.Parse(expConf.GetEndpointUrl()) + if err != nil { + return nil, fmt.Errorf("invalid http endpoint_url: %s, err: %v", expConf.GetEndpointUrl(), err) + } + + opts = append(opts, otlpmetrichttp.WithEndpoint(net.JoinHostPort(u.Hostname(), u.Port()))) + if u.Scheme != "https" { + opts = append(opts, otlpmetrichttp.WithInsecure()) + } + opts = append(opts, otlpmetrichttp.WithURLPath(u.Path)) + } + + if expConf.GetHttpHeader() != nil { + opts = append(opts, otlpmetrichttp.WithHeaders(expConf.GetHttpHeader())) + } + + if expConf.GetCompression() == configpb.Compression_GZIP { + opts = append(opts, otlpmetrichttp.WithCompression(otlpmetrichttp.GzipCompression)) + } + + if expConf.GetTlsConfig() != nil { + tlsConfig := &tls.Config{} + err := tlsconfig.UpdateTLSConfig(nil, expConf.GetTlsConfig()) + if err != nil { + return nil, fmt.Errorf("failed to create tls config: %v", err) + } + opts = append(opts, otlpmetrichttp.WithTLSClientConfig(tlsConfig)) + } + + exp, err := otlpmetrichttp.New(ctx, opts...) + if err != nil { + return nil, fmt.Errorf("failed to create http exporter: %v", err) + } + return exp, nil + } + + if config.GetOtlpGrpcExporter() != nil { + expConf := config.GetOtlpGrpcExporter() + + var opts []otlpmetricgrpc.Option + + if expConf.GetEndpoint() == "" { + opts = append(opts, otlpmetricgrpc.WithEndpoint(expConf.GetEndpoint())) + } + + if expConf.GetHttpHeader() != nil { + opts = append(opts, otlpmetricgrpc.WithHeaders(expConf.GetHttpHeader())) + } + + if expConf.GetCompression() == configpb.Compression_GZIP { + opts = append(opts, otlpmetricgrpc.WithCompressor("gzip")) + } + + if expConf.GetInsecure() { + opts = append(opts, otlpmetricgrpc.WithInsecure()) + } + + if expConf.GetTlsConfig() != nil { + tlsConfig := &tls.Config{} + err := tlsconfig.UpdateTLSConfig(nil, expConf.GetTlsConfig()) + if err != nil { + return nil, fmt.Errorf("failed to create tls config: %v", err) + } + opts = append(opts, otlpmetricgrpc.WithTLSCredentials(credentials.NewTLS(tlsConfig))) + } + + exp, err := otlpmetricgrpc.New(ctx, opts...) + if err != nil { + return nil, fmt.Errorf("failed to create grpc exporter: %v", err) + } + return exp, nil + } + + l.Warning("No exporter specified, using stdout exporter") + return stdoutmetric.New() +} + +// New returns a prometheus surfacer based on the config provided. It sets up a +// goroutine to process both the incoming EventMetrics and the web requests for +// the URL handler /metrics. +func New(ctx context.Context, config *configpb.SurfacerConf, opts *options.Options, l *logger.Logger) (*OtelSurfacer, error) { + if config == nil { + config = &configpb.SurfacerConf{} + } + + os := &OtelSurfacer{ + c: config, + opts: opts, + scopeMetrics: make(map[string]*metricdata.ScopeMetrics), + startTime: time.Now(), + l: l, + } + + exp, err := getExporter(ctx, config, l) + if err != nil { + return nil, err + } + + // Reader is sort of a binding between exporter and producer. It collects + // from the producer and exports to the exporter. + exportInterval := time.Second * time.Duration(config.GetExportIntervalSec()) + r := metric.NewPeriodicReader(exp, metric.WithProducer(os), metric.WithInterval(exportInterval)) + + // This step registers the reader and pipelines behind the scene. + // manugarg: This step seems kind of unnecessary right now but it's + // required. + metric.NewMeterProvider(metric.WithReader(r)) + + l.Infof("Initialized opentelemetry surfacer with config: %s", config.String()) + return os, nil +} + +func (os *OtelSurfacer) Produce(_ context.Context) ([]metricdata.ScopeMetrics, error) { + os.mu.Lock() + defer os.mu.Unlock() + + var scopeMetrics []metricdata.ScopeMetrics + + var keys []string + for k := range os.scopeMetrics { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, k := range keys { + sm := os.scopeMetrics[k] + if len(sm.Metrics) == 0 { + continue + } + scopeMetrics = append(scopeMetrics, *sm) + sm.Metrics = nil + } + + return scopeMetrics, nil +} + +func mapDataPoints[T int64 | float64](baseAttrs attribute.Set, m *metrics.Map[T], startTime, ts time.Time) []metricdata.DataPoint[T] { + var dataPoints []metricdata.DataPoint[T] + for _, k := range m.Keys() { + attrs := attribute.NewSet(append(baseAttrs.ToSlice(), attribute.String(m.MapName, k))...) + dataPoints = append(dataPoints, metricdata.DataPoint[T]{ + Attributes: attrs, + StartTime: startTime, + Time: ts, + Value: m.GetKey(k), + }) + } + return dataPoints +} + +func convertDistribution(dist *metrics.Distribution, kind metrics.Kind, baseAttrs attribute.Set, startTime, ts time.Time) metricdata.Histogram[float64] { + d := dist.Data() + + hdp := metricdata.HistogramDataPoint[float64]{ + Attributes: baseAttrs, + StartTime: startTime, + Time: ts, + Count: uint64(d.Count), + Sum: d.Sum, + Bounds: append([]float64{}, d.LowerBounds[1:]...), + BucketCounts: make([]uint64, len(d.BucketCounts)), + } + + for i := range d.BucketCounts { + hdp.BucketCounts[i] = uint64(d.BucketCounts[i]) + } + + hist := metricdata.Histogram[float64]{ + DataPoints: []metricdata.HistogramDataPoint[float64]{hdp}, + } + + if kind == metrics.GAUGE { + hist.Temporality = metricdata.DeltaTemporality + } else { + hist.Temporality = metricdata.CumulativeTemporality + } + + return hist +} + +func otelAttributes(em *metrics.EventMetrics) attribute.Set { + var attrs []attribute.KeyValue + for _, k := range em.LabelsKeys() { + attrs = append(attrs, attribute.String(k, em.Label(k))) + } + return attribute.NewSet(attrs...) +} + +func sumOrGauge[T int64 | float64](kind metrics.Kind, dataPoints ...metricdata.DataPoint[T]) metricdata.Aggregation { + if kind == metrics.GAUGE { + return metricdata.Gauge[T]{DataPoints: dataPoints} + } + return metricdata.Sum[T]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: dataPoints, + IsMonotonic: true, + } +} + +func numberData[T int64 | float64](kind metrics.Kind, v T, attrs attribute.Set, startTime, timestamp time.Time) metricdata.Aggregation { + return sumOrGauge[T](kind, metricdata.DataPoint[T]{ + Attributes: attrs, + StartTime: startTime, + Time: timestamp, + Value: v, + }) +} + +func (os *OtelSurfacer) convertMetric(em *metrics.EventMetrics, metricName string) (metricdata.Metrics, error) { + baseAttrs := otelAttributes(em) + + unit := "1" + if metricName == "latency" { + if em.LatencyUnit == 0 { + unit = "us" + } else { + unit = em.LatencyUnit.String()[1:] + } + os.l.Debugf("Latency metric unit: %s", unit) + } + + otelmetrics := func(data metricdata.Aggregation) metricdata.Metrics { + return metricdata.Metrics{ + Name: metricName, + Description: metricName + " metric for Cloudprober", + Unit: unit, + Data: data, + } + } + + switch v := em.Metric(metricName).(type) { + case *metrics.Int: + return otelmetrics(numberData[int64](em.Kind, v.Int64(), baseAttrs, os.startTime, em.Timestamp)), nil + case *metrics.Float: + return otelmetrics(numberData[float64](em.Kind, v.Float64(), baseAttrs, os.startTime, em.Timestamp)), nil + case *metrics.Map[int64]: + return otelmetrics(sumOrGauge[int64](em.Kind, mapDataPoints[int64](baseAttrs, v, os.startTime, em.Timestamp)...)), nil + case *metrics.Map[float64]: + return otelmetrics(sumOrGauge[float64](em.Kind, mapDataPoints[float64](baseAttrs, v, os.startTime, em.Timestamp)...)), nil + case metrics.String: + attrs := attribute.NewSet(append(baseAttrs.ToSlice(), attribute.String("value", v.String()))...) + return otelmetrics(numberData[int64](em.Kind, 1, attrs, os.startTime, em.Timestamp)), nil + case *metrics.Distribution: + return otelmetrics(convertDistribution(v, em.Kind, baseAttrs, os.startTime, em.Timestamp)), nil + } + + return metricdata.Metrics{}, fmt.Errorf("unsupported metric type: %T", em.Metric(metricName)) +} + +func getScope(em *metrics.EventMetrics) string { + if em.Label("probe") != "" { + return "probe." + em.Label("probe") + } + if em.Label("module") != "" { + return "module." + em.Label("module") + } + return "global" +} + +// record processes the incoming EventMetrics and updates the in-memory +// otel metrics database. +func (os *OtelSurfacer) Write(_ context.Context, em *metrics.EventMetrics) { + os.mu.Lock() + defer os.mu.Unlock() + + scope := getScope(em) + sm := os.scopeMetrics[scope] + if sm == nil { + sm = &metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{ + Name: scope, + }, + } + os.scopeMetrics[scope] = sm + } + + for _, metricName := range em.MetricsKeys() { + otelmetrics, err := os.convertMetric(em, metricName) + if err != nil { + os.l.Errorf("Error converting metric: %s, err: %v", metricName, err) + continue + } + sm.Metrics = append(sm.Metrics, otelmetrics) + } +} diff --git a/surfacers/internal/otel/otel_test.go b/surfacers/internal/otel/otel_test.go new file mode 100644 index 00000000000..fa633ba7e7b --- /dev/null +++ b/surfacers/internal/otel/otel_test.go @@ -0,0 +1,226 @@ +// Copyright 2023 The Cloudprober Authors. +// +// Licensed 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 otel + +import ( + "context" + "testing" + "time" + + "github.com/cloudprober/cloudprober/metrics" + configpb "github.com/cloudprober/cloudprober/surfacers/internal/otel/proto" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "google.golang.org/protobuf/proto" +) + +func testEMs(ts time.Time) []*metrics.EventMetrics { + d := metrics.NewDistribution([]float64{1, 10, 100}) + d.AddSample(2) + d.AddSample(20) + + respCode := metrics.NewMap("code") + respCode.IncKeyBy("200", 2) + respCode.IncKey("500") + + ems := []*metrics.EventMetrics{ + metrics.NewEventMetrics(ts). + AddMetric("failures", metrics.NewInt(20)). + AddMetric("latency", metrics.NewFloat(9.2)). + AddLabel("probe", "p1"), + metrics.NewEventMetrics(ts.Add(time.Second)). + AddMetric("resp_code", respCode). + AddMetric("latency", d). + AddLabel("probe", "p2"), + metrics.NewEventMetrics(ts.Add(2*time.Second)). + AddMetric("failures", metrics.NewInt(25)). + AddMetric("latency", metrics.NewFloat(8.7)). + AddLabel("probe", "p1"), + } + + ems[1].LatencyUnit = time.Millisecond + return ems +} + +func testMetric(name, unit string, data metricdata.Aggregation) metricdata.Metrics { + return metricdata.Metrics{ + Name: name, + Description: name + " metric for Cloudprober", + Unit: unit, + Data: data, + } +} + +func dataPoint[T int64 | float64](val T, kvs [][2]string, startTime, ts time.Time) metricdata.DataPoint[T] { + var attrs []attribute.KeyValue + for _, kv := range kvs { + attrs = append(attrs, attribute.String(kv[0], kv[1])) + } + return metricdata.DataPoint[T]{ + Attributes: attribute.NewSet(attrs...), + StartTime: startTime, + Time: ts, + Value: val, + } +} + +func sumData[T int64 | float64](dataPoints ...metricdata.DataPoint[T]) metricdata.Sum[T] { + return metricdata.Sum[T]{ + DataPoints: dataPoints, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + } +} + +func TestOtelSurfacerWrite(t *testing.T) { + startTime := time.Now() + ems := testEMs(startTime.Add(time.Second)) + + tests := []struct { + name string + em *metrics.EventMetrics + wantScopeMetrics map[string]*metricdata.ScopeMetrics + }{ + { + name: "em0", + em: ems[0], + wantScopeMetrics: map[string]*metricdata.ScopeMetrics{ + "probe.p1": { + Scope: instrumentation.Scope{Name: "probe.p1"}, + Metrics: []metricdata.Metrics{ + testMetric("failures", "1", sumData(dataPoint[int64](20, [][2]string{{"probe", "p1"}}, startTime, ems[0].Timestamp))), + testMetric("latency", "us", sumData(dataPoint[float64](9.2, [][2]string{{"probe", "p1"}}, startTime, ems[0].Timestamp))), + }, + }, + }, + }, + { + name: "em1", + em: ems[1], + wantScopeMetrics: map[string]*metricdata.ScopeMetrics{ + "probe.p2": { + Scope: instrumentation.Scope{Name: "probe.p2"}, + Metrics: []metricdata.Metrics{ + testMetric("resp_code", "1", sumData( + dataPoint[int64](2, [][2]string{{"probe", "p2"}, {"code", "200"}}, startTime, ems[1].Timestamp), + dataPoint[int64](1, [][2]string{{"probe", "p2"}, {"code", "500"}}, startTime, ems[1].Timestamp))), + testMetric("latency", "ms", metricdata.Histogram[float64]{ + DataPoints: []metricdata.HistogramDataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("probe", "p2")), + StartTime: startTime, + Time: ems[1].Timestamp, + Count: 2, + Sum: 22, + Bounds: []float64{1, 10, 100}, + BucketCounts: []uint64{0, 1, 1, 0}, + }, + }, + Temporality: metricdata.CumulativeTemporality, + }), + }, + }, + }, + }, + { + name: "em2", + em: ems[2], + wantScopeMetrics: map[string]*metricdata.ScopeMetrics{ + "probe.p1": { + Scope: instrumentation.Scope{Name: "probe.p1"}, + Metrics: []metricdata.Metrics{ + testMetric("failures", "1", sumData(dataPoint[int64](20, [][2]string{{"probe", "p1"}}, startTime, ems[0].Timestamp))), + testMetric("latency", "us", sumData(dataPoint[float64](9.2, [][2]string{{"probe", "p1"}}, startTime, ems[0].Timestamp))), + testMetric("failures", "1", sumData(dataPoint[int64](25, [][2]string{{"probe", "p1"}}, startTime, ems[0].Timestamp.Add(2*time.Second)))), + testMetric("latency", "us", sumData(dataPoint[float64](8.7, [][2]string{{"probe", "p1"}}, startTime, ems[0].Timestamp.Add(2*time.Second)))), + }, + }, + }, + }, + } + + wantScopeMetrics := make(map[string]*metricdata.ScopeMetrics) + os := &OtelSurfacer{ + startTime: startTime, + scopeMetrics: make(map[string]*metricdata.ScopeMetrics), + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + os.Write(context.Background(), tt.em) + for k, v := range tt.wantScopeMetrics { + wantScopeMetrics[k] = v + } + assert.Equal(t, wantScopeMetrics, os.scopeMetrics) + }) + } + + // First produce now will return all scope metrics + var wantProducedMetrics []metricdata.ScopeMetrics + for _, scope := range []string{"probe.p1", "probe.p2"} { + wantProducedMetrics = append(wantProducedMetrics, *wantScopeMetrics[scope]) + } + producedMetrics, _ := os.Produce(context.Background()) + assert.Equal(t, wantProducedMetrics, producedMetrics) + + // Next produce will be empty + producedMetrics, _ = os.Produce(context.Background()) + assert.Empty(t, producedMetrics) +} + +func TestGetExporterType(t *testing.T) { + tests := []struct { + name string + config *configpb.SurfacerConf + wantType metric.Exporter + wantErr bool + }{ + { + name: "otlp_http", + config: &configpb.SurfacerConf{ + Exporter: &configpb.SurfacerConf_OtlpHttpExporter{ + OtlpHttpExporter: &configpb.HTTPExporter{}, + }, + }, + wantType: &otlpmetrichttp.Exporter{}, + }, + { + name: "otlp_grpc", + config: &configpb.SurfacerConf{ + Exporter: &configpb.SurfacerConf_OtlpGrpcExporter{ + OtlpGrpcExporter: &configpb.GRPCExporter{ + Endpoint: proto.String("localhost:1234"), + }, + }, + }, + wantType: &otlpmetricgrpc.Exporter{}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := getExporter(context.Background(), tt.config, nil) + if (err != nil) != tt.wantErr { + t.Errorf("getExporter() error = %v, wantErr %v", err, tt.wantErr) + return + } + assert.IsType(t, tt.wantType, got, "unexpected exporter type") + }) + } +} diff --git a/surfacers/internal/otel/proto/config.pb.go b/surfacers/internal/otel/proto/config.pb.go new file mode 100644 index 00000000000..7c53de07c86 --- /dev/null +++ b/surfacers/internal/otel/proto/config.pb.go @@ -0,0 +1,528 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v3.21.5 +// source: github.com/cloudprober/cloudprober/surfacers/internal/otel/proto/config.proto + +package proto + +import ( + proto "github.com/cloudprober/cloudprober/internal/tlsconfig/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Compression int32 + +const ( + Compression_NONE Compression = 0 + Compression_GZIP Compression = 1 +) + +// Enum value maps for Compression. +var ( + Compression_name = map[int32]string{ + 0: "NONE", + 1: "GZIP", + } + Compression_value = map[string]int32{ + "NONE": 0, + "GZIP": 1, + } +) + +func (x Compression) Enum() *Compression { + p := new(Compression) + *p = x + return p +} + +func (x Compression) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Compression) Descriptor() protoreflect.EnumDescriptor { + return file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_enumTypes[0].Descriptor() +} + +func (Compression) Type() protoreflect.EnumType { + return &file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_enumTypes[0] +} + +func (x Compression) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Compression) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Compression(num) + return nil +} + +// Deprecated: Use Compression.Descriptor instead. +func (Compression) EnumDescriptor() ([]byte, []int) { + return file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescGZIP(), []int{0} +} + +type HTTPExporter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If no URL is provided, OpenTelemetry SDK will use the environment variable + // OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_ENDPOINT in that + // preference order. + EndpointUrl *string `protobuf:"bytes,1,opt,name=endpoint_url,json=endpointUrl" json:"endpoint_url,omitempty"` + TlsConfig *proto.TLSConfig `protobuf:"bytes,2,opt,name=tls_config,json=tlsConfig" json:"tls_config,omitempty"` + // HTTP request headers. These can also be set using environment variables. + HttpHeader map[string]string `protobuf:"bytes,3,rep,name=http_header,json=httpHeader" json:"http_header,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Compression algorithm to use for HTTP requests. + Compression *Compression `protobuf:"varint,4,opt,name=compression,enum=cloudprober.surfacer.otel.Compression" json:"compression,omitempty"` +} + +func (x *HTTPExporter) Reset() { + *x = HTTPExporter{} + if protoimpl.UnsafeEnabled { + mi := &file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPExporter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPExporter) ProtoMessage() {} + +func (x *HTTPExporter) ProtoReflect() protoreflect.Message { + mi := &file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HTTPExporter.ProtoReflect.Descriptor instead. +func (*HTTPExporter) Descriptor() ([]byte, []int) { + return file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescGZIP(), []int{0} +} + +func (x *HTTPExporter) GetEndpointUrl() string { + if x != nil && x.EndpointUrl != nil { + return *x.EndpointUrl + } + return "" +} + +func (x *HTTPExporter) GetTlsConfig() *proto.TLSConfig { + if x != nil { + return x.TlsConfig + } + return nil +} + +func (x *HTTPExporter) GetHttpHeader() map[string]string { + if x != nil { + return x.HttpHeader + } + return nil +} + +func (x *HTTPExporter) GetCompression() Compression { + if x != nil && x.Compression != nil { + return *x.Compression + } + return Compression_NONE +} + +type GRPCExporter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If no URL is provided, OpenTelemetry SDK will use the environment variable + // OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_ENDPOINT in that + // preference order. + Endpoint *string `protobuf:"bytes,1,opt,name=endpoint" json:"endpoint,omitempty"` + TlsConfig *proto.TLSConfig `protobuf:"bytes,2,opt,name=tls_config,json=tlsConfig" json:"tls_config,omitempty"` + // HTTP request headers. These can also be set using environment variables. + HttpHeader map[string]string `protobuf:"bytes,3,rep,name=http_header,json=httpHeader" json:"http_header,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Compression algorithm to use for gRPC requests. + Compression *Compression `protobuf:"varint,4,opt,name=compression,enum=cloudprober.surfacer.otel.Compression" json:"compression,omitempty"` + // Whether to use insecure gRPC connection. + Insecure *bool `protobuf:"varint,5,opt,name=insecure" json:"insecure,omitempty"` +} + +func (x *GRPCExporter) Reset() { + *x = GRPCExporter{} + if protoimpl.UnsafeEnabled { + mi := &file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GRPCExporter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GRPCExporter) ProtoMessage() {} + +func (x *GRPCExporter) ProtoReflect() protoreflect.Message { + mi := &file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GRPCExporter.ProtoReflect.Descriptor instead. +func (*GRPCExporter) Descriptor() ([]byte, []int) { + return file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescGZIP(), []int{1} +} + +func (x *GRPCExporter) GetEndpoint() string { + if x != nil && x.Endpoint != nil { + return *x.Endpoint + } + return "" +} + +func (x *GRPCExporter) GetTlsConfig() *proto.TLSConfig { + if x != nil { + return x.TlsConfig + } + return nil +} + +func (x *GRPCExporter) GetHttpHeader() map[string]string { + if x != nil { + return x.HttpHeader + } + return nil +} + +func (x *GRPCExporter) GetCompression() Compression { + if x != nil && x.Compression != nil { + return *x.Compression + } + return Compression_NONE +} + +func (x *GRPCExporter) GetInsecure() bool { + if x != nil && x.Insecure != nil { + return *x.Insecure + } + return false +} + +type SurfacerConf struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Exporter: + // + // *SurfacerConf_OtlpHttpExporter + // *SurfacerConf_OtlpGrpcExporter + Exporter isSurfacerConf_Exporter `protobuf_oneof:"exporter"` + ExportIntervalSec *int32 `protobuf:"varint,3,opt,name=export_interval_sec,json=exportIntervalSec,def=10" json:"export_interval_sec,omitempty"` +} + +// Default values for SurfacerConf fields. +const ( + Default_SurfacerConf_ExportIntervalSec = int32(10) +) + +func (x *SurfacerConf) Reset() { + *x = SurfacerConf{} + if protoimpl.UnsafeEnabled { + mi := &file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SurfacerConf) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SurfacerConf) ProtoMessage() {} + +func (x *SurfacerConf) ProtoReflect() protoreflect.Message { + mi := &file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SurfacerConf.ProtoReflect.Descriptor instead. +func (*SurfacerConf) Descriptor() ([]byte, []int) { + return file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescGZIP(), []int{2} +} + +func (m *SurfacerConf) GetExporter() isSurfacerConf_Exporter { + if m != nil { + return m.Exporter + } + return nil +} + +func (x *SurfacerConf) GetOtlpHttpExporter() *HTTPExporter { + if x, ok := x.GetExporter().(*SurfacerConf_OtlpHttpExporter); ok { + return x.OtlpHttpExporter + } + return nil +} + +func (x *SurfacerConf) GetOtlpGrpcExporter() *GRPCExporter { + if x, ok := x.GetExporter().(*SurfacerConf_OtlpGrpcExporter); ok { + return x.OtlpGrpcExporter + } + return nil +} + +func (x *SurfacerConf) GetExportIntervalSec() int32 { + if x != nil && x.ExportIntervalSec != nil { + return *x.ExportIntervalSec + } + return Default_SurfacerConf_ExportIntervalSec +} + +type isSurfacerConf_Exporter interface { + isSurfacerConf_Exporter() +} + +type SurfacerConf_OtlpHttpExporter struct { + // OTLP HTTP exporter. + OtlpHttpExporter *HTTPExporter `protobuf:"bytes,1,opt,name=otlp_http_exporter,json=otlpHttpExporter,oneof"` +} + +type SurfacerConf_OtlpGrpcExporter struct { + // OTLP gRPC exporter. + OtlpGrpcExporter *GRPCExporter `protobuf:"bytes,2,opt,name=otlp_grpc_exporter,json=otlpGrpcExporter,oneof"` +} + +func (*SurfacerConf_OtlpHttpExporter) isSurfacerConf_Exporter() {} + +func (*SurfacerConf_OtlpGrpcExporter) isSurfacerConf_Exporter() {} + +var File_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto protoreflect.FileDescriptor + +var file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDesc = []byte{ + 0x0a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, + 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6f, 0x74, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x19, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, + 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x6f, 0x74, 0x65, 0x6c, 0x1a, 0x48, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, + 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x6c, 0x73, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd5, 0x02, 0x0a, 0x0c, 0x48, 0x54, 0x54, 0x50, 0x45, 0x78, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x3f, 0x0a, 0x0a, 0x74, 0x6c, 0x73, 0x5f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, + 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x74, 0x6c, 0x73, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x54, 0x4c, 0x53, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x09, + 0x74, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x58, 0x0a, 0x0b, 0x68, 0x74, 0x74, + 0x70, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, + 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, + 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x6f, 0x74, 0x65, 0x6c, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x45, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, + 0x6f, 0x74, 0x65, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x3d, 0x0a, + 0x0f, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xea, 0x02, 0x0a, + 0x0c, 0x47, 0x52, 0x50, 0x43, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, + 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x0a, 0x74, 0x6c, 0x73, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x74, 0x6c, 0x73, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x54, 0x4c, 0x53, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, + 0x09, 0x74, 0x6c, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x58, 0x0a, 0x0b, 0x68, 0x74, + 0x74, 0x70, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x37, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x6f, 0x74, 0x65, 0x6c, 0x2e, 0x47, 0x52, 0x50, 0x43, + 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x63, 0x6c, 0x6f, 0x75, + 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, + 0x2e, 0x6f, 0x74, 0x65, 0x6c, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, + 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x1a, 0x3d, 0x0a, 0x0f, 0x48, 0x74, + 0x74, 0x70, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x80, 0x02, 0x0a, 0x0c, 0x53, 0x75, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x12, 0x57, 0x0a, 0x12, 0x6f, 0x74, + 0x6c, 0x70, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, + 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x6f, 0x74, + 0x65, 0x6c, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x48, + 0x00, 0x52, 0x10, 0x6f, 0x74, 0x6c, 0x70, 0x48, 0x74, 0x74, 0x70, 0x45, 0x78, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x12, 0x57, 0x0a, 0x12, 0x6f, 0x74, 0x6c, 0x70, 0x5f, 0x67, 0x72, 0x70, 0x63, + 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x6f, 0x74, 0x65, 0x6c, 0x2e, 0x47, 0x52, 0x50, 0x43, + 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x10, 0x6f, 0x74, 0x6c, 0x70, + 0x47, 0x72, 0x70, 0x63, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x13, + 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, + 0x73, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x3a, 0x02, 0x31, 0x30, 0x52, 0x11, 0x65, + 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x53, 0x65, 0x63, + 0x42, 0x0a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2a, 0x21, 0x0a, 0x0b, + 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4e, + 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x47, 0x5a, 0x49, 0x50, 0x10, 0x01, 0x42, + 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, + 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6f, 0x74, 0x65, 0x6c, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, +} + +var ( + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescOnce sync.Once + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescData = file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDesc +) + +func file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescGZIP() []byte { + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescOnce.Do(func() { + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescData) + }) + return file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDescData +} + +var file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_goTypes = []interface{}{ + (Compression)(0), // 0: cloudprober.surfacer.otel.Compression + (*HTTPExporter)(nil), // 1: cloudprober.surfacer.otel.HTTPExporter + (*GRPCExporter)(nil), // 2: cloudprober.surfacer.otel.GRPCExporter + (*SurfacerConf)(nil), // 3: cloudprober.surfacer.otel.SurfacerConf + nil, // 4: cloudprober.surfacer.otel.HTTPExporter.HttpHeaderEntry + nil, // 5: cloudprober.surfacer.otel.GRPCExporter.HttpHeaderEntry + (*proto.TLSConfig)(nil), // 6: cloudprober.tlsconfig.TLSConfig +} +var file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_depIdxs = []int32{ + 6, // 0: cloudprober.surfacer.otel.HTTPExporter.tls_config:type_name -> cloudprober.tlsconfig.TLSConfig + 4, // 1: cloudprober.surfacer.otel.HTTPExporter.http_header:type_name -> cloudprober.surfacer.otel.HTTPExporter.HttpHeaderEntry + 0, // 2: cloudprober.surfacer.otel.HTTPExporter.compression:type_name -> cloudprober.surfacer.otel.Compression + 6, // 3: cloudprober.surfacer.otel.GRPCExporter.tls_config:type_name -> cloudprober.tlsconfig.TLSConfig + 5, // 4: cloudprober.surfacer.otel.GRPCExporter.http_header:type_name -> cloudprober.surfacer.otel.GRPCExporter.HttpHeaderEntry + 0, // 5: cloudprober.surfacer.otel.GRPCExporter.compression:type_name -> cloudprober.surfacer.otel.Compression + 1, // 6: cloudprober.surfacer.otel.SurfacerConf.otlp_http_exporter:type_name -> cloudprober.surfacer.otel.HTTPExporter + 2, // 7: cloudprober.surfacer.otel.SurfacerConf.otlp_grpc_exporter:type_name -> cloudprober.surfacer.otel.GRPCExporter + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_init() +} +func file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_init() { + if File_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPExporter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GRPCExporter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SurfacerConf); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*SurfacerConf_OtlpHttpExporter)(nil), + (*SurfacerConf_OtlpGrpcExporter)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_goTypes, + DependencyIndexes: file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_depIdxs, + EnumInfos: file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_enumTypes, + MessageInfos: file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_msgTypes, + }.Build() + File_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto = out.File + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_rawDesc = nil + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_goTypes = nil + file_github_com_cloudprober_cloudprober_surfacers_internal_otel_proto_config_proto_depIdxs = nil +} diff --git a/surfacers/internal/otel/proto/config.proto b/surfacers/internal/otel/proto/config.proto new file mode 100644 index 00000000000..36762f18b65 --- /dev/null +++ b/surfacers/internal/otel/proto/config.proto @@ -0,0 +1,57 @@ +syntax = "proto2"; + +package cloudprober.surfacer.otel; + +import "github.com/cloudprober/cloudprober/internal/tlsconfig/proto/config.proto"; + +option go_package = "github.com/cloudprober/cloudprober/surfacers/internal/otel/proto"; + +enum Compression { + NONE = 0; + GZIP = 1; +} + +message HTTPExporter{ + // If no URL is provided, OpenTelemetry SDK will use the environment variable + // OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_ENDPOINT in that + // preference order. + optional string endpoint_url = 1; + + optional tlsconfig.TLSConfig tls_config = 2; + + // HTTP request headers. These can also be set using environment variables. + map http_header = 3; + + // Compression algorithm to use for HTTP requests. + optional Compression compression = 4; +} + +message GRPCExporter{ + // If no URL is provided, OpenTelemetry SDK will use the environment variable + // OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_ENDPOINT in that + // preference order. + optional string endpoint = 1; + + optional tlsconfig.TLSConfig tls_config = 2; + + // HTTP request headers. These can also be set using environment variables. + map http_header = 3; + + // Compression algorithm to use for gRPC requests. + optional Compression compression = 4; + + // Whether to use insecure gRPC connection. + optional bool insecure = 5; +} + +message SurfacerConf { + oneof exporter { + // OTLP HTTP exporter. + HTTPExporter otlp_http_exporter = 1; + + // OTLP gRPC exporter. + GRPCExporter otlp_grpc_exporter = 2; + } + + optional int32 export_interval_sec = 3 [default = 10]; +} diff --git a/surfacers/internal/otel/proto/config_proto_gen.cue b/surfacers/internal/otel/proto/config_proto_gen.cue new file mode 100644 index 00000000000..7d62a483733 --- /dev/null +++ b/surfacers/internal/otel/proto/config_proto_gen.cue @@ -0,0 +1,57 @@ +package proto + +import "github.com/cloudprober/cloudprober/internal/tlsconfig/proto" + +#Compression: {"NONE", #enumValue: 0} | + {"GZIP", #enumValue: 1} + +#Compression_value: { + NONE: 0 + GZIP: 1 +} + +#HTTPExporter: { + // If no URL is provided, OpenTelemetry SDK will use the environment variable + // OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_ENDPOINT in that + // preference order. + endpointUrl?: string @protobuf(1,string,name=endpoint_url) + tlsConfig?: proto.#TLSConfig @protobuf(2,tlsconfig.TLSConfig,name=tls_config) + + // HTTP request headers. These can also be set using environment variables. + httpHeader?: { + [string]: string + } @protobuf(3,map[string]string,http_header) + + // Compression algorithm to use for HTTP requests. + compression?: #Compression @protobuf(4,Compression) +} + +#GRPCExporter: { + // If no URL is provided, OpenTelemetry SDK will use the environment variable + // OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_ENDPOINT in that + // preference order. + endpoint?: string @protobuf(1,string) + tlsConfig?: proto.#TLSConfig @protobuf(2,tlsconfig.TLSConfig,name=tls_config) + + // HTTP request headers. These can also be set using environment variables. + httpHeader?: { + [string]: string + } @protobuf(3,map[string]string,http_header) + + // Compression algorithm to use for gRPC requests. + compression?: #Compression @protobuf(4,Compression) + + // Whether to use insecure gRPC connection. + insecure?: bool @protobuf(5,bool) +} + +#SurfacerConf: { + {} | { + // OTLP HTTP exporter. + otlpHttpExporter: #HTTPExporter @protobuf(1,HTTPExporter,name=otlp_http_exporter) + } | { + // OTLP gRPC exporter. + otlpGrpcExporter: #GRPCExporter @protobuf(2,GRPCExporter,name=otlp_grpc_exporter) + } + exportIntervalSec?: int32 @protobuf(3,int32,name=export_interval_sec,"default=10") +} diff --git a/surfacers/proto/config.pb.go b/surfacers/proto/config.pb.go index f52212e0167..317dddf2ef8 100644 --- a/surfacers/proto/config.pb.go +++ b/surfacers/proto/config.pb.go @@ -11,6 +11,7 @@ import ( proto5 "github.com/cloudprober/cloudprober/surfacers/internal/cloudwatch/proto" proto6 "github.com/cloudprober/cloudprober/surfacers/internal/datadog/proto" proto2 "github.com/cloudprober/cloudprober/surfacers/internal/file/proto" + proto9 "github.com/cloudprober/cloudprober/surfacers/internal/otel/proto" proto3 "github.com/cloudprober/cloudprober/surfacers/internal/postgres/proto" proto7 "github.com/cloudprober/cloudprober/surfacers/internal/probestatus/proto" proto "github.com/cloudprober/cloudprober/surfacers/internal/prometheus/proto" @@ -41,8 +42,9 @@ const ( Type_PUBSUB Type = 5 Type_CLOUDWATCH Type = 6 // Experimental mode. Type_DATADOG Type = 7 // Experimental mode. - Type_PROBESTATUS Type = 8 // Experimental mode. - Type_BIGQUERY Type = 9 + Type_PROBESTATUS Type = 8 + Type_BIGQUERY Type = 9 // Experimental mode. + Type_OTEL Type = 10 Type_USER_DEFINED Type = 99 ) @@ -59,6 +61,7 @@ var ( 7: "DATADOG", 8: "PROBESTATUS", 9: "BIGQUERY", + 10: "OTEL", 99: "USER_DEFINED", } Type_value = map[string]int32{ @@ -72,6 +75,7 @@ var ( "DATADOG": 7, "PROBESTATUS": 8, "BIGQUERY": 9, + "OTEL": 10, "USER_DEFINED": 99, } ) @@ -242,6 +246,7 @@ type SurfacerDef struct { // *SurfacerDef_DatadogSurfacer // *SurfacerDef_ProbestatusSurfacer // *SurfacerDef_BigquerySurfacer + // *SurfacerDef_OtelSurfacer Surfacer isSurfacerDef_Surfacer `protobuf_oneof:"surfacer"` } @@ -415,6 +420,13 @@ func (x *SurfacerDef) GetBigquerySurfacer() *proto8.SurfacerConf { return nil } +func (x *SurfacerDef) GetOtelSurfacer() *proto9.SurfacerConf { + if x, ok := x.GetSurfacer().(*SurfacerDef_OtelSurfacer); ok { + return x.OtelSurfacer + } + return nil +} + type isSurfacerDef_Surfacer interface { isSurfacerDef_Surfacer() } @@ -455,6 +467,10 @@ type SurfacerDef_BigquerySurfacer struct { BigquerySurfacer *proto8.SurfacerConf `protobuf:"bytes,18,opt,name=bigquery_surfacer,json=bigquerySurfacer,oneof"` } +type SurfacerDef_OtelSurfacer struct { + OtelSurfacer *proto9.SurfacerConf `protobuf:"bytes,19,opt,name=otel_surfacer,json=otelSurfacer,oneof"` +} + func (*SurfacerDef_PrometheusSurfacer) isSurfacerDef_Surfacer() {} func (*SurfacerDef_StackdriverSurfacer) isSurfacerDef_Surfacer() {} @@ -473,6 +489,8 @@ func (*SurfacerDef_ProbestatusSurfacer) isSurfacerDef_Surfacer() {} func (*SurfacerDef_BigquerySurfacer) isSurfacerDef_Surfacer() {} +func (*SurfacerDef_OtelSurfacer) isSurfacerDef_Surfacer() {} + var File_github_com_cloudprober_cloudprober_surfacers_proto_config_proto protoreflect.FileDescriptor var file_github_com_cloudprober_cloudprober_surfacers_proto_config_proto_rawDesc = []byte{ @@ -496,142 +514,152 @@ var file_github_com_cloudprober_cloudprober_surfacers_proto_config_proto_rawDesc 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x51, 0x67, + 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x54, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, - 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, - 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, - 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, - 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x4f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, - 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, - 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x54, 0x67, 0x69, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6f, 0x74, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x51, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x51, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x62, 0x69, 0x67, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xd9, 0x0a, 0x0a, - 0x0b, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x44, 0x65, 0x66, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, - 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, - 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x35, 0x0a, 0x13, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x62, 0x75, 0x66, 0x66, - 0x65, 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x05, 0x31, - 0x30, 0x30, 0x30, 0x30, 0x52, 0x11, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x75, 0x66, - 0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x5a, 0x0a, 0x18, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6c, 0x61, - 0x62, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6c, 0x6f, 0x75, - 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, - 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x15, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x12, 0x5c, 0x0a, 0x19, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, - 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x16, 0x69, 0x67, 0x6e, 0x6f, 0x72, - 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, - 0x6c, 0x12, 0x35, 0x0a, 0x17, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, - 0x57, 0x69, 0x74, 0x68, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x69, 0x67, 0x6e, 0x6f, - 0x72, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x69, 0x67, 0x6e, 0x6f, - 0x72, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x64, 0x64, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, - 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, - 0x64, 0x64, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, - 0x26, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x67, 0x61, 0x75, - 0x67, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, - 0x41, 0x73, 0x47, 0x61, 0x75, 0x67, 0x65, 0x12, 0x60, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x6d, 0x65, - 0x74, 0x68, 0x65, 0x75, 0x73, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, - 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x6d, - 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, - 0x73, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x63, 0x0a, 0x14, 0x73, 0x74, 0x61, - 0x63, 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, - 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, - 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x73, - 0x74, 0x61, 0x63, 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, - 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x13, 0x73, 0x74, 0x61, 0x63, 0x6b, - 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x4e, - 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, - 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x66, 0x69, 0x6c, - 0x65, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, - 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x5a, - 0x0a, 0x11, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, - 0x63, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6c, 0x6f, 0x75, - 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, - 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, - 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, - 0x65, 0x73, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x0f, 0x70, 0x75, - 0x62, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x0e, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, - 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x75, 0x62, 0x73, 0x75, - 0x62, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, - 0x52, 0x0e, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, - 0x12, 0x60, 0x0a, 0x13, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x77, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, - 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x54, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, + 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, + 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, + 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x4f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, + 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, + 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x54, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, + 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, + 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x2f, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x51, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, + 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, + 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x62, 0x69, 0x67, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa9, 0x0b, 0x0a, 0x0b, + 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x44, 0x65, 0x66, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, - 0x61, 0x63, 0x65, 0x72, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x77, 0x61, 0x74, 0x63, 0x68, 0x2e, - 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x12, - 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x77, 0x61, 0x74, 0x63, 0x68, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, - 0x65, 0x72, 0x12, 0x57, 0x0a, 0x10, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x5f, 0x73, 0x75, - 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, + 0x61, 0x63, 0x65, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x35, 0x0a, 0x13, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x62, 0x75, 0x66, 0x66, 0x65, + 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x3a, 0x05, 0x31, 0x30, + 0x30, 0x30, 0x30, 0x52, 0x11, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x75, 0x66, 0x66, + 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x5a, 0x0a, 0x18, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x15, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x12, 0x5c, 0x0a, 0x19, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x5f, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, + 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x16, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x12, 0x35, 0x0a, 0x17, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x14, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x57, + 0x69, 0x74, 0x68, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x69, 0x67, 0x6e, 0x6f, 0x72, + 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x69, 0x67, 0x6e, 0x6f, 0x72, + 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x64, 0x64, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x5f, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x64, + 0x64, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x26, + 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x67, 0x61, 0x75, 0x67, + 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x41, + 0x73, 0x47, 0x61, 0x75, 0x67, 0x65, 0x12, 0x60, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, + 0x68, 0x65, 0x75, 0x73, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, + 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, + 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, + 0x6e, 0x66, 0x48, 0x00, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, + 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x63, 0x0a, 0x14, 0x73, 0x74, 0x61, 0x63, + 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, + 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x73, 0x74, + 0x61, 0x63, 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x13, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x64, + 0x72, 0x69, 0x76, 0x65, 0x72, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x4e, 0x0a, + 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x66, 0x69, 0x6c, 0x65, + 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, + 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x5a, 0x0a, + 0x11, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, + 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, + 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x74, 0x67, 0x72, 0x65, + 0x73, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x0f, 0x70, 0x75, 0x62, + 0x73, 0x75, 0x62, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, + 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, + 0x0e, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, + 0x60, 0x0a, 0x13, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x77, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x75, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, - 0x63, 0x65, 0x72, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x53, 0x75, 0x72, 0x66, - 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x0f, 0x64, 0x61, 0x74, 0x61, - 0x64, 0x6f, 0x67, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x63, 0x0a, 0x14, 0x70, - 0x72, 0x6f, 0x62, 0x65, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, - 0x63, 0x65, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x6c, 0x6f, 0x75, - 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x75, 0x72, - 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x13, 0x70, 0x72, 0x6f, - 0x62, 0x65, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, - 0x12, 0x5a, 0x0a, 0x11, 0x62, 0x69, 0x67, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x75, 0x72, - 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6c, + 0x63, 0x65, 0x72, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x77, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x53, + 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x12, 0x63, + 0x6c, 0x6f, 0x75, 0x64, 0x77, 0x61, 0x74, 0x63, 0x68, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, + 0x72, 0x12, 0x57, 0x0a, 0x10, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x5f, 0x73, 0x75, 0x72, + 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, - 0x65, 0x72, 0x2e, 0x62, 0x69, 0x67, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x75, 0x72, 0x66, - 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x10, 0x62, 0x69, 0x67, 0x71, - 0x75, 0x65, 0x72, 0x79, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x42, 0x0a, 0x0a, 0x08, - 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2a, 0xa3, 0x01, 0x0a, 0x04, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50, - 0x52, 0x4f, 0x4d, 0x45, 0x54, 0x48, 0x45, 0x55, 0x53, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x53, - 0x54, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, - 0x46, 0x49, 0x4c, 0x45, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, - 0x45, 0x53, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x55, 0x42, 0x53, 0x55, 0x42, 0x10, 0x05, - 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x57, 0x41, 0x54, 0x43, 0x48, 0x10, 0x06, - 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x41, 0x54, 0x41, 0x44, 0x4f, 0x47, 0x10, 0x07, 0x12, 0x0f, 0x0a, - 0x0b, 0x50, 0x52, 0x4f, 0x42, 0x45, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x08, 0x12, 0x0c, - 0x0a, 0x08, 0x42, 0x49, 0x47, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10, 0x09, 0x12, 0x10, 0x0a, 0x0c, - 0x55, 0x53, 0x45, 0x52, 0x5f, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x63, 0x42, 0x34, - 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, - 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, - 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, + 0x65, 0x72, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, + 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x0f, 0x64, 0x61, 0x74, 0x61, 0x64, + 0x6f, 0x67, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x63, 0x0a, 0x14, 0x70, 0x72, + 0x6f, 0x62, 0x65, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, + 0x70, 0x72, 0x6f, 0x62, 0x65, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x75, 0x72, 0x66, + 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x13, 0x70, 0x72, 0x6f, 0x62, + 0x65, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, + 0x5a, 0x0a, 0x11, 0x62, 0x69, 0x67, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x73, 0x75, 0x72, 0x66, + 0x61, 0x63, 0x65, 0x72, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, + 0x72, 0x2e, 0x62, 0x69, 0x67, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x75, 0x72, 0x66, 0x61, + 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x10, 0x62, 0x69, 0x67, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x0d, 0x6f, + 0x74, 0x65, 0x6c, 0x5f, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x18, 0x13, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x6f, 0x74, 0x65, 0x6c, 0x2e, 0x53, + 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x48, 0x00, 0x52, 0x0c, 0x6f, + 0x74, 0x65, 0x6c, 0x53, 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x42, 0x0a, 0x0a, 0x08, 0x73, + 0x75, 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x2a, 0xad, 0x01, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x52, + 0x4f, 0x4d, 0x45, 0x54, 0x48, 0x45, 0x55, 0x53, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, + 0x41, 0x43, 0x4b, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x46, + 0x49, 0x4c, 0x45, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45, + 0x53, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x55, 0x42, 0x53, 0x55, 0x42, 0x10, 0x05, 0x12, + 0x0e, 0x0a, 0x0a, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x57, 0x41, 0x54, 0x43, 0x48, 0x10, 0x06, 0x12, + 0x0b, 0x0a, 0x07, 0x44, 0x41, 0x54, 0x41, 0x44, 0x4f, 0x47, 0x10, 0x07, 0x12, 0x0f, 0x0a, 0x0b, + 0x50, 0x52, 0x4f, 0x42, 0x45, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x08, 0x12, 0x0c, 0x0a, + 0x08, 0x42, 0x49, 0x47, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10, 0x09, 0x12, 0x08, 0x0a, 0x04, 0x4f, + 0x54, 0x45, 0x4c, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x44, 0x45, + 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x63, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, + 0x72, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x70, 0x72, 0x6f, 0x62, 0x65, 0x72, 0x2f, 0x73, 0x75, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x72, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, } var ( @@ -661,6 +689,7 @@ var file_github_com_cloudprober_cloudprober_surfacers_proto_config_proto_goTypes (*proto6.SurfacerConf)(nil), // 9: cloudprober.surfacer.datadog.SurfacerConf (*proto7.SurfacerConf)(nil), // 10: cloudprober.surfacer.probestatus.SurfacerConf (*proto8.SurfacerConf)(nil), // 11: cloudprober.surfacer.bigquery.SurfacerConf + (*proto9.SurfacerConf)(nil), // 12: cloudprober.surfacer.otel.SurfacerConf } var file_github_com_cloudprober_cloudprober_surfacers_proto_config_proto_depIdxs = []int32{ 0, // 0: cloudprober.surfacer.SurfacerDef.type:type_name -> cloudprober.surfacer.Type @@ -675,11 +704,12 @@ var file_github_com_cloudprober_cloudprober_surfacers_proto_config_proto_depIdxs 9, // 9: cloudprober.surfacer.SurfacerDef.datadog_surfacer:type_name -> cloudprober.surfacer.datadog.SurfacerConf 10, // 10: cloudprober.surfacer.SurfacerDef.probestatus_surfacer:type_name -> cloudprober.surfacer.probestatus.SurfacerConf 11, // 11: cloudprober.surfacer.SurfacerDef.bigquery_surfacer:type_name -> cloudprober.surfacer.bigquery.SurfacerConf - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 12, // 12: cloudprober.surfacer.SurfacerDef.otel_surfacer:type_name -> cloudprober.surfacer.otel.SurfacerConf + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_github_com_cloudprober_cloudprober_surfacers_proto_config_proto_init() } @@ -723,6 +753,7 @@ func file_github_com_cloudprober_cloudprober_surfacers_proto_config_proto_init() (*SurfacerDef_DatadogSurfacer)(nil), (*SurfacerDef_ProbestatusSurfacer)(nil), (*SurfacerDef_BigquerySurfacer)(nil), + (*SurfacerDef_OtelSurfacer)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/surfacers/proto/config.proto b/surfacers/proto/config.proto index ee2d3c02c43..5e1fc38b491 100644 --- a/surfacers/proto/config.proto +++ b/surfacers/proto/config.proto @@ -5,6 +5,7 @@ package cloudprober.surfacer; import "github.com/cloudprober/cloudprober/surfacers/internal/cloudwatch/proto/config.proto"; import "github.com/cloudprober/cloudprober/surfacers/internal/datadog/proto/config.proto"; import "github.com/cloudprober/cloudprober/surfacers/internal/file/proto/config.proto"; +import "github.com/cloudprober/cloudprober/surfacers/internal/otel/proto/config.proto"; import "github.com/cloudprober/cloudprober/surfacers/internal/postgres/proto/config.proto"; import "github.com/cloudprober/cloudprober/surfacers/internal/probestatus/proto/config.proto"; import "github.com/cloudprober/cloudprober/surfacers/internal/prometheus/proto/config.proto"; @@ -24,8 +25,9 @@ enum Type { PUBSUB = 5; CLOUDWATCH = 6; // Experimental mode. DATADOG = 7; // Experimental mode. - PROBESTATUS = 8; // Experimental mode. - BIGQUERY = 9; + PROBESTATUS = 8; + BIGQUERY = 9; // Experimental mode. + OTEL = 10; USER_DEFINED = 99; } @@ -106,5 +108,6 @@ message SurfacerDef { datadog.SurfacerConf datadog_surfacer = 16; probestatus.SurfacerConf probestatus_surfacer = 17; bigquery.SurfacerConf bigquery_surfacer = 18; + otel.SurfacerConf otel_surfacer = 19; } } diff --git a/surfacers/proto/config_proto_gen.cue b/surfacers/proto/config_proto_gen.cue index f42eb49f2f1..d926f70784a 100644 --- a/surfacers/proto/config_proto_gen.cue +++ b/surfacers/proto/config_proto_gen.cue @@ -10,6 +10,7 @@ import ( proto_B "github.com/cloudprober/cloudprober/surfacers/internal/datadog/proto" proto_36 "github.com/cloudprober/cloudprober/surfacers/internal/probestatus/proto" proto_9 "github.com/cloudprober/cloudprober/surfacers/internal/bigquery/proto" + proto_3 "github.com/cloudprober/cloudprober/surfacers/internal/otel/proto" ) // Enumeration for each type of surfacer we can parse and create @@ -23,11 +24,11 @@ import ( #enumValue: 6 } | { "DATADOG"// Experimental mode. - #enumValue: 7 - } | { - "PROBESTATUS"// Experimental mode. - #enumValue: 8 - } | {"BIGQUERY", #enumValue: 9} | + #enumValue: 7 + } | {"PROBESTATUS", #enumValue: 8} | { + "BIGQUERY"// Experimental mode. + #enumValue: 9 + } | {"OTEL", #enumValue: 10} | {"USER_DEFINED", #enumValue: 99} #Type_value: { @@ -41,6 +42,7 @@ import ( DATADOG: 7 PROBESTATUS: 8 BIGQUERY: 9 + OTEL: 10 USER_DEFINED: 99 } @@ -127,5 +129,7 @@ import ( probestatusSurfacer: proto_36.#SurfacerConf @protobuf(17,probestatus.SurfacerConf,name=probestatus_surfacer) } | { bigquerySurfacer: proto_9.#SurfacerConf @protobuf(18,bigquery.SurfacerConf,name=bigquery_surfacer) + } | { + otelSurfacer: proto_3.#SurfacerConf @protobuf(19,otel.SurfacerConf,name=otel_surfacer) } } diff --git a/surfacers/surfacers.go b/surfacers/surfacers.go index 8966ec87439..a740e3b6d28 100644 --- a/surfacers/surfacers.go +++ b/surfacers/surfacers.go @@ -39,6 +39,7 @@ import ( "github.com/cloudprober/cloudprober/surfacers/internal/common/transform" "github.com/cloudprober/cloudprober/surfacers/internal/datadog" "github.com/cloudprober/cloudprober/surfacers/internal/file" + "github.com/cloudprober/cloudprober/surfacers/internal/otel" "github.com/cloudprober/cloudprober/surfacers/internal/postgres" "github.com/cloudprober/cloudprober/surfacers/internal/probestatus" "github.com/cloudprober/cloudprober/surfacers/internal/prometheus" @@ -162,7 +163,8 @@ func inferType(s *surfacerpb.SurfacerDef) surfacerpb.Type { return surfacerpb.Type_PROBESTATUS case *surfacerpb.SurfacerDef_BigquerySurfacer: return surfacerpb.Type_BIGQUERY - + case *surfacerpb.SurfacerDef_OtelSurfacer: + return surfacerpb.Type_OTEL } return surfacerpb.Type_NONE @@ -214,6 +216,9 @@ func initSurfacer(ctx context.Context, s *surfacerpb.SurfacerDef, sType surfacer case surfacerpb.Type_BIGQUERY: surfacer, err = bigquery.New(ctx, s.GetBigquerySurfacer(), opts, l) conf = s.GetBigquerySurfacer() + case surfacerpb.Type_OTEL: + surfacer, err = otel.New(ctx, s.GetOtelSurfacer(), opts, l) + conf = s.GetOtelSurfacer() case surfacerpb.Type_USER_DEFINED: userDefinedSurfacersMu.Lock() defer userDefinedSurfacersMu.Unlock() diff --git a/surfacers/surfacers_test.go b/surfacers/surfacers_test.go index 8cde6e6154d..a03732e34ec 100644 --- a/surfacers/surfacers_test.go +++ b/surfacers/surfacers_test.go @@ -71,6 +71,7 @@ func TestInferType(t *testing.T) { "PUBSUB": {Surfacer: &surfacerpb.SurfacerDef_PubsubSurfacer{}}, "STACKDRIVER": {Surfacer: &surfacerpb.SurfacerDef_StackdriverSurfacer{}}, "BIGQUERY": {Surfacer: &surfacerpb.SurfacerDef_BigquerySurfacer{}}, + "OTEL": {Surfacer: &surfacerpb.SurfacerDef_OtelSurfacer{}}, } for k := range surfacerpb.Type_value {