From 76a5d4e9a28a65a49d7c16a376f14c8ec643b873 Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Thu, 29 Feb 2024 17:00:42 +0000 Subject: [PATCH 1/9] Update collector to use common data types from telemetry-exporter --- go.mod | 28 +++++++------ go.sum | 64 ++++++++++++++++-------------- internal/telemetry/cluster.go | 4 +- internal/telemetry/cluster_test.go | 2 +- internal/telemetry/collector.go | 29 ++++++++------ internal/telemetry/exporter.go | 26 ++---------- 6 files changed, 74 insertions(+), 79 deletions(-) diff --git a/go.mod b/go.mod index a5b515e3aa..4d6dc0a9b9 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nginxinc/kubernetes-ingress -go 1.21.3 +go 1.22.0 require ( github.com/aws/aws-sdk-go-v2/config v1.27.0 @@ -15,11 +15,12 @@ require ( github.com/nginxinc/nginx-plus-go-client v1.2.0 github.com/nginxinc/nginx-prometheus-exporter v1.1.0 github.com/nginxinc/nginx-service-mesh v1.7.0 + github.com/nginxinc/telemetry-exporter v0.0.0-00010101000000-000000000000 github.com/prometheus/client_golang v1.18.0 github.com/prometheus/common v0.47.0 github.com/spiffe/go-spiffe/v2 v2.1.7 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel v1.24.0 golang.org/x/exp v0.0.0-20231226003508-02704c960a9b k8s.io/api v0.29.2 k8s.io/apimachinery v0.29.2 @@ -74,7 +75,7 @@ require ( github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -83,6 +84,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -99,28 +101,28 @@ require ( go.etcd.io/etcd/client/v3 v3.5.11 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/sdk v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/sdk v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.opentelemetry.io/proto/otlp v1.1.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/crypto v0.18.0 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.20.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.16.1 // indirect + golang.org/x/tools v0.17.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/grpc v1.60.1 // indirect + google.golang.org/grpc v1.61.1 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect @@ -139,3 +141,5 @@ require ( ) replace github.com/golang/glog => github.com/nginxinc/glog v1.1.2 + +replace github.com/nginxinc/telemetry-exporter => /Users/s.odonovan/github.com/nginxinc/telemetry-exporter diff --git a/go.sum b/go.sum index d0a882e37d..0afb39a798 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,8 @@ github.com/cert-manager/cert-manager v1.14.2 h1:C/uci6yxiCRO04PWomBbSX+T4JT58FII github.com/cert-manager/cert-manager v1.14.2/go.mod h1:pik7K6jXfgh++lfVJ/i1HzEnDluSUtTVLXSHikj8Lho= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= @@ -144,8 +144,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -172,6 +172,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1 h1:NicmruxkeqHjDv03SfSxqmaLuisddudfP3h5wdXFbhM= +github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1/go.mod h1:eyp4DdUJAKkr9tvxR3jWhw2mDK7CWABMG5r9uyaKC7I= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -191,10 +193,10 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo= +github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -213,6 +215,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= +github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= @@ -262,20 +266,20 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.4 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= -go.opentelemetry.io/otel v1.23.1 h1:Za4UzOqJYS+MUczKI320AtqZHZb7EqxO00jAHE0jmQY= -go.opentelemetry.io/otel v1.23.1/go.mod h1:Td0134eafDLcTS4y+zQ26GE8u3dEuRBiBCTUIRHaikA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 h1:cl5P5/GIfFh4t6xyruOgJP5QiA1pw4fYYdv6nc6CBWw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0/go.mod h1:zgBdWWAu7oEEMC06MMKc5NLbA/1YDXV1sMpSqEeLQLg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 h1:tIqheXEFWAZ7O8A7m+J0aPTmpJN3YQ7qetUAdkkkKpk= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0/go.mod h1:nUeKExfxAQVbiVFn32YXpXZZHZ61Cc3s3Rn1pDBGAb0= -go.opentelemetry.io/otel/metric v1.23.1 h1:PQJmqJ9u2QaJLBOELl1cxIdPcpbwzbkjfEyelTl2rlo= -go.opentelemetry.io/otel/metric v1.23.1/go.mod h1:mpG2QPlAfnK8yNhNJAxDZruU9Y1/HubbC+KyH8FaCWI= -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/trace v1.23.1 h1:4LrmmEd8AU2rFvU1zegmvqW7+kWarxtNOPyeL6HmYY8= -go.opentelemetry.io/otel/trace v1.23.1/go.mod h1:4IpnpJFwr1mo/6HL8XIPJaE9y0+u1KcVmuW7dwFSVrI= -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= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -315,8 +319,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -329,8 +333,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -356,8 +360,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -370,8 +374,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/internal/telemetry/cluster.go b/internal/telemetry/cluster.go index 076c0be4e1..e3f16dd4c9 100644 --- a/internal/telemetry/cluster.go +++ b/internal/telemetry/cluster.go @@ -26,9 +26,9 @@ func (c *Collector) ClusterID(ctx context.Context) (string, error) { return string(cluster.UID), nil } -// K8sVersion returns a string respresenting the K8s version. +// ClusterVersion returns a string respresenting the K8s version. // It returns an error if the underlying k8s API client errors. -func (c *Collector) K8sVersion() (string, error) { +func (c *Collector) ClusterVersion() (string, error) { sv, err := c.Config.K8sClientReader.Discovery().ServerVersion() if err != nil { return "", err diff --git a/internal/telemetry/cluster_test.go b/internal/telemetry/cluster_test.go index 6671536456..162e576641 100644 --- a/internal/telemetry/cluster_test.go +++ b/internal/telemetry/cluster_test.go @@ -69,7 +69,7 @@ func TestK8sVersionRetrievesClusterVersion(t *testing.T) { t.Parallel() c := newTestCollectorForClusterWithNodes(t, node1) - got, err := c.K8sVersion() + got, err := c.ClusterVersion() if err != nil { t.Fatal(err) } diff --git a/internal/telemetry/collector.go b/internal/telemetry/collector.go index 6c12223426..1a71e6b05c 100644 --- a/internal/telemetry/collector.go +++ b/internal/telemetry/collector.go @@ -3,6 +3,7 @@ package telemetry import ( "context" + telemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" "io" "runtime" "time" @@ -95,14 +96,13 @@ func (c *Collector) Collect(ctx context.Context) { } // BuildReport takes context and builds report from gathered telemetry data. -func (c *Collector) BuildReport(ctx context.Context) (Data, error) { - pm := ProjectMeta{ - Name: "NIC", - Version: c.Config.Version, - } +func (c *Collector) BuildReport(ctx context.Context) (telemetry.Exportable, error) { d := Data{ - ProjectMeta: pm, - Arch: runtime.GOARCH, + Data: telemetry.Data{ + ProjectName: "NIC", + ProjectVersion: c.Config.Version, + ProjectArchitecture: runtime.GOARCH, + }, } var err error @@ -113,16 +113,21 @@ func (c *Collector) BuildReport(ctx context.Context) (Data, error) { d.TransportServers = int64(c.Config.Configurator.GetTransportServerCounts()) } - if d.NodeCount, err = c.NodeCount(ctx); err != nil { - glog.Errorf("Error collecting telemetry data: Nodes: %v", err) - } - if d.ClusterID, err = c.ClusterID(ctx); err != nil { glog.Errorf("Error collecting telemetry data: ClusterID: %v", err) } - if d.K8sVersion, err = c.K8sVersion(); err != nil { + if d.ClusterNodeCount, err = c.NodeCount(ctx); err != nil { + glog.Errorf("Error collecting telemetry data: Nodes: %v", err) + } + + if d.ClusterVersion, err = c.ClusterVersion(); err != nil { glog.Errorf("Error collecting telemetry data: K8s Version: %v", err) } + + // TODO: Get Cluster (k8s) platform. e.g. EKS, AWS, Openshift, etc... + + // TODO: Get InstallationID + // example of how NGF gets this ID https://github.com/nginxinc/nginx-gateway-fabric/blob/f33db51fc9e05ccf98fc8cdae100772a5cc6775e/internal/mode/static/telemetry/collector.go#L244-L248 return d, err } diff --git a/internal/telemetry/exporter.go b/internal/telemetry/exporter.go index 19793d22e2..ac87ecd5c5 100644 --- a/internal/telemetry/exporter.go +++ b/internal/telemetry/exporter.go @@ -3,15 +3,13 @@ package telemetry import ( "context" "fmt" + "github.com/nginxinc/telemetry-exporter/pkg/telemetry" "io" - - "go.opentelemetry.io/otel/attribute" ) // Exporter interface for exporters. type Exporter interface { - // TODO Change Data to Exportable. - Export(ctx context.Context, data Data) error + Export(ctx context.Context, data telemetry.Exportable) error } // StdoutExporter represents a temporary telemetry data exporter. @@ -20,25 +18,15 @@ type StdoutExporter struct { } // Export takes context and trace data and writes to the endpoint. -func (e *StdoutExporter) Export(_ context.Context, data Data) error { +func (e *StdoutExporter) Export(_ context.Context, data telemetry.Exportable) error { fmt.Fprintf(e.Endpoint, "%+v", data) return nil } // Data holds collected telemetry data. type Data struct { - ProjectMeta + telemetry.Data NICResourceCounts - NodeCount int64 - ClusterID string - K8sVersion string - Arch string -} - -// ProjectMeta holds metadata for the project. -type ProjectMeta struct { - Name string - Version string } // NICResourceCounts holds a count of NIC specific resource. @@ -47,9 +35,3 @@ type NICResourceCounts struct { VirtualServerRoutes int64 TransportServers int64 } - -// Attributes is a placeholder function. -// This ensures that Data is of type Exportable -func (d *Data) Attributes() []attribute.KeyValue { - return nil -} From 007419a557b60ba66ffed812471a63e346ae3c6d Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Tue, 5 Mar 2024 12:07:03 +0000 Subject: [PATCH 2/9] Integrate telemetry exporter --- internal/telemetry/collector.go | 2 +- internal/telemetry/collector_test.go | 228 ++++++------------ internal/telemetry/data.avdl | 45 ++++ .../telemetry/data_attributes_generated.go | 25 ++ internal/telemetry/exporter.go | 11 +- .../nicresourcecounts_attributes_generated.go | 26 ++ 6 files changed, 176 insertions(+), 161 deletions(-) create mode 100644 internal/telemetry/data.avdl create mode 100644 internal/telemetry/data_attributes_generated.go create mode 100644 internal/telemetry/nicresourcecounts_attributes_generated.go diff --git a/internal/telemetry/collector.go b/internal/telemetry/collector.go index 1a71e6b05c..da7fd73f66 100644 --- a/internal/telemetry/collector.go +++ b/internal/telemetry/collector.go @@ -129,5 +129,5 @@ func (c *Collector) BuildReport(ctx context.Context) (telemetry.Exportable, erro // TODO: Get InstallationID // example of how NGF gets this ID https://github.com/nginxinc/nginx-gateway-fabric/blob/f33db51fc9e05ccf98fc8cdae100772a5cc6775e/internal/mode/static/telemetry/collector.go#L244-L248 - return d, err + return &d, err } diff --git a/internal/telemetry/collector_test.go b/internal/telemetry/collector_test.go index 96a524a0de..1e8da2ceb4 100644 --- a/internal/telemetry/collector_test.go +++ b/internal/telemetry/collector_test.go @@ -16,6 +16,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/nginxinc/kubernetes-ingress/internal/telemetry" conf_v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" + exporter "github.com/nginxinc/telemetry-exporter/pkg/telemetry" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8sruntime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/version" @@ -23,6 +24,15 @@ import ( testClient "k8s.io/client-go/kubernetes/fake" ) +var ( + commonData = exporter.Data{ + ProjectName: "NIC", + ProjectVersion: "3.5.0", + ClusterVersion: "v1.29.2", + ProjectArchitecture: runtime.GOARCH, + } +) + func TestCreateNewCollectorWithCustomReportingPeriod(t *testing.T) { t.Parallel() @@ -61,14 +71,14 @@ func TestCreateNewCollectorWithCustomExporter(t *testing.T) { c.Collect(context.Background()) td := telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", + Data: exporter.Data{ + ProjectName: "NIC", + ProjectVersion: "3.5.0", + ClusterVersion: "v1.29.2", + ProjectArchitecture: runtime.GOARCH, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, } - want := fmt.Sprintf("%+v", td) + want := fmt.Sprintf("%+v", &td) got := buf.String() if !cmp.Equal(want, got) { t.Error(cmp.Diff(want, got)) @@ -93,20 +103,21 @@ func TestCollectNodeCountInClusterWithOneNode(t *testing.T) { c.Collect(context.Background()) td := telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", + Data: exporter.Data{ + ProjectName: "NIC", + ProjectVersion: "3.5.0", + ClusterVersion: "v1.29.2", + ProjectArchitecture: runtime.GOARCH, + ClusterNodeCount: 1, }, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 0, VirtualServerRoutes: 0, TransportServers: 0, }, - NodeCount: 1, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, } - want := fmt.Sprintf("%+v", td) + + want := fmt.Sprintf("%+v", &td) got := buf.String() if !cmp.Equal(want, got) { t.Error(cmp.Diff(want, got)) @@ -131,20 +142,20 @@ func TestCollectNodeCountInClusterWithThreeNodes(t *testing.T) { c.Collect(context.Background()) td := telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", + Data: exporter.Data{ + ProjectName: "NIC", + ProjectVersion: "3.5.0", + ClusterVersion: "v1.29.2", + ProjectArchitecture: runtime.GOARCH, + ClusterNodeCount: 3, }, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 0, VirtualServerRoutes: 0, TransportServers: 0, }, - NodeCount: 3, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, } - want := fmt.Sprintf("%+v", td) + want := fmt.Sprintf("%+v", &td) got := buf.String() if !cmp.Equal(want, got) { t.Error(cmp.Diff(want, got)) @@ -169,60 +180,21 @@ func TestCollectClusterIDInClusterWithOneNode(t *testing.T) { c.Collect(context.Background()) td := telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, - NICResourceCounts: telemetry.NICResourceCounts{ - VirtualServers: 0, - VirtualServerRoutes: 0, - TransportServers: 0, - }, - NodeCount: 1, - ClusterID: "329766ff-5d78-4c9e-8736-7faad1f2e937", - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, - } - want := fmt.Sprintf("%+v", td) - got := buf.String() - if !cmp.Equal(want, got) { - t.Error(cmp.Diff(want, got)) - } -} - -func TestCollectK8sVersion(t *testing.T) { - t.Parallel() - - buf := &bytes.Buffer{} - exp := &telemetry.StdoutExporter{Endpoint: buf} - cfg := telemetry.CollectorConfig{ - Configurator: newConfigurator(t), - K8sClientReader: newTestClientset(node1, kubeNS), - Version: "3.5.0", - } - - c, err := telemetry.NewCollector(cfg, telemetry.WithExporter(exp)) - if err != nil { - t.Fatal(err) - } - c.Collect(context.Background()) - - td := telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", + Data: exporter.Data{ + ProjectName: "NIC", + ProjectVersion: "3.5.0", + ClusterVersion: "v1.29.2", + ProjectArchitecture: runtime.GOARCH, + ClusterNodeCount: 1, + ClusterID: "329766ff-5d78-4c9e-8736-7faad1f2e937", }, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 0, VirtualServerRoutes: 0, TransportServers: 0, }, - NodeCount: 1, - ClusterID: "329766ff-5d78-4c9e-8736-7faad1f2e937", - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, } - want := fmt.Sprintf("%+v", td) + want := fmt.Sprintf("%+v", &td) got := buf.String() if !cmp.Equal(want, got) { t.Error(cmp.Diff(want, got)) @@ -234,34 +206,24 @@ func TestCountVirtualServers(t *testing.T) { testCases := []struct { testName string - expectedTraceDataOnAdd telemetry.Data - expectedTraceDataOnDelete telemetry.Data + expectedTraceDataOnAdd *telemetry.Data + expectedTraceDataOnDelete *telemetry.Data virtualServers []*configs.VirtualServerEx deleteCount int }{ { testName: "Create and delete 1 VirtualServer", - expectedTraceDataOnAdd: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnAdd: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 1, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, - expectedTraceDataOnDelete: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnDelete: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 0, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, virtualServers: []*configs.VirtualServerEx{ { @@ -278,27 +240,17 @@ func TestCountVirtualServers(t *testing.T) { }, { testName: "Create 2 VirtualServers and delete 2", - expectedTraceDataOnAdd: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnAdd: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 2, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, - expectedTraceDataOnDelete: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnDelete: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 0, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, virtualServers: []*configs.VirtualServerEx{ { @@ -324,27 +276,17 @@ func TestCountVirtualServers(t *testing.T) { }, { testName: "Create 2 VirtualServers and delete 1", - expectedTraceDataOnAdd: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnAdd: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 2, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, - expectedTraceDataOnDelete: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnDelete: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ VirtualServers: 1, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, virtualServers: []*configs.VirtualServerEx{ { @@ -423,34 +365,24 @@ func TestCountTransportServers(t *testing.T) { testCases := []struct { testName string - expectedTraceDataOnAdd telemetry.Data - expectedTraceDataOnDelete telemetry.Data + expectedTraceDataOnAdd *telemetry.Data + expectedTraceDataOnDelete *telemetry.Data transportServers []*configs.TransportServerEx deleteCount int }{ { testName: "Create and delete 1 TransportServer", - expectedTraceDataOnAdd: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnAdd: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ TransportServers: 1, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, - expectedTraceDataOnDelete: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnDelete: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ TransportServers: 0, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, transportServers: []*configs.TransportServerEx{ { @@ -471,27 +403,17 @@ func TestCountTransportServers(t *testing.T) { }, { testName: "Create 2 and delete 2 TransportServer", - expectedTraceDataOnAdd: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnAdd: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ TransportServers: 2, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, - expectedTraceDataOnDelete: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnDelete: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ TransportServers: 0, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, transportServers: []*configs.TransportServerEx{ { @@ -525,27 +447,17 @@ func TestCountTransportServers(t *testing.T) { }, { testName: "Create 2 and delete 1 TransportServer", - expectedTraceDataOnAdd: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnAdd: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ TransportServers: 2, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, - expectedTraceDataOnDelete: telemetry.Data{ - ProjectMeta: telemetry.ProjectMeta{ - Name: "NIC", - Version: "3.5.0", - }, + expectedTraceDataOnDelete: &telemetry.Data{ + Data: commonData, NICResourceCounts: telemetry.NICResourceCounts{ TransportServers: 1, }, - K8sVersion: "v1.29.2", - Arch: runtime.GOARCH, }, transportServers: []*configs.TransportServerEx{ { @@ -687,11 +599,11 @@ func newConfigurator(t *testing.T) *configs.Configurator { // Platform string // } func newTestClientset(objects ...k8sruntime.Object) *testClient.Clientset { - testClient := testClient.NewSimpleClientset(objects...) - testClient.Discovery().(*fakediscovery.FakeDiscovery).FakedServerVersion = &version.Info{ + client := testClient.NewSimpleClientset(objects...) + client.Discovery().(*fakediscovery.FakeDiscovery).FakedServerVersion = &version.Info{ GitVersion: "v1.29.2", } - return testClient + return client } const ( diff --git a/internal/telemetry/data.avdl b/internal/telemetry/data.avdl new file mode 100644 index 0000000000..f53fbd05ea --- /dev/null +++ b/internal/telemetry/data.avdl @@ -0,0 +1,45 @@ +@namespace("ingress.nginx.com") protocol NICProductTelemetry { + @df_datatype("nic-product-telemetry") record Data { + /** The field that identifies what type of data this is. */ + string dataType; + /** The time the event occurred */ + long eventTime; + /** The time our edge ingested the event */ + long ingestTime; + + + /** ProjectName is the name of the project. */ + string? projectName = null; + + /** ProjectVersion is the version of the project. */ + string? projectVersion = null; + + /** ProjectArchitecture is the architecture the project. For example, "amd64". */ + string? projectArchitecture = null; + + /** ClusterID is the unique id of the Kubernetes cluster where the project is installed. */ + string? clusterID = null; + + /** ClusterNodeCount is the number of nodes in the cluster. */ + long? clusterNodeCount = null; + + /** ClusterVersion is the Kubernetes version of the cluster. */ + string? clusterVersion = null; + + /** ClusterPlatform is the Kubernetes platform of the cluster. */ + string? clusterPlatform = null; + + /** InstallationID is the unique id of the project installation in the cluster. */ + string? installationID = null; + + /** VirtualServer is the number of VirtualServer managed by the Ingress Controller. */ + long? virtualServers = null; + + /** VirtualServerRoutes is the number of VirtualServerRoutes managed by the Ingress Controller. */ + long? virtualServerRoutes = null; + + /** TransportServers is the number of TransportServers managed by the Ingress Controller. */ + long? transportServers = null; + + } +} diff --git a/internal/telemetry/data_attributes_generated.go b/internal/telemetry/data_attributes_generated.go new file mode 100644 index 0000000000..0a68fb9b04 --- /dev/null +++ b/internal/telemetry/data_attributes_generated.go @@ -0,0 +1,25 @@ + +package telemetry +/* +This is a generated file. DO NOT EDIT. +*/ + +import ( + "go.opentelemetry.io/otel/attribute" + + + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" + +) + +func (d *Data) Attributes() []attribute.KeyValue { + var attrs []attribute.KeyValue + + attrs = append(attrs, d.Data.Attributes()...) + attrs = append(attrs, d.NICResourceCounts.Attributes()...) + + + return attrs +} + +var _ ngxTelemetry.Exportable = (*Data)(nil) diff --git a/internal/telemetry/exporter.go b/internal/telemetry/exporter.go index ac87ecd5c5..4b5fb6a6c0 100644 --- a/internal/telemetry/exporter.go +++ b/internal/telemetry/exporter.go @@ -24,14 +24,21 @@ func (e *StdoutExporter) Export(_ context.Context, data telemetry.Exportable) er } // Data holds collected telemetry data. +// +//go:generate go run -tags=generator github.com/nginxinc/telemetry-exporter/cmd/generator -type Data -scheme -scheme-protocol=NICProductTelemetry -scheme-df-datatype=nic-product-telemetry -scheme-namespace=ingress.nginx.com type Data struct { telemetry.Data NICResourceCounts } // NICResourceCounts holds a count of NIC specific resource. +// +//go:generate go run -tags=generator github.com/nginxinc/telemetry-exporter/cmd/generator -type NICResourceCounts type NICResourceCounts struct { - VirtualServers int64 + // VirtualServer is the number of VirtualServer managed by the Ingress Controller. + VirtualServers int64 + // VirtualServerRoutes is the number of VirtualServerRoutes managed by the Ingress Controller. VirtualServerRoutes int64 - TransportServers int64 + // TransportServers is the number of TransportServers managed by the Ingress Controller. + TransportServers int64 } diff --git a/internal/telemetry/nicresourcecounts_attributes_generated.go b/internal/telemetry/nicresourcecounts_attributes_generated.go new file mode 100644 index 0000000000..cf10cf3f93 --- /dev/null +++ b/internal/telemetry/nicresourcecounts_attributes_generated.go @@ -0,0 +1,26 @@ + +package telemetry +/* +This is a generated file. DO NOT EDIT. +*/ + +import ( + "go.opentelemetry.io/otel/attribute" + + + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" + +) + +func (d *NICResourceCounts) Attributes() []attribute.KeyValue { + var attrs []attribute.KeyValue + + attrs = append(attrs, attribute.Int64("VirtualServers", d.VirtualServers)) + attrs = append(attrs, attribute.Int64("VirtualServerRoutes", d.VirtualServerRoutes)) + attrs = append(attrs, attribute.Int64("TransportServers", d.TransportServers)) + + + return attrs +} + +var _ ngxTelemetry.Exportable = (*NICResourceCounts)(nil) From a0b91ce548c4e3f2f039dca9423ff9d21f710a89 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 13:45:24 +0000 Subject: [PATCH 3/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- internal/telemetry/data.avdl | 24 +++++++++---------- .../telemetry/data_attributes_generated.go | 6 ++--- .../nicresourcecounts_attributes_generated.go | 6 ++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/telemetry/data.avdl b/internal/telemetry/data.avdl index f53fbd05ea..f4eb5600f8 100644 --- a/internal/telemetry/data.avdl +++ b/internal/telemetry/data.avdl @@ -7,39 +7,39 @@ /** The time our edge ingested the event */ long ingestTime; - + /** ProjectName is the name of the project. */ string? projectName = null; - + /** ProjectVersion is the version of the project. */ string? projectVersion = null; - + /** ProjectArchitecture is the architecture the project. For example, "amd64". */ string? projectArchitecture = null; - + /** ClusterID is the unique id of the Kubernetes cluster where the project is installed. */ string? clusterID = null; - + /** ClusterNodeCount is the number of nodes in the cluster. */ long? clusterNodeCount = null; - + /** ClusterVersion is the Kubernetes version of the cluster. */ string? clusterVersion = null; - + /** ClusterPlatform is the Kubernetes platform of the cluster. */ string? clusterPlatform = null; - + /** InstallationID is the unique id of the project installation in the cluster. */ string? installationID = null; - + /** VirtualServer is the number of VirtualServer managed by the Ingress Controller. */ long? virtualServers = null; - + /** VirtualServerRoutes is the number of VirtualServerRoutes managed by the Ingress Controller. */ long? virtualServerRoutes = null; - + /** TransportServers is the number of TransportServers managed by the Ingress Controller. */ long? transportServers = null; - + } } diff --git a/internal/telemetry/data_attributes_generated.go b/internal/telemetry/data_attributes_generated.go index 0a68fb9b04..5503ddcf69 100644 --- a/internal/telemetry/data_attributes_generated.go +++ b/internal/telemetry/data_attributes_generated.go @@ -7,9 +7,9 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - + ) func (d *Data) Attributes() []attribute.KeyValue { @@ -17,7 +17,7 @@ func (d *Data) Attributes() []attribute.KeyValue { attrs = append(attrs, d.Data.Attributes()...) attrs = append(attrs, d.NICResourceCounts.Attributes()...) - + return attrs } diff --git a/internal/telemetry/nicresourcecounts_attributes_generated.go b/internal/telemetry/nicresourcecounts_attributes_generated.go index cf10cf3f93..725c60972d 100644 --- a/internal/telemetry/nicresourcecounts_attributes_generated.go +++ b/internal/telemetry/nicresourcecounts_attributes_generated.go @@ -7,9 +7,9 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - + ) func (d *NICResourceCounts) Attributes() []attribute.KeyValue { @@ -18,7 +18,7 @@ func (d *NICResourceCounts) Attributes() []attribute.KeyValue { attrs = append(attrs, attribute.Int64("VirtualServers", d.VirtualServers)) attrs = append(attrs, attribute.Int64("VirtualServerRoutes", d.VirtualServerRoutes)) attrs = append(attrs, attribute.Int64("TransportServers", d.TransportServers)) - + return attrs } From a4c44b0db8c86949c488170eed1b2cb73997b415 Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Tue, 5 Mar 2024 13:51:25 +0000 Subject: [PATCH 4/9] gofumpt files --- internal/telemetry/collector.go | 3 ++- internal/telemetry/collector_test.go | 14 ++++++-------- internal/telemetry/data_attributes_generated.go | 5 +---- internal/telemetry/exporter.go | 3 ++- .../nicresourcecounts_attributes_generated.go | 5 +---- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/internal/telemetry/collector.go b/internal/telemetry/collector.go index da7fd73f66..a98fea9c72 100644 --- a/internal/telemetry/collector.go +++ b/internal/telemetry/collector.go @@ -3,11 +3,12 @@ package telemetry import ( "context" - telemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" "io" "runtime" "time" + telemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" + "github.com/nginxinc/kubernetes-ingress/internal/configs" k8s_nginx "github.com/nginxinc/kubernetes-ingress/pkg/client/clientset/versioned" diff --git a/internal/telemetry/collector_test.go b/internal/telemetry/collector_test.go index 1e8da2ceb4..c797dff1ae 100644 --- a/internal/telemetry/collector_test.go +++ b/internal/telemetry/collector_test.go @@ -24,14 +24,12 @@ import ( testClient "k8s.io/client-go/kubernetes/fake" ) -var ( - commonData = exporter.Data{ - ProjectName: "NIC", - ProjectVersion: "3.5.0", - ClusterVersion: "v1.29.2", - ProjectArchitecture: runtime.GOARCH, - } -) +var commonData = exporter.Data{ + ProjectName: "NIC", + ProjectVersion: "3.5.0", + ClusterVersion: "v1.29.2", + ProjectArchitecture: runtime.GOARCH, +} func TestCreateNewCollectorWithCustomReportingPeriod(t *testing.T) { t.Parallel() diff --git a/internal/telemetry/data_attributes_generated.go b/internal/telemetry/data_attributes_generated.go index 5503ddcf69..9fbc1610e6 100644 --- a/internal/telemetry/data_attributes_generated.go +++ b/internal/telemetry/data_attributes_generated.go @@ -1,5 +1,5 @@ - package telemetry + /* This is a generated file. DO NOT EDIT. */ @@ -7,9 +7,7 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - ) func (d *Data) Attributes() []attribute.KeyValue { @@ -18,7 +16,6 @@ func (d *Data) Attributes() []attribute.KeyValue { attrs = append(attrs, d.Data.Attributes()...) attrs = append(attrs, d.NICResourceCounts.Attributes()...) - return attrs } diff --git a/internal/telemetry/exporter.go b/internal/telemetry/exporter.go index 4b5fb6a6c0..ff84584164 100644 --- a/internal/telemetry/exporter.go +++ b/internal/telemetry/exporter.go @@ -3,8 +3,9 @@ package telemetry import ( "context" "fmt" - "github.com/nginxinc/telemetry-exporter/pkg/telemetry" "io" + + "github.com/nginxinc/telemetry-exporter/pkg/telemetry" ) // Exporter interface for exporters. diff --git a/internal/telemetry/nicresourcecounts_attributes_generated.go b/internal/telemetry/nicresourcecounts_attributes_generated.go index 725c60972d..1c85cd5542 100644 --- a/internal/telemetry/nicresourcecounts_attributes_generated.go +++ b/internal/telemetry/nicresourcecounts_attributes_generated.go @@ -1,5 +1,5 @@ - package telemetry + /* This is a generated file. DO NOT EDIT. */ @@ -7,9 +7,7 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - ) func (d *NICResourceCounts) Attributes() []attribute.KeyValue { @@ -19,7 +17,6 @@ func (d *NICResourceCounts) Attributes() []attribute.KeyValue { attrs = append(attrs, attribute.Int64("VirtualServerRoutes", d.VirtualServerRoutes)) attrs = append(attrs, attribute.Int64("TransportServers", d.TransportServers)) - return attrs } From bca44210b137c80d02cb42f77bdf8a3399c9c7b5 Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Tue, 5 Mar 2024 13:53:24 +0000 Subject: [PATCH 5/9] Run go mod tidy --- go.mod | 1 - go.sum | 4 ---- 2 files changed, 5 deletions(-) diff --git a/go.mod b/go.mod index 4d6dc0a9b9..f346c992a8 100644 --- a/go.mod +++ b/go.mod @@ -84,7 +84,6 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect diff --git a/go.sum b/go.sum index 0afb39a798..8e6d15213d 100644 --- a/go.sum +++ b/go.sum @@ -172,8 +172,6 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1 h1:NicmruxkeqHjDv03SfSxqmaLuisddudfP3h5wdXFbhM= -github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1/go.mod h1:eyp4DdUJAKkr9tvxR3jWhw2mDK7CWABMG5r9uyaKC7I= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -215,8 +213,6 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= -github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= From 31d2cc57591a332105ed978102c05bad162d13c6 Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Fri, 8 Mar 2024 10:43:14 +0000 Subject: [PATCH 6/9] Resolve conflicts --- internal/telemetry/collector_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/telemetry/collector_test.go b/internal/telemetry/collector_test.go index 3c6a8c9de0..c797dff1ae 100644 --- a/internal/telemetry/collector_test.go +++ b/internal/telemetry/collector_test.go @@ -16,11 +16,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/nginxinc/kubernetes-ingress/internal/telemetry" conf_v1 "github.com/nginxinc/kubernetes-ingress/pkg/apis/configuration/v1" -<<<<<<< HEAD exporter "github.com/nginxinc/telemetry-exporter/pkg/telemetry" -======= - _ "github.com/nginxinc/telemetry-exporter/pkg/telemetry" ->>>>>>> main v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8sruntime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/version" From e122d174a1c8a14d15a3c5568b10fa032978fd6b Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Fri, 8 Mar 2024 10:46:34 +0000 Subject: [PATCH 7/9] Re-generate schema and attributes --- internal/telemetry/data.avdl | 53 ++++++++++--------- .../telemetry/data_attributes_generated.go | 5 +- .../nicresourcecounts_attributes_generated.go | 5 +- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/internal/telemetry/data.avdl b/internal/telemetry/data.avdl index f4eb5600f8..7d72cc6330 100644 --- a/internal/telemetry/data.avdl +++ b/internal/telemetry/data.avdl @@ -7,39 +7,40 @@ /** The time our edge ingested the event */ long ingestTime; - + /** ProjectName is the name of the project. */ - string? projectName = null; - + string? ProjectName = null; + /** ProjectVersion is the version of the project. */ - string? projectVersion = null; - - /** ProjectArchitecture is the architecture the project. For example, "amd64". */ - string? projectArchitecture = null; - - /** ClusterID is the unique id of the Kubernetes cluster where the project is installed. */ - string? clusterID = null; - - /** ClusterNodeCount is the number of nodes in the cluster. */ - long? clusterNodeCount = null; - + string? ProjectVersion = null; + + /** ProjectArchitecture is the architecture of the project. For example, "amd64". */ + string? ProjectArchitecture = null; + + /** ClusterID is the unique id of the Kubernetes cluster where the project is installed. +It is the UID of the `kube-system` Namespace. */ + string? ClusterID = null; + /** ClusterVersion is the Kubernetes version of the cluster. */ - string? clusterVersion = null; - + string? ClusterVersion = null; + /** ClusterPlatform is the Kubernetes platform of the cluster. */ - string? clusterPlatform = null; - + string? ClusterPlatform = null; + /** InstallationID is the unique id of the project installation in the cluster. */ - string? installationID = null; - + string? InstallationID = null; + + /** ClusterNodeCount is the number of nodes in the cluster. */ + long? ClusterNodeCount = null; + /** VirtualServer is the number of VirtualServer managed by the Ingress Controller. */ - long? virtualServers = null; - + long? VirtualServers = null; + /** VirtualServerRoutes is the number of VirtualServerRoutes managed by the Ingress Controller. */ - long? virtualServerRoutes = null; - + long? VirtualServerRoutes = null; + /** TransportServers is the number of TransportServers managed by the Ingress Controller. */ - long? transportServers = null; - + long? TransportServers = null; + } } diff --git a/internal/telemetry/data_attributes_generated.go b/internal/telemetry/data_attributes_generated.go index 9fbc1610e6..0a68fb9b04 100644 --- a/internal/telemetry/data_attributes_generated.go +++ b/internal/telemetry/data_attributes_generated.go @@ -1,5 +1,5 @@ -package telemetry +package telemetry /* This is a generated file. DO NOT EDIT. */ @@ -7,7 +7,9 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" + ) func (d *Data) Attributes() []attribute.KeyValue { @@ -15,6 +17,7 @@ func (d *Data) Attributes() []attribute.KeyValue { attrs = append(attrs, d.Data.Attributes()...) attrs = append(attrs, d.NICResourceCounts.Attributes()...) + return attrs } diff --git a/internal/telemetry/nicresourcecounts_attributes_generated.go b/internal/telemetry/nicresourcecounts_attributes_generated.go index 1c85cd5542..cf10cf3f93 100644 --- a/internal/telemetry/nicresourcecounts_attributes_generated.go +++ b/internal/telemetry/nicresourcecounts_attributes_generated.go @@ -1,5 +1,5 @@ -package telemetry +package telemetry /* This is a generated file. DO NOT EDIT. */ @@ -7,7 +7,9 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" + ) func (d *NICResourceCounts) Attributes() []attribute.KeyValue { @@ -16,6 +18,7 @@ func (d *NICResourceCounts) Attributes() []attribute.KeyValue { attrs = append(attrs, attribute.Int64("VirtualServers", d.VirtualServers)) attrs = append(attrs, attribute.Int64("VirtualServerRoutes", d.VirtualServerRoutes)) attrs = append(attrs, attribute.Int64("TransportServers", d.TransportServers)) + return attrs } From 3a1577f16d4d54c4b983aab6ba09d9632e5dfd91 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:47:13 +0000 Subject: [PATCH 8/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- internal/telemetry/data.avdl | 24 +++++++++---------- .../telemetry/data_attributes_generated.go | 6 ++--- .../nicresourcecounts_attributes_generated.go | 6 ++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/telemetry/data.avdl b/internal/telemetry/data.avdl index 7d72cc6330..8ce86fdee4 100644 --- a/internal/telemetry/data.avdl +++ b/internal/telemetry/data.avdl @@ -7,40 +7,40 @@ /** The time our edge ingested the event */ long ingestTime; - + /** ProjectName is the name of the project. */ string? ProjectName = null; - + /** ProjectVersion is the version of the project. */ string? ProjectVersion = null; - + /** ProjectArchitecture is the architecture of the project. For example, "amd64". */ string? ProjectArchitecture = null; - + /** ClusterID is the unique id of the Kubernetes cluster where the project is installed. It is the UID of the `kube-system` Namespace. */ string? ClusterID = null; - + /** ClusterVersion is the Kubernetes version of the cluster. */ string? ClusterVersion = null; - + /** ClusterPlatform is the Kubernetes platform of the cluster. */ string? ClusterPlatform = null; - + /** InstallationID is the unique id of the project installation in the cluster. */ string? InstallationID = null; - + /** ClusterNodeCount is the number of nodes in the cluster. */ long? ClusterNodeCount = null; - + /** VirtualServer is the number of VirtualServer managed by the Ingress Controller. */ long? VirtualServers = null; - + /** VirtualServerRoutes is the number of VirtualServerRoutes managed by the Ingress Controller. */ long? VirtualServerRoutes = null; - + /** TransportServers is the number of TransportServers managed by the Ingress Controller. */ long? TransportServers = null; - + } } diff --git a/internal/telemetry/data_attributes_generated.go b/internal/telemetry/data_attributes_generated.go index 0a68fb9b04..5503ddcf69 100644 --- a/internal/telemetry/data_attributes_generated.go +++ b/internal/telemetry/data_attributes_generated.go @@ -7,9 +7,9 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - + ) func (d *Data) Attributes() []attribute.KeyValue { @@ -17,7 +17,7 @@ func (d *Data) Attributes() []attribute.KeyValue { attrs = append(attrs, d.Data.Attributes()...) attrs = append(attrs, d.NICResourceCounts.Attributes()...) - + return attrs } diff --git a/internal/telemetry/nicresourcecounts_attributes_generated.go b/internal/telemetry/nicresourcecounts_attributes_generated.go index cf10cf3f93..725c60972d 100644 --- a/internal/telemetry/nicresourcecounts_attributes_generated.go +++ b/internal/telemetry/nicresourcecounts_attributes_generated.go @@ -7,9 +7,9 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - + ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - + ) func (d *NICResourceCounts) Attributes() []attribute.KeyValue { @@ -18,7 +18,7 @@ func (d *NICResourceCounts) Attributes() []attribute.KeyValue { attrs = append(attrs, attribute.Int64("VirtualServers", d.VirtualServers)) attrs = append(attrs, attribute.Int64("VirtualServerRoutes", d.VirtualServerRoutes)) attrs = append(attrs, attribute.Int64("TransportServers", d.TransportServers)) - + return attrs } From f0f80c470ee547f372aac5fb47117623eda6e6a3 Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Fri, 8 Mar 2024 10:57:00 +0000 Subject: [PATCH 9/9] gofumpt-ed --- internal/telemetry/data_attributes_generated.go | 5 +---- internal/telemetry/nicresourcecounts_attributes_generated.go | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/internal/telemetry/data_attributes_generated.go b/internal/telemetry/data_attributes_generated.go index 5503ddcf69..9fbc1610e6 100644 --- a/internal/telemetry/data_attributes_generated.go +++ b/internal/telemetry/data_attributes_generated.go @@ -1,5 +1,5 @@ - package telemetry + /* This is a generated file. DO NOT EDIT. */ @@ -7,9 +7,7 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - ) func (d *Data) Attributes() []attribute.KeyValue { @@ -18,7 +16,6 @@ func (d *Data) Attributes() []attribute.KeyValue { attrs = append(attrs, d.Data.Attributes()...) attrs = append(attrs, d.NICResourceCounts.Attributes()...) - return attrs } diff --git a/internal/telemetry/nicresourcecounts_attributes_generated.go b/internal/telemetry/nicresourcecounts_attributes_generated.go index 725c60972d..1c85cd5542 100644 --- a/internal/telemetry/nicresourcecounts_attributes_generated.go +++ b/internal/telemetry/nicresourcecounts_attributes_generated.go @@ -1,5 +1,5 @@ - package telemetry + /* This is a generated file. DO NOT EDIT. */ @@ -7,9 +7,7 @@ This is a generated file. DO NOT EDIT. import ( "go.opentelemetry.io/otel/attribute" - ngxTelemetry "github.com/nginxinc/telemetry-exporter/pkg/telemetry" - ) func (d *NICResourceCounts) Attributes() []attribute.KeyValue { @@ -19,7 +17,6 @@ func (d *NICResourceCounts) Attributes() []attribute.KeyValue { attrs = append(attrs, attribute.Int64("VirtualServerRoutes", d.VirtualServerRoutes)) attrs = append(attrs, attribute.Int64("TransportServers", d.TransportServers)) - return attrs }