From 2b91c96e130c51c8b787c37660dd432ea097a4cc Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Mon, 29 Jul 2024 09:53:15 +0530 Subject: [PATCH 1/4] Added Jaeger as Base Factory Signed-off-by: Wise-Wizard --- cmd/jaeger/internal/extension/jaegerquery/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/jaeger/internal/extension/jaegerquery/server.go b/cmd/jaeger/internal/extension/jaegerquery/server.go index 7fa249a976c..a62b578418b 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server.go @@ -50,7 +50,8 @@ func (*server) Dependencies() []component.ID { func (s *server) Start(_ context.Context, host component.Host) error { mf := otelmetrics.NewFactory(s.telset.MeterProvider) - queryMetricsFactory := mf.Namespace(metrics.NSOptions{Name: "query"}) + baseFactory := mf.Namespace(metrics.NSOptions{Name: "jaeger"}) + queryMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"}) f, err := jaegerstorage.GetStorageFactory(s.config.TraceStoragePrimary, host) if err != nil { return fmt.Errorf("cannot find primary storage %s: %w", s.config.TraceStoragePrimary, err) From e53e74a6801367b47b7067ae8b6e94a7147178d9 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Mon, 29 Jul 2024 19:46:15 +0530 Subject: [PATCH 2/4] Add Address field Signed-off-by: Wise-Wizard --- cmd/jaeger/internal/all-in-one.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/jaeger/internal/all-in-one.yaml b/cmd/jaeger/internal/all-in-one.yaml index a81add4475b..79e939be227 100644 --- a/cmd/jaeger/internal/all-in-one.yaml +++ b/cmd/jaeger/internal/all-in-one.yaml @@ -10,6 +10,7 @@ service: service.name: jaeger metrics: level: detailed + address: 0.0.0.0:8888 # TODO Initialize telemetery tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 From 1c080d1134b586ac47bcb4d320434e54d57c9d32 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Tue, 30 Jul 2024 19:49:04 +0530 Subject: [PATCH 3/4] Strip otelcol prefix while comparing metrics Signed-off-by: Wise-Wizard --- scripts/compare_metrics.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/compare_metrics.py b/scripts/compare_metrics.py index 98f0af80bd6..8869f1826c6 100644 --- a/scripts/compare_metrics.py +++ b/scripts/compare_metrics.py @@ -6,7 +6,6 @@ import json -# Load the JSON files v1_metrics_path = "./V1_Metrics.json" v2_metrics_path = "./V2_Metrics.json" @@ -17,18 +16,22 @@ v2_metrics = json.load(file) # Extract names and labels of the metrics -def extract_metrics_with_labels(metrics): +def extract_metrics_with_labels(metrics, strip_prefix=None): result = {} for metric in metrics: name = metric['name'] + if strip_prefix and name.startswith(strip_prefix): + name = name[len(strip_prefix):] labels = {} if 'metrics' in metric and 'labels' in metric['metrics'][0]: labels = metric['metrics'][0]['labels'] result[name] = labels return result + v1_metrics_with_labels = extract_metrics_with_labels(v1_metrics) -v2_metrics_with_labels = extract_metrics_with_labels(v2_metrics) +v2_metrics_with_labels = extract_metrics_with_labels( + v2_metrics, strip_prefix="otelcol_") # Compare the metrics names and labels common_metrics = {} @@ -37,10 +40,7 @@ def extract_metrics_with_labels(metrics): for name, labels in v1_metrics_with_labels.items(): if name in v2_metrics_with_labels: - if labels == v2_metrics_with_labels[name]: - common_metrics[name] = labels - else: - v1_only_metrics[name] = labels + common_metrics[name] = labels else: v1_only_metrics[name] = labels @@ -54,9 +54,8 @@ def extract_metrics_with_labels(metrics): "v2_only_metrics": v2_only_metrics } -# Write the differences to a new JSON file differences_path = "./differences.json" with open(differences_path, 'w') as file: json.dump(differences, file, indent=4) -print(f"Differences written to {differences_path}") \ No newline at end of file +print(f"Differences written to {differences_path}") From 04ea6ce924135e7749d211d0561da779da693d64 Mon Sep 17 00:00:00 2001 From: Wise-Wizard Date: Thu, 1 Aug 2024 23:57:27 +0530 Subject: [PATCH 4/4] Add Jaeger prefix to Storage metrics Signed-off-by: Wise-Wizard --- cmd/jaeger/internal/extension/jaegerstorage/extension.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index 5e8d1061349..3c9ce5684e8 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -14,6 +14,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage/factoryadapter" "github.com/jaegertracing/jaeger/internal/metrics/otelmetrics" + "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/plugin/metrics/prometheus" "github.com/jaegertracing/jaeger/plugin/storage/badger" "github.com/jaegertracing/jaeger/plugin/storage/cassandra" @@ -112,7 +113,8 @@ func newStorageExt(config *Config, telset component.TelemetrySettings) *storageE } func (s *storageExt) Start(_ context.Context, _ component.Host) error { - mf := otelmetrics.NewFactory(s.telset.MeterProvider) + baseFactory := otelmetrics.NewFactory(s.telset.MeterProvider) + mf := baseFactory.Namespace(metrics.NSOptions{Name: "jaeger"}) for storageName, cfg := range s.config.Backends { s.telset.Logger.Sugar().Infof("Initializing storage '%s'", storageName) var factory storage.Factory