Skip to content

Commit

Permalink
HPCC-32691 Add optional timestamp arg to createClientSpan() 2
Browse files Browse the repository at this point in the history
Signed-off-by: M Kelly <[email protected]>
  • Loading branch information
mckellyln committed Sep 19, 2024
1 parent efa28e8 commit e6f0432
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions system/jlib/jtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ class CSpan : public CInterfaceOf<ISpan>
}

ISpan * createClientSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp = nullptr) override;
ISpan * createInternalSpan(const char * name) override;
ISpan * createInternalSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp = nullptr) override;

virtual void endSpan() final override
{
Expand Down Expand Up @@ -919,7 +919,7 @@ class CNullSpan final : public CInterfaceOf<ISpan>
virtual const char* queryLocalId() const override { return nullptr; }

virtual ISpan * createClientSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp = nullptr) override { return getNullSpan(); }
virtual ISpan * createInternalSpan(const char * name) override { return getNullSpan(); }
virtual ISpan * createInternalSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp = nullptr) override { return getNullSpan(); }

private:
CNullSpan(const CNullSpan&) = delete;
Expand All @@ -930,9 +930,14 @@ class CNullSpan final : public CInterfaceOf<ISpan>
class CChildSpan : public CSpan
{
protected:
CChildSpan(const char * spanName, CSpan * parent)
CChildSpan(const char * spanName, CSpan * parent, const SpanTimeStamp *spanStartTimeStamp = nullptr)
: CSpan(spanName), localParentSpan(parent)
{
if (spanStartTimeStamp && spanStartTimeStamp->isInitialized())
{
opts.start_system_time = opentelemetry::common::SystemTimestamp(spanStartTimeStamp->systemClockTime);
opts.start_steady_time = opentelemetry::common::SteadyTimestamp(spanStartTimeStamp->steadyClockTime);
}
injectlocalParentSpan(localParentSpan);
}

Expand Down Expand Up @@ -984,8 +989,8 @@ class CChildSpan : public CSpan
class CInternalSpan : public CChildSpan
{
public:
CInternalSpan(const char * spanName, CSpan * parent)
: CChildSpan(spanName, parent)
CInternalSpan(const char * spanName, CSpan * parent, const SpanTimeStamp * spanStartTimeStamp = nullptr)
: CChildSpan(spanName, parent, spanStartTimeStamp)
{
opts.kind = opentelemetry::trace::SpanKind::kInternal;
init(SpanFlags::None);
Expand All @@ -1002,13 +1007,8 @@ class CClientSpan : public CChildSpan
{
public:
CClientSpan(const char * spanName, CSpan * parent, const SpanTimeStamp * spanStartTimeStamp = nullptr)
: CChildSpan(spanName, parent)
: CChildSpan(spanName, parent, spanStartTimeStamp)
{
if (spanStartTimeStamp && spanStartTimeStamp->isInitialized())
{
opts.start_system_time = opentelemetry::common::SystemTimestamp(spanStartTimeStamp->systemClockTime);
opts.start_steady_time = opentelemetry::common::SteadyTimestamp(spanStartTimeStamp->steadyClockTime);
}
opts.kind = opentelemetry::trace::SpanKind::kClient;
init(SpanFlags::None);
}
Expand All @@ -1025,9 +1025,9 @@ ISpan * CSpan::createClientSpan(const char * name, const SpanTimeStamp * spanSta
return new CClientSpan(name, this, spanStartTimeStamp);
}

ISpan * CSpan::createInternalSpan(const char * name)
ISpan * CSpan::createInternalSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp)
{
return new CInternalSpan(name, this);
return new CInternalSpan(name, this, spanStartTimeStamp);
}

class CServerSpan : public CSpan
Expand Down
2 changes: 1 addition & 1 deletion system/jlib/jtrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ interface ISpan : extends IInterface
virtual const char * querySpanId() const = 0;

virtual ISpan * createClientSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp = nullptr) = 0;
virtual ISpan * createInternalSpan(const char * name) = 0;
virtual ISpan * createInternalSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp = nullptr) = 0;

//Old-style global/caller/local id interface functions
virtual const char* queryGlobalId() const = 0;
Expand Down

0 comments on commit e6f0432

Please sign in to comment.