×

高效地排查基于 HTTP 的函数调用(例如使用 OpenAPI 函数的调用)对于维护工作流编排至关重要。

为了诊断问题,您可以追踪 HTTP 请求和响应。

追踪 HTTP 请求和响应

OpenShift Serverless Logic 使用 Apache HTTP 客户端来追踪 HTTP 请求和响应。

前提条件
  • 您可以访问具有在 OpenShift Container Platform 中创建应用程序和其他工作负载的适当角色和权限的 OpenShift Serverless Logic 项目。

  • 您可以访问 OpenAPI 规范文件。

  • 您可以访问工作流定义和实例 ID 以关联 HTTP 请求和响应。

  • 您可以访问发生 HTTP 服务调用的应用程序的日志配置

步骤
  1. 为了追踪 HTTP 请求和响应,OpenShift Serverless Logic 通过设置以下属性来使用 Apache HTTP 客户端

    # Turning HTTP tracing on
    quarkus.log.category."org.apache.http".level=DEBUG
  2. 将以下配置添加到应用程序的application.properties文件中,以打开 Apache HTTP 客户端的调试功能

    quarkus.log.category."org.apache.http".level=DEBUG
  3. 重新启动应用程序以传播日志配置更改。

  4. 重新启动后,检查日志以查找 HTTP 请求追踪。

    追踪 HTTP 请求的示例日志
    2023-09-25 19:00:55,242 DEBUG Executing request POST /v2/models/yolo-model/infer HTTP/1.1
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> POST /v2/models/yolo-model/infer HTTP/1.1
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> Accept: application/json
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> Content-Type: application/json
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> kogitoprocid: inferencepipeline
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> kogitoprocinstanceid: 85114b2d-9f64-496a-bf1d-d3a0760cde8e
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> kogitoprocist: Active
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> kogitoproctype: SW
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> kogitoprocversion: 1.0
    2023-09-25 19:00:55,243 DEBUG http-outgoing-0 >> Content-Length: 23177723
    2023-09-25 19:00:55,244 DEBUG http-outgoing-0 >> Host: yolo-model-opendatahub-model.apps.trustyai.dzzt.p1.openshiftapps.com
  5. 在请求日志之后检查日志以查找 HTTP 响应追踪。

    追踪 HTTP 响应的示例日志
    2023-09-25 19:01:00,738 DEBUG http-outgoing-0 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
    2023-09-25 19:01:00,738 DEBUG http-outgoing-0 << "content-type: application/json[\r][\n]"
    2023-09-25 19:01:00,738 DEBUG http-outgoing-0 << "date: Mon, 25 Sep 2023 19:01:00 GMT[\r][\n]"
    2023-09-25 19:01:00,738 DEBUG http-outgoing-0 << "content-length: 186[\r][\n]"
    2023-09-25 19:01:00,738 DEBUG http-outgoing-0 << "set-cookie: 276e4597d7fcb3b2cba7b5f037eeacf5=5427fafade21f8e7a4ee1fa6c221cf40; path=/; HttpOnly; Secure; SameSite=None[\r][\n]"
    2023-09-25 19:01:00,738 DEBUG http-outgoing-0 << "[\r][\n]"
    2023-09-25 19:01:00,738 DEBUG http-outgoing-0 << "{"code":13, "message":"Failed to load Model due to adapter error: Error calling stat on model file: stat /models/yolo-model__isvc-1295fd6ba9/yolov5s-seg.onnx: no such file or directory"}"