Skip to content

Commit

Permalink
HPCC-30470 codereviewZZZ
Browse files Browse the repository at this point in the history
- Removing unittests
- Removing CMAKE entry
- Changing string copy

Signed-off-by: Rodrigo Pastrana <[email protected]>
  • Loading branch information
rpastrana committed Dec 11, 2023
1 parent 8fe223a commit a2c2b23
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
11 changes: 5 additions & 6 deletions system/jlib/jtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,9 @@ class JLogSpanExporter final : public opentelemetry::sdk::trace::SpanExporter
out.append(", \"parent_span_id\": \"").append(16, parentSpanID).append("\"");
}

StringAttr ts;
ts.set(span->GetSpanContext().trace_state()->ToHeader().c_str());
if (!ts.isEmpty())
out.appendf(", \"trace_state\": \"%s\"", span->GetSpanContext().trace_state()->ToHeader().c_str());
std::string traceStatestr = span->GetSpanContext().trace_state()->ToHeader();
if (!traceStatestr.empty())
out.appendf(", \"trace_state\": \"%s\"", traceStatestr.c_str());
}

if (hasMask(logFlags, SpanLogFlags::LogSpanDetails))
Expand Down Expand Up @@ -372,7 +371,7 @@ class JLogSpanExporter final : public opentelemetry::sdk::trace::SpanExporter
std::atomic_bool shutDown;
};

#ifdef _USE_CPPUNIT
/*#ifdef _USE_CPPUNIT
void testJLogExporterPrintAttributes(StringBuffer & out, const std::unordered_map<std::string, opentelemetry::sdk::common::OwnedAttributeValue> & map, const char * attsContainerName)
{
JLogSpanExporter::printAttributes(out, map, attsContainerName);
Expand All @@ -383,7 +382,7 @@ void testJLogExporterPrintResources(StringBuffer & out, const opentelemetry::sdk
JLogSpanExporter::printResources(out, resources);
}
#endif

*/
class JLogSpanExporterFactory
{
public:
Expand Down
2 changes: 2 additions & 0 deletions system/jlib/jtrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ interface ITraceManager : extends IInterface
extern jlib_decl ISpan * getNullSpan();
extern jlib_decl void initTraceManager(const char * componentName, const IPropertyTree * componentConfig, const IPropertyTree * globalConfig);
extern jlib_decl ITraceManager & queryTraceManager();
/*
#ifdef _USE_CPPUNIT
#include "opentelemetry/sdk/common/attribute_utils.h"
#include "opentelemetry/sdk/resource/resource.h"
extern jlib_decl void testJLogExporterPrintResources(StringBuffer & out, const opentelemetry::sdk::resource::Resource &resources);
extern jlib_decl void testJLogExporterPrintAttributes(StringBuffer & out, const std::unordered_map<std::string, opentelemetry::sdk::common::OwnedAttributeValue> & map, const char * attsContainerName);
#endif
*/


//The following class is responsible for ensuring that the active span is restored in a context when the scope is exited
Expand Down
1 change: 0 additions & 1 deletion testing/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ include_directories (
${CMAKE_BINARY_DIR}/generated
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/oss
${HPCC_SOURCE_DIR}/system/globalid
)

ADD_DEFINITIONS( -D_CONSOLE )
Expand Down
12 changes: 6 additions & 6 deletions testing/unittests/jlibtests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class JlibTraceTest : public CppUnit::TestFixture
CPPUNIT_TEST(testClientSpanGlobalID);
CPPUNIT_TEST(testEnsureTraceID);

CPPUNIT_TEST(testJTraceJLOGExporterprintResources);
CPPUNIT_TEST(testJTraceJLOGExporterprintAttributes);
//CPPUNIT_TEST(testJTraceJLOGExporterprintResources);
//CPPUNIT_TEST(testJTraceJLOGExporterprintAttributes);
CPPUNIT_TEST_SUITE_END();

const char * simulatedGlobalYaml = R"!!(global:
Expand Down Expand Up @@ -110,7 +110,7 @@ class JlibTraceTest : public CppUnit::TestFixture

protected:

void testJTraceJLOGExporterprintAttributes()
/*void testJTraceJLOGExporterprintAttributes()
{
StringBuffer out;
testJLogExporterPrintAttributes(out, {}, "attributes");
Expand Down Expand Up @@ -144,9 +144,9 @@ class JlibTraceTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("attributes/url"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("attributes/content-length"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("attributes/content-type"));
}
}*/

void testJTraceJLOGExporterprintResources()
/*void testJTraceJLOGExporterprintResources()
{
StringBuffer out;
auto dummyAttributes = opentelemetry::sdk::resource::ResourceAttributes
Expand Down Expand Up @@ -186,7 +186,7 @@ class JlibTraceTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("resources/telemetry.sdk.language"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("resources/telemetry.sdk.version"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing resource attribute detected", true, jtraceAsTree->hasProp("resources/telemetry.sdk.name"));
}
}*/

void testTraceDisableConfig()
{
Expand Down

0 comments on commit a2c2b23

Please sign in to comment.