Skip to content

Commit

Permalink
HPCC-30403 Code review1
Browse files Browse the repository at this point in the history
- Removes accidental return statements
- Abbreviates logging.cpp logic

Signed-off-by: Rodrigo Pastrana <[email protected]>
  • Loading branch information
rpastrana committed Nov 21, 2023
1 parent e706bab commit 24b8967
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion common/thorhelper/thorcommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ class CStatsContextLogger : public CSimpleInterfaceOf<IContextLogger>
}
virtual void setSpanAttribute(const char *name, const char *value) const override
{
return ::setSpanAttribute(activeSpan, name, value);
::setSpanAttribute(activeSpan, name, value);
}
virtual const char *queryGlobalId() const override
{
Expand Down
26 changes: 5 additions & 21 deletions plugins/logging/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,41 +125,25 @@ LOGGING_API unsigned int LOGGING_CALL logGetElapsedMs(ICodeContext *ctx)

LOGGING_API char * LOGGING_CALL getTraceID(ICodeContext *ctx)
{
StringBuffer ret;
Owned<IProperties> httpHeaders = ctx->queryContextLogger().getSpanContext();
if (httpHeaders)
ret.set(httpHeaders->queryProp("traceID"));

StringBuffer ret(ctx->queryContextLogger().getSpanContext()->queryProp("traceID"));
return ret.detach();
}

LOGGING_API char * LOGGING_CALL getSpanID(ICodeContext *ctx)
{
StringBuffer ret;
Owned<IProperties> httpHeaders = ctx->queryContextLogger().getSpanContext();
if (httpHeaders)
ret.set(httpHeaders->queryProp("spanID"));

StringBuffer ret(ctx->queryContextLogger().getSpanContext()->queryProp("spanID"));
return ret.detach();
}

LOGGING_API char * LOGGING_CALL getTraceSpanHeader(ICodeContext *ctx)
{
StringBuffer ret;
Owned<IProperties> httpHeaders = ctx->queryContextLogger().getClientHeaders();
if (httpHeaders)
ret.set(httpHeaders->queryProp("traceparent"));

StringBuffer ret(ctx->queryContextLogger().getClientHeaders()->queryProp("traceparent"));
return ret.detach();
}

LOGGING_API char * LOGGING_CALL getTraceStateHeader(ICodeContext *ctx)
{
StringBuffer ret;
Owned<IProperties> httpHeaders = ctx->queryContextLogger().getClientHeaders();
if (httpHeaders)
ret.set(httpHeaders->queryProp("tracestate"));

StringBuffer ret(ctx->queryContextLogger().getClientHeaders()->queryProp("tracestate"));
return ret.detach();
}

Expand All @@ -170,4 +154,4 @@ LOGGING_API void LOGGING_CALL setSpanAttribute(ICodeContext *ctx,
StringBuffer attVal(valueLen, value);

ctx->queryContextLogger().setSpanAttribute(attName.str(), attVal.str());
}
}
2 changes: 1 addition & 1 deletion roxie/ccd/ccd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ class ContextLogger : implements IRoxieContextLogger, public CInterface
}
virtual void setSpanAttribute(const char *name, const char *value) const override
{
return ::setSpanAttribute(activeSpan, name, value);
::setSpanAttribute(activeSpan, name, value);
}
virtual const char *queryGlobalId() const override
{
Expand Down
2 changes: 1 addition & 1 deletion roxie/ccd/ccdcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext
}
virtual void setSpanAttribute(const char *name, const char *value) const override
{
return logctx.setSpanAttribute(name, value);
logctx.setSpanAttribute(name, value);
}
virtual const char *queryGlobalId() const override
{
Expand Down
4 changes: 2 additions & 2 deletions roxie/ccd/ccdserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class IndirectAgentContext : implements IRoxieAgentContext, public CInterface
}
virtual void setSpanAttribute(const char *name, const char *value) const override
{
return ctx->setSpanAttribute(name, value);
ctx->setSpanAttribute(name, value);
}
virtual const char *queryGlobalId() const
{
Expand Down Expand Up @@ -1376,7 +1376,7 @@ class CRoxieServerActivity : implements CInterfaceOf<IRoxieServerActivity>, impl
}
virtual void setSpanAttribute(const char *name, const char *value) const override
{
return ctx->setSpanAttribute(name, value);
ctx->setSpanAttribute(name, value);
}
virtual const char *queryGlobalId() const override
{
Expand Down
2 changes: 1 addition & 1 deletion system/jlib/jlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,7 @@ class DummyLogCtx : implements IContextLogger
}
virtual void setSpanAttribute(const char *name, const char *value) const override
{
return ::setSpanAttribute(activeSpan, name, value);
::setSpanAttribute(activeSpan, name, value);
}
virtual const char *queryGlobalId() const override
{
Expand Down

0 comments on commit 24b8967

Please sign in to comment.