Log GraphQL request with expanded_ai_logging feature flag

What does this MR do and why?

This MR unblocks duo chat regression evaluator (gitlab-org/modelops/ai-model-validation-and-research/ai-evaluation/prompt-library!918 - merged) that requires expanded GraphQL query when adding an example to the regression dataset.

When expanded_ai_logging feature flag is enabled for a specific user, the incoming GraphQL query is logged in llm.log.

Example log:

{
    "severity": "INFO",
    "time": "2024-12-16T05:28:42.490Z",
    "correlation_id": "01JF6Z1B6MV6G7PKR46WZ14JM6",
    "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": "mutation chat {\n  aiAction(input: {chat: {resourceId: \"gid://gitlab/User/1\", content: \"How do I change my password in GitLab?\", agentVersionId: null, currentFile: null}, projectId: \"gid://gitlab/Project/1000000\", clientSubscriptionId: \"82c0e809-e384-4669-98c6-e867f28286f3\"}) {\n    requestId\n    errors\n    __typename\n  }\n}",
    "message": "Received AiAction mutation GraphQL query",
    "class": "Mutations::Ai::Action",
    "ai_event_name": "ai_action_mutation",
    "ai_component": "abstraction_layer"
}

When the feature flag is disabled:

{"severity":"INFO","time":"2024-12-16T05:31:14.742Z","correlation_id":"01JF6Z5ZVVRKMB7CMB7PEYWFTQ","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"}

Closes Log request parameters to Ai Action GraphQL mut... (#507426 - closed)

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

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Shinya Maeda

Merge request reports

Loading