Skip to content

Send Correlation ID to AI Gateway

Shinya Maeda requested to merge send-correlation-id-to-ai-gateway into master

Important: this is a high priority MR that is required for Supporting GitLab Duo (chat) for SM and Dedicated (&11251 - closed).

What does this MR do and why?

This MR sends Correlation ID to AI Gateway, so that we can trace the request from GitLab-Rails to AI Gateway.

Related to Improve observability of Duo Chat with v1/agent... (gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#371 - closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

  1. Ask a question in Duo Chat. See the correlation ID below:

2023-12-27_14-25

(The correlation ID sent from the client is 01HJMVPNKNKGW1X4D5AD5HZYP6)

  1. Corresponding log in AI Gateway:
{
    "url": "http://localhost:5052/v1/chat/agent",
    "path": "/v1/chat/agent",
    "status_code": 200,
    "method": "POST",
    "correlation_id": "01HJMVPNKNKGW1X4D5AD5HZYP6",
    "http_version": "1.1",
    "client_ip": "127.0.0.1",
    "client_port": 54138,
    "duration_s": 2.697260431000359,
    "cpu_s": 0.011276617000000044,
    "user_agent": "Ruby",
    "gitlab_instance_id": "9e210aee-80e2-4f03-86ce-d4bb0fb46455",
    "gitlab_global_user_id": "bqtER3xdKMEUpFY0uIH0fTzf5a5WqJWNIfBDNsg2Y9E=",
    "gitlab_host_name": "gdk.test",
    "gitlab_saas_namespace_ids": null,
    "gitlab_realm": "saas",
    "meta.feature_category": "duo_chat",
    "logger": "api.access",
    "level": "info",
    "type": "mlops",
    "stage": "main",
    "timestamp": "2023-12-27T05:24:38.953558Z",
    "message": "127.0.0.1:54138 - \"POST /v1/chat/agent HTTP/1.1\" 200"
}

Notice that the same correlation_id is set.

How to set up and validate locally

See !138274 (merged)

Edited by Shinya Maeda

Merge request reports