From adca3d4c9ae72d5451a98f17e6de36df452f6a6e Mon Sep 17 00:00:00 2001 From: mackjmr Date: Tue, 5 Sep 2023 11:39:18 +0200 Subject: [PATCH 1/5] Deploy demo to ng-6 (Daemonset => Gateway) Collector PR: DataDog/opentelemetry-collector-contrib#4376 --- .gitlab-ci.yml | 13 ++++++++++++- ci/values-ds-gateway.yaml | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 ci/values-ds-gateway.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec947bf7fa..3f72d6c4a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -246,4 +246,15 @@ staging-deploy-gateway-demo-eks: SCRIPT: ./ci/scripts/ci-deploy-demo-staging.sh CLUSTER_NAME: dd-otel CLUSTER_ARN: "arn:aws:eks:us-east-1:601427279990:cluster/dd-otel" - REGION: us-east-1 \ No newline at end of file + REGION: us-east-1 +# Demo env:otel-ds-gateway +staging-deploy-ds-gateway-demo-eks: + !!merge <<: *staging-deploy + variables: + NAMESPACE: otel-ds-gateway + VALUES: ./ci/values-ds-gateway.yaml + NODE_GROUP: ng-6 + SCRIPT: ./ci/scripts/ci-deploy-demo-staging.sh + CLUSTER_NAME: dd-otel + CLUSTER_ARN: "arn:aws:eks:us-east-1:601427279990:cluster/dd-otel" + REGION: us-east-1 diff --git a/ci/values-ds-gateway.yaml b/ci/values-ds-gateway.yaml new file mode 100644 index 0000000000..08cf8df5fa --- /dev/null +++ b/ci/values-ds-gateway.yaml @@ -0,0 +1,4 @@ +default: + schedulingRules: + nodeSelector: + alpha.eksctl.io/nodegroup-name: ng-6 From e10483ab3989673d756c457c20be67b82fdb49d0 Mon Sep 17 00:00:00 2001 From: mackjmr Date: Fri, 8 Sep 2023 14:47:26 +0200 Subject: [PATCH 2/5] disable high cardinality attributes --- src/productcatalogservice/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/productcatalogservice/main.go b/src/productcatalogservice/main.go index c372772011..6a81673b6c 100644 --- a/src/productcatalogservice/main.go +++ b/src/productcatalogservice/main.go @@ -20,6 +20,7 @@ import ( "github.com/sirupsen/logrus" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "go.opentelemetry.io/contrib/instrumentation/runtime" + "go.opentelemetry.io/otel/sdk/instrumentation" sdkmetric "go.opentelemetry.io/otel/sdk/metric" healthpb "google.golang.org/grpc/health/grpc_health_v1" @@ -98,11 +99,34 @@ func initMeterProvider() *sdkmetric.MeterProvider { mp := sdkmetric.NewMeterProvider( sdkmetric.WithReader(sdkmetric.NewPeriodicReader(exporter)), sdkmetric.WithResource(initResource()), + sdkmetric.WithView( + sdkmetric.NewView( + sdkmetric.Instrument{Scope: instrumentation.Scope{Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"}}, + sdkmetric.Stream{ + AttributeFilter: allowedAttr( + "http.method", + "http.status_code", + "http.target", + ), + }, + ), + ), ) otel.SetMeterProvider(mp) return mp } +func allowedAttr(v ...string) attribute.Filter { + m := make(map[string]struct{}, len(v)) + for _, s := range v { + m[s] = struct{}{} + } + return func(kv attribute.KeyValue) bool { + _, ok := m[string(kv.Key)] + return ok + } +} + func main() { tp := initTracerProvider() defer func() { From 7712655beb8a9ed319d551c4a42d45fa9b86dc5e Mon Sep 17 00:00:00 2001 From: mackjmr Date: Mon, 11 Sep 2023 10:46:33 +0200 Subject: [PATCH 3/5] Revert "disable high cardinality attributes" for testing purposes This reverts commit e10483ab3989673d756c457c20be67b82fdb49d0. --- src/productcatalogservice/main.go | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/productcatalogservice/main.go b/src/productcatalogservice/main.go index 6a81673b6c..c372772011 100644 --- a/src/productcatalogservice/main.go +++ b/src/productcatalogservice/main.go @@ -20,7 +20,6 @@ import ( "github.com/sirupsen/logrus" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "go.opentelemetry.io/contrib/instrumentation/runtime" - "go.opentelemetry.io/otel/sdk/instrumentation" sdkmetric "go.opentelemetry.io/otel/sdk/metric" healthpb "google.golang.org/grpc/health/grpc_health_v1" @@ -99,34 +98,11 @@ func initMeterProvider() *sdkmetric.MeterProvider { mp := sdkmetric.NewMeterProvider( sdkmetric.WithReader(sdkmetric.NewPeriodicReader(exporter)), sdkmetric.WithResource(initResource()), - sdkmetric.WithView( - sdkmetric.NewView( - sdkmetric.Instrument{Scope: instrumentation.Scope{Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"}}, - sdkmetric.Stream{ - AttributeFilter: allowedAttr( - "http.method", - "http.status_code", - "http.target", - ), - }, - ), - ), ) otel.SetMeterProvider(mp) return mp } -func allowedAttr(v ...string) attribute.Filter { - m := make(map[string]struct{}, len(v)) - for _, s := range v { - m[s] = struct{}{} - } - return func(kv attribute.KeyValue) bool { - _, ok := m[string(kv.Key)] - return ok - } -} - func main() { tp := initTracerProvider() defer func() { From f4807ae67f80a6ee79d43fd0a67c10c1ac061cfa Mon Sep 17 00:00:00 2001 From: mackjmr Date: Mon, 11 Sep 2023 17:17:44 +0200 Subject: [PATCH 4/5] Readd cardinality fix --- src/productcatalogservice/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/productcatalogservice/main.go b/src/productcatalogservice/main.go index c372772011..6a81673b6c 100644 --- a/src/productcatalogservice/main.go +++ b/src/productcatalogservice/main.go @@ -20,6 +20,7 @@ import ( "github.com/sirupsen/logrus" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "go.opentelemetry.io/contrib/instrumentation/runtime" + "go.opentelemetry.io/otel/sdk/instrumentation" sdkmetric "go.opentelemetry.io/otel/sdk/metric" healthpb "google.golang.org/grpc/health/grpc_health_v1" @@ -98,11 +99,34 @@ func initMeterProvider() *sdkmetric.MeterProvider { mp := sdkmetric.NewMeterProvider( sdkmetric.WithReader(sdkmetric.NewPeriodicReader(exporter)), sdkmetric.WithResource(initResource()), + sdkmetric.WithView( + sdkmetric.NewView( + sdkmetric.Instrument{Scope: instrumentation.Scope{Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"}}, + sdkmetric.Stream{ + AttributeFilter: allowedAttr( + "http.method", + "http.status_code", + "http.target", + ), + }, + ), + ), ) otel.SetMeterProvider(mp) return mp } +func allowedAttr(v ...string) attribute.Filter { + m := make(map[string]struct{}, len(v)) + for _, s := range v { + m[s] = struct{}{} + } + return func(kv attribute.KeyValue) bool { + _, ok := m[string(kv.Key)] + return ok + } +} + func main() { tp := initTracerProvider() defer func() { From 0aa3e9942134a66d84b54e10cdac561a59eea289 Mon Sep 17 00:00:00 2001 From: mackjmr Date: Tue, 12 Sep 2023 13:46:19 +0200 Subject: [PATCH 5/5] change allow list to disallow list --- src/productcatalogservice/main.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/productcatalogservice/main.go b/src/productcatalogservice/main.go index 6a81673b6c..23e0530698 100644 --- a/src/productcatalogservice/main.go +++ b/src/productcatalogservice/main.go @@ -103,10 +103,9 @@ func initMeterProvider() *sdkmetric.MeterProvider { sdkmetric.NewView( sdkmetric.Instrument{Scope: instrumentation.Scope{Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"}}, sdkmetric.Stream{ - AttributeFilter: allowedAttr( - "http.method", - "http.status_code", - "http.target", + AttributeFilter: disallowedAttr( + "net.sock.peer.port", + "net.sock.peer.addr", ), }, ), @@ -116,14 +115,14 @@ func initMeterProvider() *sdkmetric.MeterProvider { return mp } -func allowedAttr(v ...string) attribute.Filter { +func disallowedAttr(v ...string) attribute.Filter { m := make(map[string]struct{}, len(v)) for _, s := range v { m[s] = struct{}{} } return func(kv attribute.KeyValue) bool { _, ok := m[string(kv.Key)] - return ok + return !ok } }