From 36de8bd27d74005a6703d716d84c0b2ae3c14e99 Mon Sep 17 00:00:00 2001 From: "yusheng.ma" Date: Tue, 28 Jul 2026 08:51:44 +0000 Subject: [PATCH] Add service name differentiation for tracer --- include/common/Tracer.h | 1 + src/common/Tracer.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/common/Tracer.h b/include/common/Tracer.h index 91e1de9..3edd907 100644 --- a/include/common/Tracer.h +++ b/include/common/Tracer.h @@ -31,6 +31,7 @@ struct TraceConfig { std::string otlpHeaders; bool oltpSecure; + std::string clusterID; int nodeID; }; diff --git a/src/common/Tracer.cpp b/src/common/Tracer.cpp index 19bd473..b97ade9 100644 --- a/src/common/Tracer.cpp +++ b/src/common/Tracer.cpp @@ -105,7 +105,8 @@ initTelemetry(const TraceConfig& cfg) { } if (export_created) { auto processor = trace_sdk::BatchSpanProcessorFactory::Create(std::move(exporter), {}); - resource::ResourceAttributes attributes = {{"service.name", TRACE_SERVICE_SEGCORE}, {"NodeID", cfg.nodeID}}; + auto service_name = cfg.clusterID + "-" + TRACE_SERVICE_SEGCORE; + resource::ResourceAttributes attributes = {{"service.name", service_name}, {"NodeID", cfg.nodeID}}; auto resource = resource::Resource::Create(attributes); auto sampler = std::make_unique(std::make_shared()); std::shared_ptr provider =