diff --git a/common/app/common/RequestLogger.scala b/common/app/common/RequestLogger.scala index 05b13800063..c319a982365 100644 --- a/common/app/common/RequestLogger.scala +++ b/common/app/common/RequestLogger.scala @@ -38,7 +38,7 @@ case class RequestLoggerFields(request: RequestHeader, response: Option[Result], (allowListedHeaders ++ guardianSpecificHeaders).toList.map { case (headerName, headerValue) => if (headerName == "x-gu-xid") { - LogFieldString(s"fastlyRequestId", headerValue) + LogFieldString(s"requestId", headerValue) } else { LogFieldString(s"req.header.$headerName", headerValue) } diff --git a/common/app/common/package.scala b/common/app/common/package.scala index 25ab5414522..7781cd36db5 100644 --- a/common/app/common/package.scala +++ b/common/app/common/package.scala @@ -43,9 +43,9 @@ object `package` context: ApplicationContext, log: Logger, ): PartialFunction[Throwable, Result] = { - val fastlyRequestId = request.headers.get("x-gu-xid").getOrElse("fastly-id-not-provided") + val requestId = request.headers.get("x-gu-xid").getOrElse("request-id-not-provided") val customFieldMarker: LogstashMarker = { - append("fastlyRequestId", fastlyRequestId) + append("requestId", requestId) } { case _: CircuitBreakerOpenException => diff --git a/common/app/renderers/DotcomRenderingService.scala b/common/app/renderers/DotcomRenderingService.scala index 96722bffc9f..ec80f08769f 100644 --- a/common/app/renderers/DotcomRenderingService.scala +++ b/common/app/renderers/DotcomRenderingService.scala @@ -59,7 +59,7 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload ws: WSClient, payload: JsValue, endpoint: String, - fastlyRequestId: Option[String], + requestId: Option[String], timeout: Duration = Configuration.rendering.timeout, )(implicit request: RequestHeader): Future[WSResponse] = { @@ -70,7 +70,7 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload .withRequestTimeout(timeout) .addHttpHeaders("Content-Type" -> "application/json") - val resp = fastlyRequestId match { + val resp = requestId match { case Some(id) => request.addHttpHeaders("x-gu-xid" -> id).post(payload) case None => request.post(payload) } @@ -104,7 +104,7 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload cacheTime: CacheTime, timeout: Duration = Configuration.rendering.timeout, )(implicit request: RequestHeader): Future[Result] = { - val fastlyRequestId = request.headers.get("x-gu-xid") + val requestId = request.headers.get("x-gu-xid") def handler(response: WSResponse): Result = { response.status match { case 200 => @@ -140,10 +140,10 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload if (CircuitBreakerDcrSwitch.isSwitchedOn) { circuitBreaker - .withCircuitBreaker(postWithoutHandler(ws, payload, endpoint, fastlyRequestId, timeout)) + .withCircuitBreaker(postWithoutHandler(ws, payload, endpoint, requestId, timeout)) .map(handler) } else { - postWithoutHandler(ws, payload, endpoint, fastlyRequestId, timeout).map(handler) + postWithoutHandler(ws, payload, endpoint, requestId, timeout).map(handler) } } @@ -232,9 +232,9 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload )(implicit request: RequestHeader): Future[String] = { val dataModel = DotcomBlocksRenderingDataModel(page, request, blocks) val json = DotcomBlocksRenderingDataModel.toJson(dataModel) - val fastlyRequestId = request.headers.get("x-gu-xid") + val requestId = request.headers.get("x-gu-xid") - postWithoutHandler(ws, json, Configuration.rendering.articleBaseURL + "/Blocks", fastlyRequestId) + postWithoutHandler(ws, json, Configuration.rendering.articleBaseURL + "/Blocks", requestId) .flatMap(response => { if (response.status == 200) Future.successful(response.body) @@ -254,9 +254,9 @@ class DotcomRenderingService extends GuLogging with ResultWithPreconnectPreload )(implicit request: RequestHeader): Future[String] = { val dataModel = DotcomBlocksRenderingDataModel(page, request, blocks) val json = DotcomBlocksRenderingDataModel.toJson(dataModel) - val fastlyRequestId = request.headers.get("x-gu-xid") + val requestId = request.headers.get("x-gu-xid") - postWithoutHandler(ws, json, Configuration.rendering.articleBaseURL + "/AppsBlocks", fastlyRequestId) + postWithoutHandler(ws, json, Configuration.rendering.articleBaseURL + "/AppsBlocks", requestId) .flatMap(response => { if (response.status == 200) Future.successful(response.body) diff --git a/common/app/utils/DotcomponentsLogger.scala b/common/app/utils/DotcomponentsLogger.scala index 3ade62673a1..5e7dc0b2b53 100644 --- a/common/app/utils/DotcomponentsLogger.scala +++ b/common/app/utils/DotcomponentsLogger.scala @@ -18,7 +18,7 @@ case class DotcomponentsLoggerFields(request: Option[RequestHeader]) { "req.method" -> r.method, "req.url" -> r.uri, "req.id" -> Random.nextInt(Integer.MAX_VALUE).toString, - "fastlyRequestId" -> r.headers.get("x-gu-xid").getOrElse("fastly-id-not-provided"), + "requestId" -> r.headers.get("x-gu-xid").getOrElse("request-id-not-provided"), ) } .getOrElse(Nil)