Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Add language prefix to Jaeger client version tag #35

Merged
merged 1 commit into from
Dec 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jaegertracing/Constants.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
11 changes: 11 additions & 0 deletions src/jaegertracing/TracerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ TEST(Tracer, testTracer)
const auto tracer =
std::static_pointer_cast<Tracer>(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<const char*>());
ASSERT_EQ("C++-",
static_cast<std::string>(tagItr->value().get<const char*>()).substr(0, 4));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg... this would've been one line in scala. Let me try:

assert(span.tags.find(_.key == 'jaeger.version').map(_.value) == Some('c++-..'))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol ya C++ has borrowed a lot of ideas from more functional languages but nowhere near Scala and others yet.


opentracing::StartSpanOptions options;
options.tags.push_back({ "tag-key", 1.23 });

Expand Down