From b8c769a0bf6ad299e409297b15c6e88558b61340 Mon Sep 17 00:00:00 2001 From: Isaac Hier Date: Sun, 17 Dec 2017 08:49:23 -0500 Subject: [PATCH] Add language prefix to Jaeger client version tag Signed-off-by: Isaac Hier --- src/jaegertracing/Constants.h.in | 2 +- src/jaegertracing/TracerTest.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/jaegertracing/Constants.h.in b/src/jaegertracing/Constants.h.in index f6292d1d..c5b90f55 100644 --- a/src/jaegertracing/Constants.h.in +++ b/src/jaegertracing/Constants.h.in @@ -21,7 +21,7 @@ namespace jaegertracing { -static constexpr auto kJaegerClientVersion = "@PROJECT_VERSION@"; +static constexpr auto kJaegerClientVersion = "C++-@PROJECT_VERSION@"; static constexpr auto kJaegerClientVersionTagKey = "jaeger.version"; static constexpr auto kJaegerDebugHeader = "jaeger-debug-id"; static constexpr auto kJaegerBaggageHeader = "jaeger-baggage"; diff --git a/src/jaegertracing/TracerTest.cpp b/src/jaegertracing/TracerTest.cpp index 7d352d98..30290d23 100644 --- a/src/jaegertracing/TracerTest.cpp +++ b/src/jaegertracing/TracerTest.cpp @@ -122,6 +122,17 @@ TEST(Tracer, testTracer) const auto tracer = std::static_pointer_cast(opentracing::Tracer::Global()); + auto tagItr = + std::find_if(std::begin(tracer->tags()), + std::end(tracer->tags()), + [](const Tag& tag) { + return tag.key() == kJaegerClientVersionTagKey; + }); + ASSERT_NE(std::end(tracer->tags()), tagItr); + ASSERT_TRUE(tagItr->value().is()); + ASSERT_EQ("C++-", + static_cast(tagItr->value().get()).substr(0, 4)); + opentracing::StartSpanOptions options; options.tags.push_back({ "tag-key", 1.23 });