From 643dc744b50f09d403f98b853b432e419c2bbc3b Mon Sep 17 00:00:00 2001 From: Marcus Brandenburger Date: Mon, 24 Nov 2025 15:59:05 +0100 Subject: [PATCH] Bump jaeger v2 - Switch to jaeger v2 container within NWO - Remove unused docker-compose and configuration - Remove unused jaeger reporting client code Signed-off-by: Marcus Brandenburger --- Makefile | 2 +- go.mod | 2 +- .../nwo/monitoring/otlp/docker-compose.yaml | 39 --------------- integration/nwo/monitoring/otlp/docker.go | 11 +---- integration/nwo/monitoring/otlp/optl.go | 10 ---- .../otlp/otel-collector-config.yaml | 47 ------------------- integration/reporting/jaeger/client.go | 4 +- integration/reporting/jaeger/predicates.go | 29 ------------ integration/reporting/jaeger/transformers.go | 41 ---------------- 9 files changed, 6 insertions(+), 179 deletions(-) delete mode 100755 integration/nwo/monitoring/otlp/docker-compose.yaml delete mode 100755 integration/nwo/monitoring/otlp/otel-collector-config.yaml delete mode 100644 integration/reporting/jaeger/predicates.go delete mode 100644 integration/reporting/jaeger/transformers.go diff --git a/Makefile b/Makefile index cbeab9a13..edb5a8b3c 100755 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ monitoring-docker-images: ## Pull images for monitoring docker pull ghcr.io/hyperledger-labs/explorer:latest docker pull prom/prometheus:latest docker pull grafana/grafana:latest - docker pull jaegertracing/all-in-one:latest + docker pull cr.jaegertracing.io/jaegertracing/jaeger:2.12.0 .PHONY: testing-docker-images testing-docker-images: ## Pull images for system testing diff --git a/go.mod b/go.mod index 3f848badb..15b9674e9 100644 --- a/go.mod +++ b/go.mod @@ -284,7 +284,7 @@ require ( go.opentelemetry.io/otel/metric v1.37.0 // indirect go.opentelemetry.io/otel/sdk v1.37.0 go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect - go.opentelemetry.io/proto/otlp v1.3.1 + go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/fx v1.23.0 // indirect go.uber.org/mock v0.5.0 // indirect diff --git a/integration/nwo/monitoring/otlp/docker-compose.yaml b/integration/nwo/monitoring/otlp/docker-compose.yaml deleted file mode 100755 index 81cbab870..000000000 --- a/integration/nwo/monitoring/otlp/docker-compose.yaml +++ /dev/null @@ -1,39 +0,0 @@ -version: "2" -services: - # Jaeger - jaeger-all-in-one: - image: jaegertracing/all-in-one:latest - restart: always - hostname: jaeger-all-in-one - ports: - - "16686:16686" - - "14268:14268" - - "14250:14250" - - # Zipkin - # zipkin-all-in-one: - # image: openzipkin/zipkin:latest - # restart: always - # ports: - # - "9411:9411" - - # Collector - otel-collector: - image: otel/opentelemetry-collector:latest - restart: always - command: ["--config=/etc/otel-collector-config.yaml"] - volumes: - - ./otel-collector-config.yaml:/etc/otel-collector-config.yaml - ports: - # - "1888:1888" # pprof extension - # - "8888:8888" # Prometheus metrics exposed by the collector - # - "8889:8889" # Prometheus exporter metrics - - "13133:13133" # health_check extension - - "4317:4317" # OTLP gRPC receiver - - "4319:4319" # OTLP http receiver - - "55679:55679" # zpages extension - depends_on: - - jaeger-all-in-one - # - zipkin-all-in-one - - \ No newline at end of file diff --git a/integration/nwo/monitoring/otlp/docker.go b/integration/nwo/monitoring/otlp/docker.go index 8b0b543d7..8b7f4f995 100644 --- a/integration/nwo/monitoring/otlp/docker.go +++ b/integration/nwo/monitoring/otlp/docker.go @@ -10,7 +10,6 @@ import ( "context" "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" "github.com/hyperledger-labs/fabric-smart-client/integration/nwo/common/docker" @@ -18,7 +17,7 @@ import ( ) const ( - JaegerTracing = "jaegertracing/all-in-one:latest" + JaegerTracing = "cr.jaegertracing.io/jaegertracing/jaeger:2.12.0" JaegerQueryPort = 16685 JaegerCollectorPort = 4317 JaegerUIPort = 16686 @@ -64,14 +63,6 @@ func (n *Extension) startJaeger() { }, &container.HostConfig{ PortBindings: docker.PortBindings([]int{JaegerCollectorPort, JaegerQueryPort, JaegerUIPort, JaegerAdminPort}...), - Mounts: []mount.Mount{ - // To avoid error: "error reading server preface: EOF" - { - Type: mount.TypeBind, - Source: n.jaegerHostsPath(), - Target: "/etc/hosts", - }, - }, }, &network.NetworkingConfig{ EndpointsConfig: map[string]*network.EndpointSettings{ diff --git a/integration/nwo/monitoring/otlp/optl.go b/integration/nwo/monitoring/otlp/optl.go index eae444561..8ad6fffbc 100644 --- a/integration/nwo/monitoring/otlp/optl.go +++ b/integration/nwo/monitoring/otlp/optl.go @@ -47,8 +47,6 @@ func (n *Extension) GenerateArtifacts() { } gomega.Expect(os.MkdirAll(n.configFileDir(), 0o777)).NotTo(gomega.HaveOccurred()) - gomega.Expect(os.WriteFile(n.configFilePath(), []byte(ConfigTemplate), 0o644)).NotTo(gomega.HaveOccurred()) - gomega.Expect(os.WriteFile(n.jaegerHostsPath(), []byte(JaegerHosts), 0o644)).NotTo(gomega.HaveOccurred()) } func (n *Extension) PostRun(bool) { @@ -66,11 +64,3 @@ func (n *Extension) configFileDir() string { "otlp", ) } - -func (n *Extension) configFilePath() string { - return filepath.Join(n.configFileDir(), "otlp-collector-config.yaml") -} - -func (n *Extension) jaegerHostsPath() string { - return filepath.Join(n.configFileDir(), "jaeger_hosts") -} diff --git a/integration/nwo/monitoring/otlp/otel-collector-config.yaml b/integration/nwo/monitoring/otlp/otel-collector-config.yaml deleted file mode 100755 index 98f47ae57..000000000 --- a/integration/nwo/monitoring/otlp/otel-collector-config.yaml +++ /dev/null @@ -1,47 +0,0 @@ -receivers: - otlp: - protocols: - http: - endpoint: 0.0.0.0:4319 - # grpc: - # endpoint: 0.0.0.0:4320 - -exporters: - # prometheus: - # endpoint: "0.0.0.0:8889" - # const_labels: - # label1: value1 - - logging: - loglevel: debug - - # zipkin: - # endpoint: "http://zipkin-all-in-one:9411/api/v2/spans" - # format: proto - - jaeger: - endpoint: jaeger-all-in-one:14250 - tls: - insecure: true - -processors: - batch: - -extensions: - health_check: - pprof: - endpoint: :1888 - zpages: - endpoint: :55679 - -service: - extensions: [pprof, zpages, health_check] - pipelines: - traces: - receivers: [otlp] - processors: [] - exporters: [logging,jaeger] - # metrics: - # receivers: [otlp] - # processors: [batch] - # exporters: [logging, prometheus] \ No newline at end of file diff --git a/integration/reporting/jaeger/client.go b/integration/reporting/jaeger/client.go index 5ecd94543..58dcf337e 100644 --- a/integration/reporting/jaeger/client.go +++ b/integration/reporting/jaeger/client.go @@ -18,6 +18,8 @@ import ( "google.golang.org/grpc/credentials/insecure" ) +const defaultSearchDepth = 20 + type Reporter interface { FindTraces(nodeName, operationName string) (iterators.Iterator[*api_v2.SpansResponseChunk], error) GetServices() ([]string, error) @@ -64,7 +66,7 @@ func (c *reporter) FindTraces(nodeName, operationName string) (iterators.Iterato if len(nodeName) == 0 { return nil, errors.New("no node name passed") } - params := &api_v2.TraceQueryParameters{ServiceName: nodeName, RawTraces: true} + params := &api_v2.TraceQueryParameters{ServiceName: nodeName, RawTraces: true, SearchDepth: defaultSearchDepth} if len(operationName) > 0 { params.OperationName = operationName } diff --git a/integration/reporting/jaeger/predicates.go b/integration/reporting/jaeger/predicates.go deleted file mode 100644 index c3c188445..000000000 --- a/integration/reporting/jaeger/predicates.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright IBM Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package jaeger - -import ( - "github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/collections/iterators" - "github.com/jaegertracing/jaeger-idl/proto-gen/api_v2" -) - -var ( - IsTransfer = ContainsSpanWithName("/idap/assets/currencies/transfers") - IsWithdrawal = ContainsSpanWithName("/idap/assets/currencies/withdrawals") - IsTransaction = iterators.Or(IsTransfer, IsWithdrawal) -) - -func ContainsSpanWithName(name string) func(t *api_v2.SpansResponseChunk) bool { - return func(t *api_v2.SpansResponseChunk) bool { - for _, s := range t.Spans { - if s.OperationName == name { - return true - } - } - return false - } -} diff --git a/integration/reporting/jaeger/transformers.go b/integration/reporting/jaeger/transformers.go deleted file mode 100644 index 5f2f3234e..000000000 --- a/integration/reporting/jaeger/transformers.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright IBM Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -package jaeger - -import ( - "time" - - "github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/collections/slices" - v1 "go.opentelemetry.io/proto/otlp/trace/v1" -) - -func LargestEventGap(t *v1.TracesData) (time.Duration, error) { - events := slices.SortedSlice[uint64]{} - if t == nil { - return 0, nil - } - for _, rs := range t.ResourceSpans { - for _, ss := range rs.ScopeSpans { - for _, s := range ss.Spans { - for _, e := range s.Events { - events.Add(e.TimeUnixNano) - } - } - } - } - if len(events) <= 1 { - return 0, nil - } - - maxGap := uint64(0) - for i := range events[1:] { - if gap := events[i+1] - events[i]; gap > maxGap { - maxGap = gap - } - } - return time.Duration(maxGap), nil -}