diff --git a/common/thorhelper/thorsoapcall.cpp b/common/thorhelper/thorsoapcall.cpp index 28f99263a69..ae9db5ffd49 100644 --- a/common/thorhelper/thorsoapcall.cpp +++ b/common/thorhelper/thorsoapcall.cpp @@ -1913,11 +1913,11 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo #endif if (!isEmptyString(master->logctx.queryGlobalId())) { - if (!httpHeaderBlockContainsHeader(httpheaders, master->logctx.queryGlobalIdHttpHeaderName())) - request.append(master->logctx.queryGlobalIdHttpHeaderName()).append(": ").append(master->logctx.queryGlobalId()).append("\r\n"); + if (!httpHeaderBlockContainsHeader(httpheaders, kGlobalIdHttpHeaderName)) + request.append(kGlobalIdHttpHeaderName).append(": ").append(master->logctx.queryGlobalId()).append("\r\n"); - if (!isEmptyString(master->logctx.queryLocalId()) && !httpHeaderBlockContainsHeader(httpheaders, master->logctx.queryCallerIdHttpHeaderName())) - request.append(master->logctx.queryCallerIdHttpHeaderName()).append(": ").append(master->logctx.queryLocalId()).append("\r\n"); //our localId is reciever's callerId + if (!isEmptyString(master->logctx.queryLocalId()) && !httpHeaderBlockContainsHeader(httpheaders, kCallerIdHttpHeaderName)) + request.append(kCallerIdHttpHeaderName).append(": ").append(master->logctx.queryLocalId()).append("\r\n"); //our localId is reciever's callerId } if (master->wscType == STsoap) diff --git a/ecl/eclagent/eclagent.cpp b/ecl/eclagent/eclagent.cpp index 1ca18ca42c4..fb37eb3bf9e 100644 --- a/ecl/eclagent/eclagent.cpp +++ b/ecl/eclagent/eclagent.cpp @@ -2130,9 +2130,6 @@ void EclAgent::runProcess(IEclProcess *process) assertex(rowManager==NULL); allocatorMetaCache.setown(createRowAllocatorCache(this)); - if (agentTopology->hasProp("@httpGlobalIdHeader")) - updateDummyContextLogger().setHttpIdHeaderNames(agentTopology->queryProp("@httpGlobalIdHeader"), agentTopology->queryProp("@httpCallerIdHeader")); - if (queryWorkUnit()->hasDebugValue("GlobalId")) { SCMStringBuffer globalId; diff --git a/esp/bindings/http/platform/httptransport.cpp b/esp/bindings/http/platform/httptransport.cpp index 6ff68f380e8..7491e6f2703 100644 --- a/esp/bindings/http/platform/httptransport.cpp +++ b/esp/bindings/http/platform/httptransport.cpp @@ -1942,9 +1942,13 @@ void CHttpRequest::updateContext() m_context->setAcceptLanguage(acceptLanguage.str()); StringBuffer callerId, globalId; getHeader(HTTP_HEADER_HPCC_GLOBAL_ID, globalId); + if (globalId.isEmpty()) + getHeader("hpcc-global-id", globalId); if(globalId.length()) m_context->setGlobalId(globalId); getHeader(HTTP_HEADER_HPCC_CALLER_ID, callerId); + if (callerId.isEmpty()) + getHeader("hpcc-caller-id", callerId); if(callerId.length()) m_context->setCallerId(callerId); } diff --git a/esp/services/ws_ecl/ws_ecl_service.cpp b/esp/services/ws_ecl/ws_ecl_service.cpp index af2a2830117..10535990734 100644 --- a/esp/services/ws_ecl/ws_ecl_service.cpp +++ b/esp/services/ws_ecl/ws_ecl_service.cpp @@ -349,13 +349,6 @@ bool CWsEclService::init(const char * name, const char * type, IPropertyTree * c else workunitTimeout = WAIT_FOREVER; - const char *headerName = serviceTree->queryProp("HttpGlobalIdHeader"); - if (headerName && *headerName && !streq(headerName, "Global-Id") && !streq(headerName, "HPCC-Global-Id")) //defaults will be checked anyway - globalIdHttpHeader.set(headerName); - headerName = serviceTree->queryProp("HttpCallerIdHeader"); - if (headerName && *headerName && !streq(headerName, "Caller-Id") && !streq(headerName, "HPCC-Caller-Id")) //defaults will be checked anyway - callerIdHttpHeader.set(headerName); - Owned cfgTargets = serviceTree->getElements("Targets/Target"); ForEach(*cfgTargets) targets.append(cfgTargets->query().queryProp(NULL)); @@ -2003,18 +1996,15 @@ int CWsEclBinding::submitWsEclWorkunit(IEspContext & context, WsEclWuInfo &wsinf if (httpreq) { StringBuffer globalId, callerId; - StringAttr globalIdHeader, callerIdHeader; - wsecl->getHttpGlobalIdHeader(httpreq, globalId, globalIdHeader); - wsecl->getHttpCallerIdHeader(httpreq, callerId, callerIdHeader); + wsecl->getHttpGlobalIdHeader(httpreq, globalId); + wsecl->getHttpCallerIdHeader(httpreq, callerId); if (globalId.length()) { workunit->setDebugValue("GlobalId", globalId.str(), true); - workunit->setDebugValue("GlobalIdHeader", globalIdHeader.str(), true); //use same header received StringBuffer localId; appendGloballyUniqueId(localId); workunit->setDebugValue("CallerId", localId.str(), true); //our localId becomes caller id for the next hop - workunit->setDebugValue("CallerIdHeader", callerIdHeader.str(), true); //use same header received DBGLOG("GlobalId: %s, CallerId: %s, LocalId: %s, Wuid: %s", globalId.str(), callerId.str(), localId.str(), wuid.str()); } IProperties *params = httpreq->queryParameters(); @@ -2103,19 +2093,18 @@ void CWsEclBinding::sendRoxieRequest(const char *target, StringBuffer &req, Stri if (httpreq) { StringBuffer globalId, callerId; - StringAttr globalIdHeader, callerIdHeader; - wsecl->getHttpGlobalIdHeader(httpreq, globalId, globalIdHeader); - wsecl->getHttpCallerIdHeader(httpreq, callerId, callerIdHeader); + wsecl->getHttpGlobalIdHeader(httpreq, globalId); + wsecl->getHttpCallerIdHeader(httpreq, callerId); if (globalId.length()) { headers.setown(createProperties()); - headers->setProp(globalIdHeader, globalId); + headers->setProp(kGlobalIdHttpHeaderName, globalId); StringBuffer localId; appendGloballyUniqueId(localId); if (localId.length()) - headers->setProp(callerIdHeader, localId); + headers->setProp(kCallerIdHttpHeaderName, localId); DBGLOG("GlobalId: %s, CallerId: %s, LocalId: %s", globalId.str(), callerId.str(), localId.str()); } diff --git a/esp/services/ws_ecl/ws_ecl_service.hpp b/esp/services/ws_ecl/ws_ecl_service.hpp index 687f85f21dd..e6e354b92e0 100644 --- a/esp/services/ws_ecl/ws_ecl_service.hpp +++ b/esp/services/ws_ecl/ws_ecl_service.hpp @@ -96,8 +96,6 @@ class CWsEclService : public CInterface, StringArray targets; StringAttr auth_method; StringAttr portal_URL; - StringAttr globalIdHttpHeader; - StringAttr callerIdHttpHeader; unsigned roxieTimeout; unsigned workunitTimeout; @@ -111,50 +109,29 @@ class CWsEclService : public CInterface, virtual bool init(const char * name, const char * type, IPropertyTree * cfg, const char * process); virtual void setContainer(IEspContainer * container){} - inline bool getHttpIdHeader(CHttpRequest *request, const char *header, StringBuffer &value, StringAttr &nameused) + inline bool getHttpIdHeader(CHttpRequest *request, const char *header, StringBuffer &value) { if (!header || !*header) return false; request->getHeader(header, value.clear()); if (value.length()) - { - nameused.set(header); return true; - } return false; } - StringBuffer &getHttpGlobalIdHeader(CHttpRequest *request, StringBuffer &value, StringAttr &nameused) + StringBuffer &getHttpGlobalIdHeader(CHttpRequest *request, StringBuffer &value) { - if (!getHttpIdHeader(request, globalIdHttpHeader, value, nameused)) - { - if (!getHttpIdHeader(request, "Global-Id", value, nameused)) - getHttpIdHeader(request, "HPCC-Global-Id", value, nameused); - } + if (!getHttpIdHeader(request, kGlobalIdHttpHeaderName, value)) + getHttpIdHeader(request, kLegacyGlobalIdHttpHeaderName, value); return value; } - StringBuffer &getHttpCallerIdHeader(CHttpRequest *request, StringBuffer &value, StringAttr &nameused) + StringBuffer &getHttpCallerIdHeader(CHttpRequest *request, StringBuffer &value) { - if (!getHttpIdHeader(request, callerIdHttpHeader, value, nameused)) - { - if (!getHttpIdHeader(request, "Caller-Id", value, nameused)) - getHttpIdHeader(request, "HPCC-Caller-Id", value, nameused); - } + if (!getHttpIdHeader(request, kCallerIdHttpHeaderName, value)) + getHttpIdHeader(request, kLegacyCallerIdHttpHeaderName, value); return value; } - const char *queryGlobalIdHeaderName() - { - if (!globalIdHttpHeader.isEmpty()) - return globalIdHttpHeader; - return "HPCC-Global-Id"; //HPCC default - } - const char *queryCallerIdHeaderName() - { - if (!callerIdHttpHeader.isEmpty()) - return callerIdHttpHeader; - return "HPCC-Caller-Id"; //HPCC default - } bool unsubscribeServiceFromDali() override {return true;} bool subscribeServiceToDali() override {return false;} diff --git a/helm/hpcc/values.schema.json b/helm/hpcc/values.schema.json index 5525f1916c2..2e9399b1493 100644 --- a/helm/hpcc/values.schema.json +++ b/helm/hpcc/values.schema.json @@ -1740,16 +1740,6 @@ "minimum": 0, "description": "Timeout (in ms) before high priority requests are resent to agents" }, - "httpCallerIdHeader": { - "type": "string", - "default": "HPCC-Caller-Id", - "description": "HTTP Header field to use for sending and receiving CallerId" - }, - "httpGlobalIdHeader": { - "type": "string", - "default": "HPCC-Global-Id", - "description": "HTTP Header field to use for sending and receiving GlobalId" - }, "ignoreOrphans": { "type": "boolean", "default": true, diff --git a/roxie/ccd/ccd.hpp b/roxie/ccd/ccd.hpp index 2eda5bede1c..fb9b07c8ad6 100644 --- a/roxie/ccd/ccd.hpp +++ b/roxie/ccd/ccd.hpp @@ -602,8 +602,6 @@ class ContextLogger : implements IRoxieContextLogger, public CInterface start = msTick(); channel = 0; aborted = false; - if ( topology && topology->hasProp("@httpGlobalIdHeader")) - setHttpIdHeaderNames(topology->queryProp("@httpGlobalIdHeader"), topology->queryProp("@httpCallerIdHeader")); } void outputXML(IXmlStreamFlusher &out) @@ -764,18 +762,6 @@ class ContextLogger : implements IRoxieContextLogger, public CInterface { return logTrace.queryLocalId(); } - virtual void setHttpIdHeaderNames(const char *global, const char *caller) override - { - logTrace.setHttpIdHeaderNames(global, caller); - } - virtual const char *queryGlobalIdHttpHeaderName() const override - { - return logTrace.queryGlobalIdHTTPHeaderName(); - } - virtual const char *queryCallerIdHttpHeaderName() const override - { - return logTrace.queryCallerIdHTTPHeaderName(); - } virtual const CRuntimeStatisticCollection & queryStats() const override { return stats; diff --git a/roxie/ccd/ccdcontext.cpp b/roxie/ccd/ccdcontext.cpp index 0b0ea57de7b..5b7ca7e0daf 100644 --- a/roxie/ccd/ccdcontext.cpp +++ b/roxie/ccd/ccdcontext.cpp @@ -1399,18 +1399,6 @@ class CRoxieContextBase : implements IRoxieAgentContext, implements ICodeContext { return logctx.queryLocalId(); } - virtual void setHttpIdHeaderNames(const char *global, const char *caller) override - { - const_cast(logctx).setHttpIdHeaderNames(global, caller); - } - virtual const char *queryGlobalIdHttpHeaderName() const override - { - return logctx.queryGlobalIdHttpHeaderName(); - } - virtual const char *queryCallerIdHttpHeaderName() const override - { - return logctx.queryCallerIdHttpHeaderName(); - } virtual const CRuntimeStatisticCollection & queryStats() const override { return logctx.queryStats(); diff --git a/roxie/ccd/ccdprotocol.cpp b/roxie/ccd/ccdprotocol.cpp index 66ec3ca8ff8..1cf57813385 100644 --- a/roxie/ccd/ccdprotocol.cpp +++ b/roxie/ccd/ccdprotocol.cpp @@ -1687,27 +1687,19 @@ class RoxieSocketWorker : public ProtocolQueryWorker return id; } - const char *queryRequestGlobalIdHeader(HttpHelper &httpHelper, IContextLogger &logctx, StringAttr &headerused) + const char *queryRequestGlobalIdHeader(HttpHelper &httpHelper, IContextLogger &logctx) { - const char *id = queryRequestIdHeader(httpHelper, logctx.queryGlobalIdHttpHeaderName(), headerused); + const char *id = httpHelper.queryRequestHeader(kGlobalIdHttpHeaderName); if (!id || !*id) - { - id = queryRequestIdHeader(httpHelper, "Global-Id", headerused); - if (!id || !*id) - id = queryRequestIdHeader(httpHelper, "HPCC-Global-Id", headerused); - } + id = httpHelper.queryRequestHeader(kLegacyGlobalIdHttpHeaderName); // Backward compatibility - passed on as global-id return id; } - const char *queryRequestCallerIdHeader(HttpHelper &httpHelper, IContextLogger &logctx, StringAttr &headerused) + const char *queryRequestCallerIdHeader(HttpHelper &httpHelper, IContextLogger &logctxheaderused) { - const char *id = queryRequestIdHeader(httpHelper, logctx.queryCallerIdHttpHeaderName(), headerused); + const char *id = httpHelper.queryRequestHeader(kCallerIdHttpHeaderName); if (!id || !*id) - { - id = queryRequestIdHeader(httpHelper, "Caller-Id", headerused); - if (!id || !*id) - id = queryRequestIdHeader(httpHelper, "HPCC-Caller-Id", headerused); - } + id = httpHelper.queryRequestHeader(kLegacyCallerIdHttpHeaderName); // Backward compatibility - passed on as caller-id return id; } @@ -1804,10 +1796,8 @@ class RoxieSocketWorker : public ProtocolQueryWorker mlResponseFmt = httpHelper.queryResponseMlFormat(); mlRequestFmt = httpHelper.queryRequestMlFormat(); - StringAttr globalIdHeader, callerIdHeader; - const char *globalId = queryRequestGlobalIdHeader(httpHelper, logctx, globalIdHeader); - const char *callerId = queryRequestCallerIdHeader(httpHelper, logctx, callerIdHeader); - logctx.setHttpIdHeaderNames(globalIdHeader, callerIdHeader); + const char *globalId = queryRequestGlobalIdHeader(httpHelper, logctx); + const char *callerId = queryRequestCallerIdHeader(httpHelper, logctx); if (globalId && *globalId) msgctx->setTransactionId(globalId, callerId, true); //logged and forwarded through SOAPCALL/HTTPCALL else if (callerId && *callerId) diff --git a/roxie/ccd/ccdserver.cpp b/roxie/ccd/ccdserver.cpp index a6c4bf59e37..fa6aeec7954 100644 --- a/roxie/ccd/ccdserver.cpp +++ b/roxie/ccd/ccdserver.cpp @@ -291,18 +291,6 @@ class IndirectAgentContext : implements IRoxieAgentContext, public CInterface { return ctx->queryLocalId(); } - virtual void setHttpIdHeaderNames(const char *global, const char *caller) - { - ctx->setHttpIdHeaderNames(global, caller); - } - virtual const char *queryGlobalIdHttpHeaderName() const - { - return ctx->queryGlobalIdHttpHeaderName(); - } - virtual const char *queryCallerIdHttpHeaderName() const override - { - return ctx->queryCallerIdHttpHeaderName(); - } virtual const QueryOptions &queryOptions() const { return ctx->queryOptions(); @@ -1381,19 +1369,6 @@ class CRoxieServerActivity : implements CInterfaceOf, impl { return ctx ? ctx->queryLocalId() : nullptr; } - virtual void setHttpIdHeaderNames(const char *global, const char *caller) override - { - if (ctx) - ctx->setHttpIdHeaderNames(global, caller); - } - virtual const char *queryGlobalIdHttpHeaderName() const override - { - return ctx ? ctx->queryGlobalIdHttpHeaderName() : "HPCC-Global-Id"; - } - virtual const char *queryCallerIdHttpHeaderName() const override - { - return ctx ? ctx->queryCallerIdHttpHeaderName() : "HPCC-Caller-Id"; - } virtual const CRuntimeStatisticCollection & queryStats() const override { return stats; diff --git a/system/jlib/jlog.cpp b/system/jlib/jlog.cpp index 6d813f878e5..1086c1c58f8 100644 --- a/system/jlib/jlog.cpp +++ b/system/jlib/jlog.cpp @@ -2883,18 +2883,6 @@ class DummyLogCtx : implements IContextLogger { return logTrace.queryLocalId(); } - virtual void setHttpIdHeaderNames(const char *global, const char *caller) override - { - logTrace.setHttpIdHeaderNames(global, caller); - } - virtual const char *queryGlobalIdHttpHeaderName() const override - { - return logTrace.queryGlobalIdHTTPHeaderName(); - } - virtual const char *queryCallerIdHttpHeaderName() const override - { - return logTrace.queryCallerIdHTTPHeaderName(); - } virtual const CRuntimeStatisticCollection &queryStats() const override { throwUnexpected(); diff --git a/system/jlib/jlog.hpp b/system/jlib/jlog.hpp index cfb7692af02..a8f0af48ebd 100644 --- a/system/jlib/jlog.hpp +++ b/system/jlib/jlog.hpp @@ -1254,11 +1254,8 @@ interface jlib_decl IContextLogger : extends IInterface virtual unsigned queryTraceLevel() const = 0; virtual void setGlobalId(const char *id, SocketEndpoint &ep, unsigned pid) = 0; - virtual void setHttpIdHeaderNames(const char *global, const char *caller) = 0; virtual const char *queryGlobalId() const = 0; virtual const char *queryLocalId() const = 0; - virtual const char *queryGlobalIdHttpHeaderName() const = 0; - virtual const char *queryCallerIdHttpHeaderName() const = 0; virtual void setCallerId(const char *id) = 0; virtual const char *queryCallerId() const = 0; virtual const CRuntimeStatisticCollection & queryStats() const = 0; diff --git a/system/jlib/jtrace.cpp b/system/jlib/jtrace.cpp index 128b3b60327..a6f7c8d27ee 100644 --- a/system/jlib/jtrace.cpp +++ b/system/jlib/jtrace.cpp @@ -264,10 +264,10 @@ class CSpan : public CInterfaceOf propagator->Inject(*carrier, spanCtx); if (!isEmptyString(hpccGlobalId.get())) - carrier->Set(HPCCSemanticConventions::kGLOBALIDHTTPHeader, hpccGlobalId.get()); + carrier->Set(kGlobalIdHttpHeaderName, hpccGlobalId.get()); if (!isEmptyString(hpccCallerId.get())) - carrier->Set(HPCCSemanticConventions::kCallerIdHTTPHeader, hpccCallerId.get()); + carrier->Set(kCallerIdHttpHeaderName, hpccCallerId.get()); return true; } @@ -287,10 +287,10 @@ class CSpan : public CInterfaceOf return false; if (!isEmptyString(hpccGlobalId.get())) - ctxProps->setProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader, hpccGlobalId.get()); + ctxProps->setProp(kGlobalIdHttpHeaderName, hpccGlobalId.get()); if (!isEmptyString(hpccCallerId.get())) - ctxProps->setProp(HPCCSemanticConventions::kCallerIdHTTPHeader, hpccCallerId.get()); + ctxProps->setProp(kCallerIdHttpHeaderName, hpccCallerId.get()); if (span == nullptr) return false; @@ -539,7 +539,7 @@ class CServerSpan : public CSpan void setSpanContext(StringArray & httpHeaders, const char kvDelineator = ':') { - Owned contextProps = createProperties(); + Owned contextProps = createProperties(true); ForEachItemIn(currentHeaderIndex, httpHeaders) { const char* httpHeader = httpHeaders.item(currentHeaderIndex); @@ -568,13 +568,17 @@ class CServerSpan : public CSpan //if (key == opentel_trace::propagation::kTraceParent || key == opentel_trace::propagation::kTraceState ) // theKey[0] = toupper(theKey[0]); - if (httpHeaders->hasProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader)) - hpccGlobalId.set(httpHeaders->queryProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader)); + if (httpHeaders->hasProp(kGlobalIdHttpHeaderName)) + hpccGlobalId.set(httpHeaders->queryProp(kGlobalIdHttpHeaderName)); + else if (httpHeaders->hasProp(kLegacyGlobalIdHttpHeaderName)) + hpccGlobalId.set(httpHeaders->queryProp(kLegacyGlobalIdHttpHeaderName)); else DBGLOG("ServerSpan: HPCCGlobalID not found in http headers"); - if (httpHeaders->hasProp(HPCCSemanticConventions::kCallerIdHTTPHeader)) - hpccCallerId.set(httpHeaders->queryProp(HPCCSemanticConventions::kCallerIdHTTPHeader)); + if (httpHeaders->hasProp(kCallerIdHttpHeaderName)) + hpccCallerId.set(httpHeaders->queryProp(kCallerIdHttpHeaderName)); + else if (httpHeaders->hasProp(kLegacyCallerIdHttpHeaderName)) + hpccCallerId.set(httpHeaders->queryProp(kLegacyCallerIdHttpHeaderName)); else { DBGLOG("ServerSpan: HPCCCallerID not provied"); diff --git a/system/jlib/jtrace.hpp b/system/jlib/jtrace.hpp index 5e5a84fb2ef..2094dd9b14a 100644 --- a/system/jlib/jtrace.hpp +++ b/system/jlib/jtrace.hpp @@ -23,11 +23,10 @@ * Known HPCC span Keys could be added here * Specialized span keys can also be defined within the scope of a span */ -namespace HPCCSemanticConventions -{ -static constexpr const char *kGLOBALIDHTTPHeader = "HPCC-Global-Id"; -static constexpr const char *kCallerIdHTTPHeader = "HPCC-Caller-Id"; -} +static constexpr const char *kGlobalIdHttpHeaderName = "Global-Id"; +static constexpr const char *kCallerIdHttpHeaderName = "Caller-Id"; +static constexpr const char *kLegacyGlobalIdHttpHeaderName = "HPCC-Global-Id"; +static constexpr const char *kLegacyCallerIdHttpHeaderName = "HPCC-Caller-Id"; class jlib_decl LogTrace { @@ -36,9 +35,6 @@ class jlib_decl LogTrace StringAttr callerId; StringAttr localId; - StringAttr globalIdHTTPHeaderName = HPCCSemanticConventions::kGLOBALIDHTTPHeader; - StringAttr callerIdHTTPHeaderName = HPCCSemanticConventions::kCallerIdHTTPHeader; - const char* assignLocalId(); public: @@ -49,16 +45,6 @@ class jlib_decl LogTrace const char* queryGlobalId() const; const char* queryCallerId() const; const char* queryLocalId() const; - const char* queryGlobalIdHTTPHeaderName() const { return globalIdHTTPHeaderName.get(); } - const char* queryCallerIdHTTPHeaderName() const { return callerIdHTTPHeaderName.get(); } - - void setHttpIdHeaderNames(const char *global, const char *caller) - { - if (!isEmptyString(global)) - globalIdHTTPHeaderName.set(global); - if (!isEmptyString(caller)) - callerIdHTTPHeaderName.set(caller); - } //can these be private with abstract methods exposed to create/set these values? void setGlobalId(const char* id); diff --git a/testing/unittests/jlibtests.cpp b/testing/unittests/jlibtests.cpp index a3d30d51058..ff59ee2c637 100644 --- a/testing/unittests/jlibtests.cpp +++ b/testing/unittests/jlibtests.cpp @@ -92,8 +92,8 @@ class JlibTraceTest : public CppUnit::TestFixture } //HPCC specific headers to be propagated - mockHTTPHeaders->setProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader, "IncomingUGID"); - mockHTTPHeaders->setProp(HPCCSemanticConventions::kCallerIdHTTPHeader, "IncomingCID"); + mockHTTPHeaders->setProp(kGlobalIdHttpHeaderName, "IncomingUGID"); + mockHTTPHeaders->setProp(kCallerIdHttpHeaderName, "IncomingCID"); } protected: @@ -123,12 +123,12 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected getSpanContext failure detected", true, getSpanCtxSuccess); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", 0, - strcmp("IncomingUGID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", 0, - strcmp("IncomingCID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kCallerIdHTTPHeader))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", 0, - strcmp("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); + CPPUNIT_ASSERT_MESSAGE("Unexpected GlobalID detected", + strsame("IncomingUGID", retrievedSpanCtxAttributes->queryProp(kGlobalIdHttpHeaderName))); + CPPUNIT_ASSERT_MESSAGE("Unexpected CallerID detected", + strsame("IncomingCID", retrievedSpanCtxAttributes->queryProp(kCallerIdHttpHeaderName))); + CPPUNIT_ASSERT_MESSAGE("Unexpected Declared Parent SpanID detected", + strsame("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected empty TraceID detected", false, isEmptyString(retrievedSpanCtxAttributes->queryProp("traceID"))); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected empty SpanID detected", false, isEmptyString(retrievedSpanCtxAttributes->queryProp("spanID"))); @@ -179,19 +179,19 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected missing localParentSpanID detected", true, retrievedSpanCtxAttributes->hasProp("localParentSpanID")); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Mismatched localParentSpanID detected", 0, - strcmp(serverSpanID, retrievedSpanCtxAttributes->queryProp("localParentSpanID"))); + CPPUNIT_ASSERT_MESSAGE("Mismatched localParentSpanID detected", + strsame(serverSpanID, retrievedSpanCtxAttributes->queryProp("localParentSpanID"))); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected missing remoteParentID detected", true, retrievedSpanCtxAttributes->hasProp("remoteParentID")); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", 0, - strcmp(serverTraceID, retrievedSpanCtxAttributes->queryProp("remoteParentID"))); + CPPUNIT_ASSERT_MESSAGE("Unexpected CallerID detected", + strsame(serverTraceID, retrievedSpanCtxAttributes->queryProp("remoteParentID"))); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", false, - retrievedSpanCtxAttributes->hasProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader)); + retrievedSpanCtxAttributes->hasProp(kGlobalIdHttpHeaderName)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", false, - retrievedSpanCtxAttributes->hasProp(HPCCSemanticConventions::kCallerIdHTTPHeader)); + retrievedSpanCtxAttributes->hasProp(kCallerIdHttpHeaderName)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", false, retrievedSpanCtxAttributes->hasProp("remoteParentSpanID")); @@ -228,16 +228,16 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected missing localParentSpanID detected", true, retrievedSpanCtxAttributes->hasProp("localParentSpanID")); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Mismatched localParentSpanID detected", 0, - strcmp(serverSpanID, retrievedSpanCtxAttributes->queryProp("localParentSpanID"))); + CPPUNIT_ASSERT_MESSAGE("Mismatched localParentSpanID detected", + strsame(serverSpanID, retrievedSpanCtxAttributes->queryProp("localParentSpanID"))); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected remoteParentSpanID detected", false, retrievedSpanCtxAttributes->hasProp("remoteParentSpanID")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", false, - retrievedSpanCtxAttributes->hasProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader)); + retrievedSpanCtxAttributes->hasProp(kGlobalIdHttpHeaderName)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", false, - retrievedSpanCtxAttributes->hasProp(HPCCSemanticConventions::kCallerIdHTTPHeader)); + retrievedSpanCtxAttributes->hasProp(kCallerIdHttpHeaderName)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", false, @@ -275,9 +275,9 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected getSpanContext failure detected", true, getSpanCtxSuccess); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", false, - retrievedSpanCtxAttributes->hasProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader)); + retrievedSpanCtxAttributes->hasProp(kGlobalIdHttpHeaderName)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", false, - retrievedSpanCtxAttributes->hasProp(HPCCSemanticConventions::kCallerIdHTTPHeader)); + retrievedSpanCtxAttributes->hasProp(kCallerIdHttpHeaderName)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", false, retrievedSpanCtxAttributes->hasProp("remoteParentSpanID")); @@ -322,13 +322,13 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected getSpanContext failure detected", true, getSpanCtxSuccess); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", 0, - strcmp("IncomingUGID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", 0, - strcmp("IncomingCID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kCallerIdHTTPHeader))); + CPPUNIT_ASSERT_MESSAGE("Unexpected GlobalID detected", + strsame("IncomingUGID", retrievedSpanCtxAttributes->queryProp(kGlobalIdHttpHeaderName))); + CPPUNIT_ASSERT_MESSAGE("Unexpected CallerID detected", + strsame("IncomingCID", retrievedSpanCtxAttributes->queryProp(kCallerIdHttpHeaderName))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", 0, - strcmp("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); + CPPUNIT_ASSERT_MESSAGE("Unexpected Declared Parent SpanID detected", + strsame("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); } void testMultiNestedSpanTraceOutput() @@ -411,13 +411,13 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected getSpanContext failure detected", true, getSpanCtxSuccess); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", 0, - strcmp("IncomingUGID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", 0, - strcmp("IncomingCID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kCallerIdHTTPHeader))); + CPPUNIT_ASSERT_MESSAGE("Unexpected GlobalID detected", + strsame("IncomingUGID", retrievedSpanCtxAttributes->queryProp(kGlobalIdHttpHeaderName))); + CPPUNIT_ASSERT_MESSAGE("Unexpected CallerID detected", + strsame("IncomingCID", retrievedSpanCtxAttributes->queryProp(kCallerIdHttpHeaderName))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", 0, - strcmp("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); + CPPUNIT_ASSERT_MESSAGE("Unexpected Declared Parent SpanID detected", + strsame("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected empty TraceID detected", false, isEmptyString(retrievedSpanCtxAttributes->queryProp("traceID"))); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected empty SpanID detected", false, isEmptyString(retrievedSpanCtxAttributes->queryProp("spanID"))); @@ -457,13 +457,13 @@ class JlibTraceTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected getSpanContext failure detected", true, getSpanCtxSuccess); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", 0, - strcmp("someGlobalID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kGLOBALIDHTTPHeader))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", 0, - strcmp("IncomingCID", retrievedSpanCtxAttributes->queryProp(HPCCSemanticConventions::kCallerIdHTTPHeader))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", true, + strsame("someGlobalID", retrievedSpanCtxAttributes->queryProp(kGlobalIdHttpHeaderName))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected CallerID detected", true, + strsame("IncomingCID", retrievedSpanCtxAttributes->queryProp(kCallerIdHttpHeaderName))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", 0, - strcmp("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected Declared Parent SpanID detected", true, + strsame("4b960b3e4647da3f", retrievedSpanCtxAttributes->queryProp("remoteParentSpanID"))); } } }; diff --git a/thorlcr/thorutil/thormisc.hpp b/thorlcr/thorutil/thormisc.hpp index 895c325164d..7176e6856d1 100644 --- a/thorlcr/thorutil/thormisc.hpp +++ b/thorlcr/thorutil/thormisc.hpp @@ -616,8 +616,6 @@ class CThorContextLogger : public CSimpleInterfaceOf public: CThorContextLogger(const StatisticsMapping & statsMapping) : stats(statsMapping) { - if (globals->hasProp("@httpGlobalIdHeader")) - setHttpIdHeaderNames(globals->queryProp("@httpGlobalIdHeader"), globals->queryProp("@httpCallerIdHeader")); } virtual void CTXLOG(const char *format, ...) const override __attribute__((format(printf,2,3))) { @@ -681,18 +679,6 @@ class CThorContextLogger : public CSimpleInterfaceOf { return logTrace.queryCallerId(); } - virtual void setHttpIdHeaderNames(const char *global, const char *caller) override - { - logTrace.setHttpIdHeaderNames(global, caller); - } - virtual const char *queryGlobalIdHttpHeaderName() const override - { - return logTrace.queryGlobalIdHTTPHeaderName(); - } - virtual const char *queryCallerIdHttpHeaderName() const override - { - return logTrace.queryCallerIdHTTPHeaderName(); - } virtual const CRuntimeStatisticCollection &queryStats() const override { return stats;