aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
authorJulien Fontaine <julien.fontaine@bell.ca>2020-08-20 17:51:17 -0400
committerKAPIL SINGAL <ks220y@att.com>2020-08-24 17:31:19 +0000
commit0f0b5a02d777482e0011b3bc7276d410ee643ae8 (patch)
tree16ca3faa0271f29e9f4ca883442ce0885c27f507 /ms/blueprintsprocessor/modules
parent400aed4ddd71657b6c81bb6ec95b1fac2ad63e8e (diff)
Add request IDs in command-executor log
* Update gRPC interface to handle SubRequestID and Originator ID * Update command-executor log format to handle request IDs in the log statement * Add SubRequest ID and Originator ID in BP log statement Issue-ID: CCSDK-2687 Change-Id: If261bb0912df5800ed2fc65371c5ee784d6a45fb Signed-off-by: Julien Fontaine <julien.fontaine@bell.ca>
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt9
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt5
4 files changed, 22 insertions, 1 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
index 76662d4ee..8290167cd 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 - 2019 IBM, Bell Canada
+ * Modifications Copyright © 2018 - 2020 IBM, Bell Canada
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,8 @@ object BluePrintConstants {
const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"
const val ONAP_REQUEST_ID = "X-ONAP-RequestID"
+ const val ONAP_SUBREQUEST_ID = "X-ONAP-SubRequestID"
+ const val ONAP_ORIGINATOR_ID = "X-ONAP-OriginatorID"
const val ONAP_INVOCATION_ID = "X-ONAP-InvocationID"
const val ONAP_PARTNER_NAME = "X-ONAP-PartnerName"
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
index 628b65ea4..6baf261fb 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 IBM.
+ * Modifications Copyright © 2020 Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +30,9 @@ data class RemoteIdentifier(
)
data class RemoteScriptExecutionInput(
+ var originatorId: String,
var requestId: String,
+ var subRequestId: String,
var correlationId: String? = null,
var remoteIdentifier: RemoteIdentifier? = null,
var command: String,
@@ -46,7 +49,9 @@ data class RemoteScriptExecutionOutput(
)
data class PrepareRemoteEnvInput(
+ var originatorId: String,
var requestId: String,
+ var subRequestId: String,
var correlationId: String? = null,
var remoteIdentifier: RemoteIdentifier? = null,
var packages: JsonNode,
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
index 846a94a09..dc45e3545 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2018-2019 AT&T Intellectual Property.
+ * Modifications Copyright © 2020 Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,8 +31,10 @@ import kotlinx.coroutines.withContext
import org.apache.http.message.BasicHeader
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_INVOCATION_ID
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_ORIGINATOR_ID
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_PARTNER_NAME
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_REQUEST_ID
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_SUBREQUEST_ID
import org.onap.ccsdk.cds.controllerblueprints.core.MDCContext
import org.onap.ccsdk.cds.controllerblueprints.core.defaultToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.defaultToUUID
@@ -68,10 +71,14 @@ class RestLoggerService {
val localhost = InetAddress.getLocalHost()
val headers = request.headers
val requestID = headers.getFirst(ONAP_REQUEST_ID).defaultToUUID()
+ val subrequestID = headers.getFirst(ONAP_SUBREQUEST_ID).defaultToEmpty()
+ val originatorID = headers.getFirst(ONAP_ORIGINATOR_ID).defaultToEmpty()
val invocationID = headers.getFirst(ONAP_INVOCATION_ID).defaultToUUID()
val partnerName = headers.getFirst(ONAP_PARTNER_NAME).defaultToEmpty()
MDC.put("InvokeTimestamp", ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT))
MDC.put("RequestID", requestID)
+ MDC.put("SubRequestID", subrequestID)
+ MDC.put("OriginatorID", originatorID)
MDC.put("InvocationID", invocationID)
MDC.put("PartnerName", partnerName)
MDC.put("ClientIPAddress", request.remoteAddress?.address?.hostAddress.defaultToEmpty())
@@ -86,6 +93,8 @@ class RestLoggerService {
val reqHeaders = request.headers
val resHeaders = response.headers
resHeaders[ONAP_REQUEST_ID] = MDC.get("RequestID")
+ resHeaders[ONAP_SUBREQUEST_ID] = MDC.get("SubRequestID")
+ resHeaders[ONAP_ORIGINATOR_ID] = MDC.get("OriginatorID")
resHeaders[ONAP_INVOCATION_ID] = MDC.get("InvocationID")
resHeaders[ONAP_PARTNER_NAME] = BluePrintConstants.APP_NAME
} catch (e: Exception) {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
index 861a95507..35f156707 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 IBM.
+ * Modifications Copyright © 2020 Bell Canada.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,6 +130,8 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
return PrepareEnvInput.newBuilder()
.setIdentifiers(this.remoteIdentifier!!.asGrpcData())
.setRequestId(this.requestId)
+ .setSubRequestId(this.subRequestId)
+ .setOriginatorId(this.originatorId)
.setCorrelationId(correlationId)
.setTimeOut(this.timeOut.toInt())
.addAllPackages(packageList)
@@ -140,6 +143,8 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
val correlationId = this.correlationId ?: this.requestId
return ExecutionInput.newBuilder()
.setRequestId(this.requestId)
+ .setSubRequestId(this.subRequestId)
+ .setOriginatorId(this.originatorId)
.setCorrelationId(correlationId)
.setIdentifiers(this.remoteIdentifier!!.asGrpcData())
.setCommand(this.command)