Log query string and variables in the GraphQL AiAction mutation
What does this MR do and why?
This MR follows-up Log GraphQL request with expanded_ai_logging fe... (!175074 - merged) to log GraphQL query string and variables separately. It turned out expanded GraphQL queries could hit Query too large error at the GraphQL controller validation. This is a blocker against duo chat regression evaluator (gitlab-org/modelops/ai-model-validation-and-research/ai-evaluation/prompt-library!918 - merged).
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
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
When expanded_ai_logging is enabled:
{
"severity": "INFO",
"time": "2025-01-02T05:04:39.512Z",
"correlation_id": "01JGJPDH25TQ8R08CRFSDP8SBJ",
"meta.caller_id": "GraphqlController#execute",
"meta.feature_category": "groups_and_projects",
"meta.organization_id": 1,
"meta.remote_ip": "127.0.0.1",
"meta.http_router_rule_action": "classify",
"meta.http_router_rule_type": "SESSION_PREFIX",
"meta.user": "root",
"meta.user_id": 1,
"meta.client_id": "user/1",
"user_id": 1,
"graphql_query_string": "mutation chat($question: String!, $resourceId: AiModelID!, $agentVersionId: AiAgentVersionID, $clientSubscriptionId: String, $projectId: ProjectID, $currentFileContext: AiCurrentFileInput) {\n aiAction(\n input: {chat: {resourceId: $resourceId, content: $question, agentVersionId: $agentVersionId, currentFile: $currentFileContext}, projectId: $projectId, clientSubscriptionId: $clientSubscriptionId}\n ) {\n requestId\n errors\n __typename\n }\n}\n",
"graphql_variables": {
"question": "How do I change my password in GitLab?",
"resourceId": "gid://gitlab/User/1",
"clientSubscriptionId": "86cf6d22-ee71-435a-a2a4-8a4eeec50375",
"projectId": "gid://gitlab/Project/1000000"
},
"message": "Received AiAction mutation GraphQL query",
"class": "Mutations::Ai::Action",
"ai_event_name": "ai_action_mutation",
"ai_component": "abstraction_layer"
}
When expanded_ai_logging is disabled:
{
"severity": "INFO",
"time": "2025-01-02T05:09:47.083Z",
"correlation_id": "01JGJPPXDCKDHJYG2KMV9N12C4",
"meta.caller_id": "GraphqlController#execute",
"meta.feature_category": "groups_and_projects",
"meta.organization_id": 1,
"meta.remote_ip": "127.0.0.1",
"meta.http_router_rule_action": "classify",
"meta.http_router_rule_type": "SESSION_PREFIX",
"meta.user": "root",
"meta.user_id": 1,
"meta.client_id": "user/1",
"message": "Received AiAction mutation GraphQL query",
"class": "Mutations::Ai::Action",
"ai_event_name": "ai_action_mutation",
"ai_component": "abstraction_layer"
}
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.