Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-32248 Add tracing to rowservice #19314

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 2 additions & 11 deletions fs/dafilesrv/dafilesrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ int main(int argc, const char* argv[])

EnableSEHtoExceptionMapping();
#ifndef __64BIT__

// Restrict stack sizes on 32-bit systems
Thread::setDefaultStackSize(0x10000); // 64K stack (also set in windows DSP)
#endif
Expand All @@ -396,16 +395,8 @@ int main(int argc, const char* argv[])
#endif

const char* componentTag = "dafilesrv";
Owned<IPropertyTree> componentDefault;
if (defaultYaml)
{
Owned<IPropertyTree> defaultConfig = createPTreeFromYAMLString(defaultYaml, 0, ptr_ignoreWhiteSpace, nullptr);
componentDefault.set(defaultConfig->queryPropTree(componentTag));
if (!componentDefault)
throw makeStringExceptionV(99, "Default configuration does not contain the tag %s", componentTag);
}
else
componentDefault.setown(createPTree(componentTag));
Owned<IPropertyTree> defaultConfig = createPTreeFromYAMLString(defaultYaml, 0, ptr_ignoreWhiteSpace, nullptr);
Owned<IPropertyTree> componentDefault(defaultConfig->queryPropTree(componentTag));
Copy link
Member

Choose a reason for hiding this comment

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

-ve leak. Needs to be a getPropTree

Copy link
Contributor Author

@jpmcmu jpmcmu Jan 10, 2025

Choose a reason for hiding this comment

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

Ok, right, I need to pay more attention to query/get and set/setown, it is slightly unituitive to me for some reason. So, is the following correct: get* methods will increase the reference count, query* methods will not. Owned constructor does NOT increase reference count, set increases reference count while setown does not.


// NB: bare-metal dafilesrv does not have a component specific xml, extracting relevant global configuration instead
Owned<IPropertyTree> config = loadConfiguration(componentDefault, extractedGlobalConfig, argv, componentTag, "DAFILESRV", nullptr, nullptr);
Expand Down
13 changes: 6 additions & 7 deletions fs/dafsserver/dafsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,10 +1114,9 @@ class CRemoteRequest : public CSimpleInterfaceOf<IInterface>
const char* fullTraceContext = requestTree->queryProp("_trace/traceparent");

// We only want to compare the trace-id & span-id, so remove the last "sampling" group
const char* traceParent = fullTraceContext ? fullTraceContext : "";
traceParent = strrchr(traceParent, '-');

if (strlen(traceParent) != 0 && requestTraceParent != traceParent)
std::string traceParent = fullTraceContext;
traceParent = traceParent.substr(0, traceParent.find_last_of('-'));
if (!traceParent.empty() && requestTraceParent != traceParent)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I am checking if the traceParent has changed every time process is called here because the client side may use multiple spans during the lifetime a single CRemoteRequest. See below screenshots for an example.

{
// Check to see if we have an existing span that needs to be marked successful before close
if (requestSpan != nullptr)
ghalliday marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -1134,7 +1133,7 @@ class CRemoteRequest : public CSimpleInterfaceOf<IInterface>
else
requestSpanName = "WriteRequest";

requestSpan.set(queryTraceManager().createServerSpan(requestSpanName, traceHeaders));
requestSpan.setown(queryTraceManager().createServerSpan(requestSpanName, traceHeaders));
requestTraceParent = traceParent;
}

Expand Down Expand Up @@ -5008,7 +5007,7 @@ class CRemoteFileServer : implements IRemoteFileServer, public CInterface
Owned<IProperties> traceHeaders = createProperties();
traceHeaders->setProp("traceparent", traceParent);
Copy link
Member

Choose a reason for hiding this comment

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

Should this also have the sampling suffix removed?


closeSpan.set(queryTraceManager().createServerSpan("CloseRequest", traceHeaders));
closeSpan.setown(queryTraceManager().createServerSpan("CloseRequest", traceHeaders));
}

if (0 == cursorHandle)
Expand Down Expand Up @@ -5053,7 +5052,7 @@ class CRemoteFileServer : implements IRemoteFileServer, public CInterface
Owned<IProperties> traceHeaders = createProperties();
traceHeaders->setProp("traceparent", traceParent);

versionSpan.set(queryTraceManager().createServerSpan("VersionRequest", traceHeaders));
versionSpan.setown(queryTraceManager().createServerSpan("VersionRequest", traceHeaders));
}

if (outFmt_Binary == outputFormat)
Expand Down
Loading