

# Monitoring and tracking the use of Amazon Q Developer
Monitoring and tracking

Monitoring is an important part of maintaining the reliability, availability, and performance of Amazon Q Developer and your other AWS solutions. AWS provides the following monitoring tools and features to monitor and record Amazon Q Developer activity:
+  *AWS CloudTrail* captures API calls and related events made by or on behalf of your AWS account and delivers the log files to an Amazon Simple Storage Service (Amazon S3) bucket that you specify. You can identify which users and accounts called AWS, the source IP address from which the calls were made, and when the calls occurred. For more information, see [Logging Amazon Q Developer API calls using AWS CloudTrail](logging-using-cloudtrail.md).
+ *Amazon CloudWatch* monitors your AWS resources and the applications you run on AWS in real time. You can collect and track metrics, create customized dashboards, and set alarms that notify you or take actions when a specified metric reaches a threshold that you specify. For example, you can have CloudWatch track the number of times that Amazon Q has been invoked on your account, or the number of daily active users. For more information, see [Monitoring Amazon Q Developer with Amazon CloudWatch](monitoring-cloudwatch.md).

Amazon Q Developer also includes the following features to help you track and record user activity in Amazon Q:
+  *A dashboard* shows you aggregate user activity metrics of Amazon Q Developer Pro subscribers. For more information, see [Viewing Amazon Q Developer user activity on the dashboard](dashboard.md).
+  *User activity reports* show you what individual users are up to in Amazon Q. For more information, see [Viewing the activity of specific users in Amazon Q Developer](q-admin-user-telemetry.md).
+  *Prompt logs* provide you with a record of all the prompts that users enter into the Amazon Q chat in their integrated development environment (IDE). For more information, see [Logging users' prompts in Amazon Q Developer](q-admin-prompt-logging.md).

# Logging Amazon Q Developer API calls using AWS CloudTrail
With AWS CloudTrail

Amazon Q Developer Pro is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Amazon Q. CloudTrail captures all API calls for Amazon Q as events. The calls captured include calls from the Amazon Q console and code calls to the Amazon Q API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Amazon Q. If you don’t configure a trail, you can still view the most recent events in the CloudTrail console in **Event history**. Using the information collected by CloudTrail, you can determine the request that was made to Amazon Q, the IP address from which the request was made, who made the request, when it was made, and additional details.

For more information about CloudTrail, see the [AWS CloudTrail User Guide](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/).

## Amazon Q Developer information in CloudTrail


CloudTrail is enabled on your AWS account when you create the account. When activity occurs in Amazon Q Developer, that activity is recorded in a CloudTrail event along with other AWS service events in **Event history**. You can view, search, and download recent events in your AWS account. For more information, see [Viewing Events with CloudTrail Event History](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html) in the *AWS CloudTrail User Guide*.

For an ongoing record of events in your AWS account, including events for Amazon Q, create a trail. A *trail* enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following topics in the *AWS CloudTrail User Guide*:
+  [Overview for creating a trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html) 
+  [CloudTrail supported services and integrations](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-aws-service-specific-topics.html#cloudtrail-aws-service-specific-topics-integrations) 
+  [Configuring Amazon SNS notifications for CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/getting_notifications_top_level.html) 
+  [Receiving CloudTrail log files from multiple Regions](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/receive-cloudtrail-log-files-from-multiple-regions.html) 
+  [Receiving CloudTrail log files from multiple accounts](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-receive-logs-from-multiple-accounts.html) 

All Amazon Q Developer actions are logged by CloudTrail and generate entries in the CloudTrail log files.

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:
+ Whether the request was made with root or AWS Identity and Access Management (IAM) user credentials
+ Whether the request was made with temporary security credentials for a role or federated user
+ Whether the request was made by another AWS service

For more information, see [CloudTrail userIdentity element](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html) in the *AWS CloudTrail User Guide*.

## Understanding Amazon Q Developer log file entries


A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files aren’t an ordered stack trace of the public API calls, so they don’t appear in any specific order.

Amazon Q Developer also makes API calls with a `dryRun` parameter to verify that you have the necessary permissions for the action, without actually making the request. Calls to Amazon Q Developer APIs with the `dryRun` parameter are captured as events and recorded in a CloudTrail log with `"dryRun" : true` in the `requestParameters` field.

The following example shows a CloudTrail log entry that demonstrates the `SendMessage` action.

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "AROAXD12ABCDEF3G4HI5J:aws-user",
        "arn": "arn:aws:sts::123456789012:assumed-role/PowerUser/aws-user",
        "accountId": "123456789012",
        "accessKeyId": "ASIAAB12CDEFG34HIJK",
        "sessionContext": {
            "sessionIssuer": {
                "type": "Role",
                "principalId": "AROAXD12ABCDEF3G4HI5J",
                "arn": "arn:aws:iam::123456789012:role/PowerUser",
                "accountId": "123456789012",
                "userName": "PowerUser"
            },
            "webIdFederationData": {},
            "attributes": {
                "creationDate": "2023-11-28T10:00:00Z",
                "mfaAuthenticated": "false"
            }
        }
    },
    "eventTime": "2023-11-28T10:00:00Z",
    "eventSource": "q.amazonaws.com",
    "eventName": "SendMessage",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "123.456.789.012",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0",
    "requestParameters": {
        "Origin": "https://conversational-experience-worker.widget.console.aws.amazon.com",
        "conversationId": "a298ec0d-0a49-4d2e-92bd-7d6e629b4619",
        "source": "CONSOLE",
        "conversationToken": "***",
        "utterance": "***"
    },
    "responseElements": {
        "result": {
            "content": {
                "text": {
                    "body": "***",
                    "references": []
                }
            },
            "format": "PLAINTEXT",
            "intents": {},
            "type": "TEXT"
        },
        "Access-Control-Expose-Headers": "x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date",
        "metadata": {
            "conversationExpirationTime": "2024-02-25T19:31:38Z",
            "conversationId": "a298ec0d-0a49-4d2e-92bd-7d6e629b4619",
            "conversationToken": "***",
            "utteranceId": "3b87b46f-04a9-41ef-b8fe-8abf52d2c053"
        },
        "resultCode": "LLM"
    },
    "additionalEventData": {
        "quickAction": "dev"
    },
    "requestID": "19b3c30e-906e-4b7f-b5c3-509f67248655",
    "eventID": "a552c487-7d97-403a-8ec4-d49539c7a03d",
    "readOnly": false,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "123456789012",
    "eventCategory": "Management"
}
```

The following example shows a CloudTrail log entry that demonstrates the `PassRequest` action.

```
{
    "eventVersion": "1.09",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "AIDA6ON6E4XEGIEXAMPLE",
        "arn": "arn:aws:iam::555555555555:user/Mary",
        "accountId": "555555555555",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "sessionContext": {
            "sessionIssuer": {
            "type": "Role",
            "principalId": "AIDA6ON6E4XEGIEXAMPLE",
            "arn": "arn:aws:iam::555555555555:user/Mary",
            "accountId": "555555555555",
            "userName": "Mary"
    
        },
        "attributes": {
            "creationDate": "2024-04-10T20:03:01Z",
            "mfaAuthenticated": "false"
        },
        "invokedBy": "q.amazonaws.com"
    },
    "eventTime": "2024-04-10T20:04:42Z",
    "eventSource": "q.amazonaws.com",
    "eventName": "PassRequest",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "q.amazonaws.com",
    "userAgent": "q.amazonaws.com",
    "requestParameters": null,
    "responseElements": null,
    "requestID": "2d528c76-329e-410b-9516-EXAMPLE565dc",
    "eventID": "ba0801a1-87ec-4d26-be87-EXAMPLE75bbb",
    "readOnly": false,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "555555555555",
    "eventCategory": "Management"
}
```

The following example shows a CloudTrail log entry that demonstrates Amazon Q calling the `s3:ListBuckets` action on your behalf.

```
{
    "eventVersion": "1.09",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "AIDA6ON6E4XEGIEXAMPLE",
        "arn": "arn:aws:iam::555555555555:user/Paulo",
        "accountId": "555555555555",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "sessionContext": {
            "sessionIssuer": {
                "type": "Role",
                "principalId": "AIDA6ON6E4XEGIEXAMPLE",
                "arn": "arn:aws:iam::555555555555:user/Paulo",
                "accountId": "555555555555",
                "userName": "Paulo"
            },
            "attributes": {
                "creationDate": "2024-04-10T14:06:08Z",
                "mfaAuthenticated": "false"
            }
        },
        "invokedBy": "q.amazonaws.com"
    },
    "eventTime": "2024-04-10T14:07:55Z",
    "eventSource": "s3.amazonaws.com",
    "eventName": "ListBuckets",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "q.amazonaws.com",
    "userAgent": "q.amazonaws.com",
    "requestParameters": {
        "Host": "s3.amazonaws.com"
    },
    "responseElements": null,
    "additionalEventData": {
        "SignatureVersion": "SigV4",
        "CipherSuite": "ECDHE-RSA-AES128-GCM-SHA256",
        "bytesTransferredIn": 0,
        "AuthenticationMethod": "AuthHeader",
        "x-amz-id-2": "ExampleRequestId123456789",
        "bytesTransferredOut": 4054
    },
    "requestID": "ecd94349-b36f-44bf-b6f5-EXAMPLE9c463",
    "eventID": "2939ba50-1d26-4a5a-83bd-EXAMPLE85850",
    "readOnly": true,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "555555555555",
    "vpcEndpointId": "vpce-EXAMPLE1234",
    "eventCategory": "Management"
}
```

# Monitoring Amazon Q Developer with Amazon CloudWatch
With CloudWatch

**Note**  
The metrics discussed here only pertain to using [Amazon Q in your IDE](q-in-IDE.md).

You can monitor Amazon Q Developer using CloudWatch, which collects raw data and processes it into readable, near real-time metrics. These statistics are kept for 15 months, so that you can access historical information and gain a better perspective on how Amazon Q is performing. You can also set alarms that watch for certain thresholds, and send notifications or take actions when those thresholds are met. For more information, see the [Amazon CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/).

The Amazon Q Developer service reports the following metrics in the `AWS/Q` namespace.


| Dimensions | Metric | Use case or explanation | 
| --- | --- | --- | 
|  Count  |  Invocations  |  You want to determine how many invocations have been counted over time.  | 
|  UserCount  |  DailyActiveUserTrend  |  You want to determine the number of active users per day.  | 
|  SubscriptionUserCount  |  SubscriptionCount  |  You want to determine the number of users with paying subscriptions.  | 
|  UniqueUserCount  |  MonthlyActiveUniqueUsers  |  You want to determine the number of users who are active in a given month.  | 
|  ProgrammingLanguage, SuggestionState, CompletionType  |  GeneratedLineCount  |  You want to determine the number of lines generated by Amazon Q Developer.  | 
|  ProgrammingLanguage, SuggestionState, CompletionType  |  SuggestionReferenceCount  |  You want to determine the number of recommendation triggers with references that have taken place.  | 
|  ProgrammingLanguage  |  CodeScanCount  |  You want to determine the number of code scans that have taken place.  | 
|  ProgrammingLanguage  |  TotalCharacterCount  |  The number of characters in your file, including all suggestions from Amazon Q Developer.  | 
|  ProgrammingLanguage  |  CodeWhispererCharacterCount  |  The number of characters generated by Amazon Q Developer.  | 

To aggregate Invocations, use the Sum statistic.

To aggregate DailyActiveUserTrend, use the Sum statistic, and use "1 Day" as the period.

To aggregate SubscriptionCount, use the Sum statistic.

To aggregate MonthlyActiveUniqueUsers use the Sum statistic, and use "30 Days" as the period.

# Identifying actions by specific users with Amazon CloudWatch Logs
Identifying actions by specific users

It's possible to get user-level metrics on your Amazon Q Developer usage. To figure out which user has taken a particular action, look for the events called SendTelemetryEvent, and examine the JSON object of type SendTelemetryEventRequest that they contain. Within that object, the schema appears as follows.

**Tip**  
You can also output individual users' activity in Amazon Q Developer to a report in CSV format. For more information, see [Viewing the activity of specific users in Amazon Q Developer](q-admin-user-telemetry.md).

```
http://json-schema.org/draft-07/schema#",
    "definitions": {
        "ProgrammingLanguage": {
            "type": "object",
            "properties": {
                "languageName": {
                    "type": "string",
                    "enum": [
                        "python",
                        "javascript",
                        "java",
                        "csharp",
                        "typescript",
                        "c",
                        "cpp",
                        "go",
                        "kotlin",
                        "php",
                        "ruby",
                        "rust",
                        "scala",
                        "shell",
                        "sql",
                        "json",
                        "yaml",
                        "vue",
                        "tf",
                        "tsx",
                        "jsx",
                        "plaintext"
                    ],
                    "description": "Programming Languages supported by Q"
                }
            }
        },
        "Dimension": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "must match ^[-a-zA-Z0-9._]*$ and be between 1 and 255 characters"
                },
                "value": {
                    "type": "string",
                    "description": "must match ^[-a-zA-Z0-9._]*$ and be between 1 and 1024 characters"
                }
            }
        }
    },
    "telemetryEvents": {
        "UserTriggerDecisionEvent": {
            "type": "object",
            "properties": {
                "sessionId": {
                    "type": "string",
                    "description": "UUID for the session"
                },
                "requestId": {
                    "type": "string",
                    "description": "UUID for the request"
                },
                "customizationArn": {
                    "type": "string",
                    "description": "ARN of the customization matching pattern: ^arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}$"
                },
                "programmingLanguage": {
                    "$ref": "#/definitions/ProgrammingLanguage"
                },
                "completionType": {
                    "type": "string",
                    "enum": [
                        "BLOCK",
                        "LINE"
                    ]
                },
                "suggestionState": {
                    "type": "string",
                    "enum": [
                        "ACCEPT",
                        "REJECT",
                        "DISCARD",
                        "EMPTY"
                    ]
                },
                "recommendationLatencyMilliseconds": {
                    "type": "number"
                },
                "timestamp": {
                    "type": "string",
                    "description": "datetime, example: Jul 23, 2024, 12:11:02 AM"
                },
                "triggerToResponseLatencyMilliseconds": {
                    "type": "number"
                },
                "suggestionReferenceCount": {
                    "type": "integer"
                },
                "generatedLine": {
                    "type": "integer"
                },
                "numberOfRecommendations": {
                    "type": "integer"
                }
            },
            "required": [
                "sessionId",
                "requestId",
                "programmingLanguage",
                "completionType",
                "suggestionState",
                "recommendationLatencyMilliseconds",
                "timestamp"
            ]
        },
        "CodeCoverageEvent": {
            "type": "object",
            "properties": {
                "customizationArn": {
                    "type": "string",
                    "description": "ARN of the customization matching pattern: ^arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}$"
                },
                "programmingLanguage": {
                    "$ref": "#/definitions/ProgrammingLanguage"
                },
                "acceptedCharacterCount": {
                    "type": "integer"
                },
                "totalCharacterCount": {
                    "type": "integer"
                },
                "timestamp": {
                    "type": "string",
                    "description": "datetime, example: Jul 23, 2024, 12:11:02 AM"
                },
                "unmodifiedAcceptedCharacterCount": {
                    "type": "integer"
                }
            },
            "required": [
                "programmingLanguage",
                "acceptedCharacterCount",
                "totalCharacterCount",
                "timestamp"
            ]
        },
        "UserModificationEvent": {
            "type": "object",
            "properties": {
                "sessionId": {
                    "type": "string",
                    "description": "UUID for the session"
                },
                "requestId": {
                    "type": "string",
                    "description": "UUID for the request"
                },
                "programmingLanguage": {
                    "$ref": "#/definitions/ProgrammingLanguage"
                },
                "modificationPercentage": {
                    "type": "number",
                    "description": "This is the percentage of AI generated code which has been modified by the user"
                },
                "customizationArn": {
                    "type": "string",
                    "description": "ARN of the customization matching pattern: ^arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}$"
                },
                "timestamp": {
                    "type": "string",
                    "description": "datetime, example: Jul 23, 2024, 12:11:02 AM"
                }
            },
            "required": [
                "sessionId",
                "requestId",
                "programmingLanguage",
                "modificationPercentage",
                "timestamp"
            ]
        },
        "CodeScanEvent": {
            "type": "object",
            "properties": {
                "programmingLanguage": {
                    "$ref": "#/definitions/ProgrammingLanguage"
                },
                "codeScanJobId": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string",
                    "description": "datetime, example: Jul 23, 2024, 12:11:02 AM"
                },
                "codeAnalysisScope": {
                    "type": "string",
                    "enum": [
                        "FILE",
                        "PROJECT"
                    ]
                }
            },
            "required": [
                "programmingLanguage",
                "codeScanJobId",
                "timestamp"
            ]
        },
        "CodeScanRemediationsEvent": {
            "type": "object",
            "properties": {
                "programmingLanguage": {
                    "$ref": "#/definitions/ProgrammingLanguage"
                },
                "CodeScanRemediationsEventType": {
                    "type": "string",
                    "enum": [
                        "CODESCAN_ISSUE_HOVER",
                        "CODESCAN_ISSUE_APPLY_FIX",
                        "CODESCAN_ISSUE_VIEW_DETAILS"
                    ]
                },
                "timestamp": {
                    "type": "string",
                    "description": "datetime, example: Jul 23, 2024, 12:11:02 AM"
                },
                "detectorId": {
                    "type": "string"
                },
                "findingId": {
                    "type": "string"
                },
                "ruleId": {
                    "type": "string"
                },
                "component": {
                    "type": "string"
                },
                "reason": {
                    "type": "string"
                },
                "result": {
                    "type": "string"
                },
                "includesFix": {
                    "type": "boolean"
                }
            }
        },
        "MetricData": {
            "type": "object",
            "properties": {
                "metricName": {
                    "type": "string",
                    "description": "must match pattern ^[-a-zA-Z0-9._]*$ and be between 1 and 1024 characters"
                },
                "metricValue": {
                    "type": "number"
                },
                "timestamp": {
                    "type": "string",
                    "description": "datetime, example: Jul 23, 2024, 12:11:02 AM"
                },
                "product": {
                    "type": "string",
                    "description": "must match pattern ^[-a-zA-Z0-9._]*$ and be between 1 and 128 characters"
                },
                "dimensions": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/Dimension"
                    },
                    "description": "maximum size of 30"
                }
            },
            "required": [
                "metricName",
                "metricValue",
                "timestamp",
                "product"
            ]
        },
        "ChatAddMessageEvent": {
            "type": "object",
            "properties": {
                "conversationId": {
                    "type": "string",
                    "description": "ID which represents a multi-turn conversation, length between 1 and 128"
                },
                "messageId": {
                    "type": "string",
                    "description": "Unique identifier for the chat message"
                },
                "customizationArn": {
                    "type": "string",
                    "description": "ARN of the customization matching pattern: ^arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}$"
                },
                "userIntent": {
                    "type": "string",
                    "enum": [
                        "SUGGEST_ALTERNATE_IMPLEMENTATION",
                        "APPLY_COMMON_BEST_PRACTICES",
                        "IMPROVE_CODE",
                        "SHOW_EXAMPLES",
                        "CITE_SOURCES",
                        "EXPLAIN_LINE_BY_LINE",
                        "EXPLAIN_CODE_SELECTION",
                        "GENERATE_CLOUDFORMATION_TEMPLATE"
                    ]
                },
                "hasCodeSnippet": {
                    "type": "boolean"
                },
                "programmingLanguage": {
                    "$ref": "#/definitions/ProgrammingLanguage"
                },
                "activeEditorTotalCharacters": {
                    "type": "integer"
                },
                "timeToFirstChunkMilliseconds": {
                    "type": "number"
                },
                "timeBetweenChunks": {
                    "type": "array",
                    "items": {
                        "type": "number"
                    },
                    "description": "maximum size of 100"
                },
                "fullResponselatency": {
                    "type": "number"
                },
                "requestLength": {
                    "type": "integer"
                },
                "responseLength": {
                    "type": "integer"
                },
                "numberOfCodeBlocks": {
                    "type": "integer"
                },
                "hasProjectLevelContext": {
                    "type": "boolean"
                }
            },
            "required": [
                "conversationId",
                "messageId"
            ]
        },
        "ChatInteractWithMessageEvent": {
            "type": "object",
            "properties": {
                "conversationId": {
                    "type": "string",
                    "description": "ID which represents a multi-turn conversation, length between 1 and 128"
                },
                "messageId": {
                    "type": "string",
                    "description": "Unique identifier for the chat message"
                },
                "customizationArn": {
                    "type": "string",
                    "description": "ARN of the customization matching pattern: ^arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}$"
                },
                "interactionType": {
                    "type": "string",
                    "enum": [
                        "INSERT_AT_CURSOR",
                        "COPY_SNIPPET",
                        "COPY",
                        "CLICK_LINK",
                        "CLICK_BODY_LINK",
                        "CLICK_FOLLOW_UP",
                        "HOVER_REFERENCE",
                        "UPVOTE",
                        "DOWNVOTE"
                    ],
                    "description": "Chat Message Interaction Type"
                },
                "interactionTarget": {
                    "type": "string",
                    "description": "Target of message interaction"
                },
                "acceptedCharacterCount": {
                    "type": "integer"
                },
                "acceptedLineCount": {
                    "type": "integer"
                },
                "acceptedSnippetHasReference": {
                    "type": "boolean"
                },
                "hasProjectLevelContext": {
                    "type": "boolean"
                }
            },
            "required": [
                "conversationId",
                "messageId"
            ]
        },
        "ChatUserModificationEvent": {
            "type": "object",
            "properties": {
                "conversationId": {
                    "type": "string",
                    "description": "ID which represents a multi-turn conversation, length between 1 and 128"
                },
                "customizationArn": {
                    "type": "string",
                    "description": "ARN of the customization matching pattern: ^arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}$"
                },
                "messageId": {
                    "type": "string",
                    "description": "Unique identifier for the chat message"
                },
                "programmingLanguage": {
                    "$ref": "#/definitions/ProgrammingLanguage"
                },
                "modificationPercentage": {
                    "type": "number",
                    "description": "This is the percentage of AI generated code which has been modified by the user"
                },
                "hasProjectLevelContext": {
                    "type": "boolean"
                }
            },
            "required": [
                "conversationId",
                "messageId",
                "modificationPercentage"
            ]
        },
        "SuggestionState": {
            "type": "string",
            "enum": [
                "ACCEPT",
                "REJECT",
                "DISCARD",
                "EMPTY"
            ]
        },
        "TerminalUserInteractionEvent": {
            "type": "object",
            "properties": {
                "terminalUserInteractionEventType": {
                    "type": "string",
                    "enum": [
                        "CODEWHISPERER_TERMINAL_TRANSLATION_ACTION",
                        "CODEWHISPERER_TERMINAL_COMPLETION_INSERTED"
                    ],
                    "description": "Terminal User Interaction Event Type"
                },
                "terminal": {
                    "type": "string"
                },
                "terminalVersion": {
                    "type": "string"
                },
                "shell": {
                    "type": "string"
                },
                "shellVersion": {
                    "type": "string"
                },
                "duration": {
                    "type": "integer"
                },
                "timeToSuggestion": {
                    "type": "integer"
                },
                "isCompletionAccepted": {
                    "type": "boolean"
                },
                "cliToolCommand": {
                    "type": "string"
                }
            }
        },
        "FeatureDevEvent": {
            "type": "object",
            "properties": {
                "conversationId": {
                    "type": "string",
                    "description": "ID which represents a multi-turn conversation, length between 1 and 128"
                }
            },
            "required": [
                "conversationId"
            ]
        }
    },
    "SendTelemetryEventRequest": {
        "type": "object",
        "properties": {
            "clientToken": {
                "type": "string",
                "description": "The client's authentication token"
            },
            "telemetryEvent": {
                "properties": {
                    "oneOf": [
                        {
                            "_comment": "This event is emitted when a user accepts or rejects an inline code suggestion",
                            "$ref": "#/definitions/userTriggerDecisionEvent"
                        },
                        {
                            "_comment": "This event is emitted every five minutes. It details how much code is written by inline code suggestion and in total during that period",
                            "$ref": "#/definitions/codeCoverageEvent"
                        },
                        {
                            "_comment": "This event is emitted when a code snippet from inline code suggestion has been edited by a user. It details the percentage of that code snippet modified by the user",
                            "$ref": "#/definitions/userModificationEvent"
                        },
                        {
                            "_comment": "This field is emitted when a security scan is requested by a user",
                            "$ref": "#/definitions/codeScanEvent"
                        },
                        {
                            "_comment": "This field is emitted when a security scan recommended remediation is accepted by a user",
                            "$ref": "#/definitions/codeScanRemediationsEvent"
                        },
                        {
                            "_comment": "This event is deprecated but may still occur in telemetry. Do not use this.",
                            "$ref": "#/definitions/metricData"
                        },
                        {
                            "_comment": "This event is emitted when Q adds an AI generated message to the chat window",
                            "$ref": "#/definitions/chatAddMessageEvent"
                        },
                        {
                            "_comment": "This event is emitted when a user interacts with a chat message",
                            "$ref": "#/definitions/chatInteractWithMessageEvent"
                        },
                        {
                            "_comment": "This event is emitted when a user modifies a code snippet sourced from chat. It gives a percentage of the code snippet which has been modified",
                            "$ref": "#/definitions/chatUserModificationEvent"
                        },
                        {
                            "_comment": "This event is emitted when a user interacts with a terminal suggestion",
                            "$ref": "#/definitions/terminalUserInteractionEvent"
                        },
                        {
                            "_comment": "This event is emitted when a user first prompts the /dev feature.",
                            "$ref": "#/definitions/featureDevEvent"
                        }
                    ]
                }
            },
            "optOutPreference": {
                "type": "string",
                "enum": [
                    "OPTIN",
                    "OPTOUT"
                ],
                "description": "OPTOUT and telemetry is only provided to the account of purchasing enterprise, OPTIN and telemetry may also be used for product improvement"
            },
            "userContext": {
                "type": "object",
                "properties": {
                    "ideCategory": {
                        "type": "string",
                        "enum": [
                            "JETBRAINS",
                            "VSCODE",
                            "CLI",
                            "JUPYTER_MD",
                            "JUPYTER_SM"
                        ]
                    },
                    "operatingSystem": {
                        "type": "string",
                        "description": "The operating system being used"
                    },
                    "product": {
                        "type": "string",
                        "description": "The name of the product being used"
                    },
                    "clientId": {
                        "type": "string",
                        "description": "A UUID representing the individual client being used"
                    },
                    "ideVersion": {
                        "type": "string",
                        "description": "The version of the Q plugin"
                    }
                },
                "required": [
                    "ideCategory",
                    "operatingSystem",
                    "product",
                    "clientId",
                    "ideVersion"
                ]
            },
            "profileArn": {
                "type": "string",
                "description": "The arn of the Q Profile used to configure individual user accounts."
```

Observe that a SendTelemetryEvent may contain one of a number of telemetry events. Each of these describes a specific interaction between the development environment.

A more detailed description of each event appears below.

## UserTriggerDecisionEvent
UserTriggerDecisionEvent

This event is triggered when a user interacts with a suggestion made by Amazon Q. It captures whether the suggestion was accepted, rejected, or modified, along with relevant metadata.
+ `completionType`: Whether the completion was a block or a line.
+ `suggestionState`: Whether the user accepted, rejected, or discarded the suggestion.

## CodeScanEvent
CodeScanEvent

This event is logged when a code scan is performed. It helps track the scope and result of the scan, providing insights into security and code quality checks.
+ `codeScanJobId`: The unique identifier for the code scan job.
+ `codeAnalysisScope`: Whether the scan was performed at the file level or the project level.
+ `programmingLanguage`: The language being scanned.

## CodeScanRemediationsEvent
CodeScanRemediationsEvent

This event captures user interactions with Amazon Q’s remediation suggestions, such as applying fixes or viewing issue details.
+ `CodeScanRemediationsEventType`: The type of remediation action taken (e.g., viewing details or applying a fix).
+ `includesFix`: A boolean indicating whether the code issue includes a suggested fix.

## ChatAddMessageEvent
ChatAddMessageEvent

This event is triggered when a new message is added to an ongoing chat conversation. It captures the user’s intent and any code snippets involved.
+ `conversationId`: The unique identifier for the conversation.
+ `messageId`: The unique identifier for the chat message.
+ `userIntent`: The user’s intent, such as improving code or explaining code.
+ `programmingLanguage`: The language related to the chat message.

## ChatInteractWithMessageEvent
ChatInteractWithMessageEvent

This event captures when users interact with chat messages, such as copying code snippets, clicking links, or hovering over references.
+ `interactionType`: The type of interaction (for example, copy, hover, click).
+ `interactionTarget`: The target of the interaction (for example, a code snippet or a link).
+ `acceptedCharacterCount`: The number of characters from the message that were accepted.
+ `acceptedSnippetHasReference`: A boolean indicating if the accepted snippet included a reference.

## TerminalUserInteractionEvent
TerminalUserInteractionEvent

This event logs user interactions with terminal commands or completions in the terminal environment.
+ `terminalUserInteractionEventType`: The type of interaction (for example, terminal translation or code completion).
+ `isCompletionAccepted`: A boolean indicating whether the completion was accepted by the user.
+ `duration`: The time taken for the interaction.

# Accessing customization-related messages in Amazon CloudWatch Logs
Accessing customization-related logs

You can store information about the creation of your customizations in [Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html).

You can authorize your Amazon Q Developer administrator to view those logs with the following permission set.

To learn more about the permissions required to delivery logs to multiple resources, see [Logging that requires additional permissions [V2]](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-vended-logs-permissions-V2) in the *Amazon CloudWatch Logs User Guide*.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowLogDeliveryActions",
            "Effect": "Allow",
            "Action": [
                "logs:PutDeliverySource",
                "logs:GetDeliverySource",
                "logs:DeleteDeliverySource",
                "logs:DescribeDeliverySources",
                "logs:PutDeliveryDestination",
                "logs:GetDeliveryDestination",
                "logs:DeleteDeliveryDestination",
                "logs:DescribeDeliveryDestinations",
                "logs:CreateDelivery",
                "logs:GetDelivery",
                "logs:DeleteDelivery",
                "logs:DescribeDeliveries",
                "firehose:ListDeliveryStreams",
                "firehose:DescribeDeliveryStream",
                "s3:ListAllMyBuckets",
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Resource": [
                "arn:aws:logs:us-east-1:111122223333:log-group:*",
                "arn:aws:firehose:us-east-1:111122223333:deliverystream/*",
                "arn:aws:s3:::*"
            ]
        }
    ]
}
```

------

# Viewing Amazon Q Developer user activity on the dashboard
Viewing usage metrics (dashboard)

Available only for Amazon Q Developer administrators, the Amazon Q Developer dashboard summarizes useful data about how your Pro tier subscribers use the service.

![\[The Amazon Q dashboard that shows total subscriptions, active subscriptions, pending subscriptions, a suggested lines of code widget, an active users widget, and filters.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/q-dev-dashboard.png)


Amazon Q generates and displays new metrics on an hourly basis for the most part. The only section that is not updated hourly is the **Active users** widget, which is updated daily according to the coordinated universal time (UTC) clock.

The dashboard shows metrics collected from users who are subscribed in:
+ the AWS account that you're currently signed into

  *and*
+ member accounts, if you're signed in to a management account for which [organization-wide visibility of subscriptions](subscribe-visibility.md) has been enabled.
**Note**  
The **Active users** widget only displays information from the account that you're currently signed into.

**To view and filter the dashboard**

1. Sign in to the AWS Management Console.

1. Switch to the Amazon Q Developer console.

1. From the navigation pane, choose **Dashboard**.

1. (Optional) Filter the information by date range, programming language, customization, or integrated development environment (IDE) vendor.

**Notes**:
+ If the **Dashboard** link is not available in the navigation pane, see [Troubleshooting the dashboard](dashboard-troubleshooting.md).
+ If you’d like to send user metrics to a daily report with a per-user breakdown of their Amazon Q Developer usage, see [Viewing the activity of specific users in Amazon Q Developer](q-admin-user-telemetry.md).
+ For information about specific metrics, see [Descriptions of Amazon Q Developer dashboard usage metrics](dashboard-metrics-descriptions.md) or choose the help link (![\[The help link.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/help-icon.png)) at the top-right of the dashboard page.

# Descriptions of Amazon Q Developer dashboard usage metrics
Dashboard metrics

The following table describes the metrics shown in the Amazon Q Developer dashboard.

For more information about the dashboard, see [Viewing Amazon Q Developer user activity on the dashboard](dashboard.md).


| Metric name | Description | 
| --- | --- | 
|  **Total subscriptions**  |  Shows the total subscriptions in the current AWS account, as well as subscriptions in member accounts, if you're signed in to a management account for which [organization-wide visibility of subscriptions](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/subscribe-visibility.html) has been enabled.  | 
|  **Active subscriptions**  |  Shows the total active subscriptions in the current AWS account, as well as subscriptions in member accounts, if you're signed in to a management account for which [organization-wide visibility of subscriptions](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/subscribe-visibility.html) has been enabled. *Active subscriptions* are those belonging to users who have started using Amazon Q in their integrated development environment (IDE). You are being charged for these subscriptions. For more information about active subscriptions, see [Amazon Q Developer subscription statuses](q-admin-setup-subscribe-status.md).  | 
|  **Pending subscriptions**  |  Shows the total pending subscriptions in the current AWS account, as well as subscriptions in member accounts, if you're signed in to a management account for which [organization-wide visibility of subscriptions](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/subscribe-visibility.html) has been enabled. *Pending subscriptions* are those belonging to users who have not yet started using Amazon Q in their IDE. You are not being charged for these subscriptions. For more information about pending subscriptions, see [Amazon Q Developer subscription statuses](q-admin-setup-subscribe-status.md).  | 
|  **Accepted lines of code**  |  Shows a pie chart that indicates the lines of code accepted by users, broken down by Amazon Q feature (feature development, documentation generation, unit test generation, and so on).   | 
|  **Active users**  |  Shows a line graph that indicates the number of subscribers who were actively using Amazon Q in the IDE during a specified date range.  | 
|  **Inline suggestions**  |  Shows the total number of suggestions and accepted suggestions for the [inline suggestions](inline-suggestions.md) feature. The percentage of accepted suggestions is calculated by taking the number of suggestions accepted by users, and dividing it by the total suggestions generated by Amazon Q. The total suggestions count includes suggestions that were accepted and actively rejected; it does not include suggestions that were dismissed because the user continued to type or started performing other operations in their IDE.  | 
|  **Inline chat**  |  Shows the total number of suggestions and number of accepted suggestions for the [inline chat](q-in-IDE-inline-chat.md) feature. The percentage of accepted suggestions is calculated by taking the number of suggestions accepted by users, and dividing it by the total suggestions generated by Amazon Q.  | 
|  **Chat in the IDE** – **Total messages sent**  |  Shows the total number of responses from Amazon Q in the [Amazon Q chat](q-in-IDE-chat.md) window of the user's IDE.  | 
|  **Feature development** – **Acceptance rate**  |  Shows the acceptance rate for the [Feature development](q-in-IDE-chat.md#develop-code) feature. The acceptance rate is calculated by taking the number of lines of code accepted by users, and dividing it by the total lines of code suggested by Amazon Q.  | 
|  **Document generation**  |  Shows the total number of documentation files (such as READMEs and supporting files) created and updated by the [Document generation](q-in-IDE-chat.md#doc-generation) feature. The acceptance rates equal the number of file updates or creations accepted by users, divided by the total number of files updates or creations suggested by Amazon Q.  | 
|  **Unit test generation**  |  Shows the total number of unit tests generated by the [Unit test generation](q-in-IDE-chat.md#unit-tests) feature and the number of unit tests accepted by users. The acceptance rate is calculated by taking the number of unit tests accepted by users, and dividing it by the total number of unit tests generated by Amazon Q.  | 
|  **Code reviews**  |  Shows the total number of code reviews and findings reports generated by the [code review](code-reviews.md) feature. The **Total code reviews (manual only)** and **Findings report (manual only)** refer to the code reviews and finding reports that are *not* [auto-generated](start-review.md#auto-scan).  | 
|  **Code fixes**  |  Shows the total number of [code fixes](address-code-issues.md) generated by Amazon Q. The acceptance rate is calculated by taking the number of code fixes accepted by users, and dividing it by the total number of code fixes suggested by Amazon Q.  | 
|  **Code transformation**  |  Shows the total number code transformations performed by the [transformation](address-code-issues.md) feature, and the number of lines of code processed.  | 

# Disabling the Amazon Q Developer dashboard
Disabling the dashboard

You might want to disable the Amazon Q Developer dashboard if you have concerns about data privacy, page load times, or other potential issues. When you disable the dashboard, the dashboard page (and any links to it) will no longer be available in the Amazon Q Developer console.

For more information about the dashboard, see [Viewing usage metrics (dashboard)](dashboard.md).

**To disable the dashboard**

1. Open the Amazon Q Developer console:
   + If you set up Amazon Q Developer with an organization instance of AWS IAM Identity Center, then sign in using a management account or member account.
   + If you set up Amazon Q Developer with an account instance of IAM Identity Center, then sign in using the account associated with that instance.

1. Choose **Settings**, and in the **Amazon Q Developer user activity** section, choose **Edit**. 

1. Disable **Amazon Q Developer usage dashboard**.

# Troubleshooting the Amazon Q Developer dashboard
Troubleshooting the dashboard

If the Amazon Q Developer dashboard page is not available, do the following:
+ **Verify your permissions**. To view the dashboard, you need the following permissions:
  + `q:ListDashboardMetrics` 
  + `codewhisperer:ListProfiles` 
  + `sso:ListInstances` 
  + `user-subscriptions:ListUserSubscriptions` 
  + To see metrics generated before November 22, 2024, you also need: `cloudwatch:GetMetricData` and `cloudwatch:ListMetrics` 

    For more information about permissions, see [Allow administrators to use the Amazon Q Developer console](id-based-policy-examples-admins.md#q-admin-setup-admin-users).
+ **Verify your settings**. In the Amazon Q Developer console, choose **Settings** and make sure that the **Amazon Q Developer usage dashboard** toggle is enabled.

For more information about the dashboard, see [Viewing usage metrics (dashboard)](dashboard.md).

# Viewing the activity of specific users in Amazon Q Developer
Viewing per-user activity

You can configure Amazon Q to collect user activity telemetry of individual Amazon Q Developer subscribers in your organization and present that information in a report. The report gives you insights into how specific users are using Amazon Q.

Amazon Q generates the report every day at midnight (00:00) Coordinated Universal Time (UTC), and saves it in a CSV file at the following path:

`s3://bucketName/prefix/AWSLogs/accountId/QDeveloperLogs/by_user_analytic/region/year/month/day/00/accountId_by_user_analytic_timestamp.csv`

The CSV file is laid out as follows:
+ Each row shows a user who interacted with Amazon Q that day.
+ Each column shows a metric, as described in [User activity report metrics](user-activity-metrics.md). Metrics are calculated based on the user telemetry collected over the course of the day.

If more than 1,000 users interact with Amazon Q during the day, Amazon Q splits the data into several CSV files containing 1,000 users each, and having suffixes of `part_1`, `part_2`, and so on.

**Note**  
When you enable user activity reports, Amazon Q collects telemetry regardless of how a developer has set the **Enable Amazon Q to send usage data to AWS** setting in their IDE. That setting controls whether telemetry can be used by the *AWS corporation*, not your organization. For more information about this setting, see [Opting out of sharing your client-side telemetry](opt-out-IDE.md#opt-out-IDE-telemetry).

Use the following instructions to enable user activity reports.

**Prerequisite**

Create an Amazon S3 bucket to hold the user activity report CSV file. The bucket must:
+ Be in the AWS Region where the Amazon Q Developer profile was installed. This profile was installed when you subscribed IAM Identity Center workforce users to Amazon Q Developer Pro for the first time. For more information about this profile and the Regions where it's supported, see [What is the Amazon Q Developer profile?](subscribe-understanding-profile.md), and [Supported Regions for the Q Developer console and Q Developer profile](q-admin-setup-subscribe-regions.md#qdev-console-and-profile-regions).
+ Be in the AWS account where users are subscribed. If users are subscribed in multiple AWS accounts, then you must create buckets in each of those accounts. Cross-account buckets are not supported.
+ (Optional but recommended) Be different from the bucket you might be using for [prompt logging](q-admin-prompt-logging.md).
+ Include a prefix, also known as a subfolder, where Amazon Q will save the CSV file. The CSV file cannot be saved in the root of the bucket.
+ Have a bucket policy like the one that follows. Replace *bucketName*, *region*, *accountId*, and *prefix* with your own information.

------
#### [ JSON ]

****  

  ```
  {
      "Version":"2012-10-17",		 	 	 
      "Statement": [
          {
              "Sid": "QDeveloperLogsWrite",
              "Effect": "Allow",
              "Principal": {
                  "Service": "q.amazonaws.com"
              },
              "Action": [
                  "s3:PutObject"
              ],
              "Resource": [
                  "arn:aws:s3:::bucketName/prefix/*"
              ],
              "Condition": {
                  "StringEquals": {
                      "aws:SourceAccount": "111122223333"
                  },
                  "ArnLike": {
                      "aws:SourceArn": "arn:aws:codewhisperer:us-east-1:111122223333:*"
                  }
              }
          }
      ]
  }
  ```

------

  If you're configuring SSE-KMS on the bucket, add the below policy on the KMS key:

  ```
  {
      "Effect": "Allow",
      "Principal": {
          "Service": "q.amazonaws.com"
      },
      "Action": "kms:GenerateDataKey",
      "Resource": "*",
      "Condition": {
          "StringEquals": {
            "aws:SourceAccount": "accountId" 
          },
          "ArnLike": {
             "aws:SourceArn": "arn:aws:codewhisperer:region:accountId:*"
          }
      }
  }
  ```

  To learn about protecting the data in your Amazon S3 bucket, see [Protecting data with encryption](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingEncryption.html) in the *Amazon Simple Storage Service User Guide*.

**To enable user activity reports**

1. Open the Amazon Q Developer console.

   To use the Amazon Q Developer console, you must have the permissions defined in [Allow administrators to use the Amazon Q Developer console](id-based-policy-examples-admins.md#q-admin-setup-admin-users).

1. Choose **Settings**.

1. Under **Q Developer user activity reports**, choose **Edit**.

1. Toggle **Collect granular metrics per user**.

1. Under **S3 location**, enter the Amazon S3 URI that you will use to hold the CSV reports. Example: `s3://amzn-s3-demo-bucket/user-activity-reports/`

# User activity report metrics
User activity report metrics

The following table describes the metrics that are included in the user activity reports generated by Amazon Q Developer.

For more information about these reports, see [Viewing the activity of specific users in Amazon Q Developer](q-admin-user-telemetry.md).


| Metric name | Description | 
| --- | --- | 
|  Chat\$1AICodeLines  |  Lines of code suggested by Amazon Q and accepted by the user. This metric includes code that was generated through the [Amazon Q chat](q-in-IDE-chat.md) (not [inline chat](q-in-IDE-inline-chat.md)) and inserted into the IDE.   | 
|  Chat\$1MessagesInteracted  |  Number of chat messages where the user has interacted positively with Amazon Q. Examples of positive interactions: clicking a link, inserting a suggestion, and upvoting a response from Amazon Q. This metric includes messages that were generated by [Amazon Q chat](q-in-IDE-chat.md) (not [inline chat](q-in-IDE-inline-chat.md)).   | 
|  Chat\$1MessagesSent  |  Number of messages sent to and from Amazon Q. This metric includes the user prompts and Amazon Q responses in the [Amazon Q chat](q-in-IDE-chat.md) (not [inline chat](q-in-IDE-inline-chat.md)).   | 
|  CodeFix\$1AcceptanceEventCount  |  Number of code fixes suggested by Amazon Q and accepted by the user. This metric applies to code fixes generated through the [code review feature](code-reviews.md).  | 
|  CodeFix\$1AcceptedLines  |  Lines of code suggested by Amazon Q and accepted by the user. This metric applies to lines of code generated through the [code review feature](code-reviews.md).  | 
|  CodeFix\$1GeneratedLines  |  Lines of code suggested by Amazon Q. This metric applies to lines of code generated through the [code review feature](code-reviews.md).  | 
|  CodeFix\$1GenerationEventCount  |  Number of code fixes suggested by Amazon Q. This metric applies to code fixes generated through the [code review feature](code-reviews.md).  | 
|  CodeReview\$1FailedEventCount  |  Number of code issues that were found but for which Amazon Q could not suggest a code fix. This metric applies to code issues generated using the [code review feature](code-reviews.md).  | 
|  CodeReview\$1FindingsCount  |  Number of code issues found by Amazon Q. This metric applies to code issues found using the [code review feature](code-reviews.md).  | 
|  CodeReview\$1SucceededEventCount  |  Number of code issues that were found and for which Amazon Q was able to generate a suggested code fix. This metric applies to code issues found using the [code review feature](code-reviews.md).  | 
|  Dev\$1AcceptanceEventCount  |  Number of code features suggested by Amazon Q and accepted by the user. This metric applies to code features generated through the [/dev command](q-in-IDE-chat.md#develop-code).  | 
|  Dev\$1AcceptedLines  |  Lines of code suggested by Amazon Q and accepted by the user. This metric applies to lines of code generated through the [/dev command](q-in-IDE-chat.md#develop-code).  | 
|  Dev\$1GeneratedLines  |  Lines of code suggested by Amazon Q. This metric applies to lines of code generated through the [/dev command](q-in-IDE-chat.md#develop-code).  | 
|  Dev\$1GenerationEventCount  |  Number of code features suggested by Amazon Q. This metric applies to code features generated through the [/dev command](q-in-IDE-chat.md#develop-code).  | 
|  DocGeneration\$1AcceptedFileUpdates  |  Number of file updates suggested by Amazon Q and accepted by the user. This metric applies to file updates generated through the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  DocGeneration\$1AcceptedFilesCreations  |  Number of file creations suggested by Amazon Q and accepted by the user. This metric applies to file creations generated through the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  DocGeneration\$1AcceptedLineAdditions  |  Lines of documentation additions suggested by Amazon Q and accepted by the user. This metric applies to documentation generated through the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  DocGeneration\$1AcceptedLineUpdates  |  Lines of documentation updates suggested by Amazon Q and accepted by the user. This metric applies to documentation generated using the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  DocGeneration\$1EventCount  |  Number of times the user engaged with Amazon Q using the [/doc command](q-in-IDE-chat.md#doc-generation).   | 
|  DocGeneration\$1RejectedFileCreations  |  Number of file creations suggested by Amazon Q and rejected by the user. This metric applies to file creations generated through the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  DocGeneration\$1RejectedFileUpdates  |  Number of file updates suggested by Amazon Q and rejected by the user. This metric applies to file updates generated through the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  DocGeneration\$1RejectedLineAdditions  |  Lines of documentation additions suggested by Amazon Q and rejected by the user. This metric applies to documentation generated through the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  DocGeneration\$1RejectedLineUpdates  |  Lines of documentation updates suggested by Amazon Q and rejected by the user. This metric applies to documentation generated using the [/doc command](q-in-IDE-chat.md#doc-generation).  | 
|  InlineChat\$1AcceptedLineAdditions  |  Lines of code additions suggested by Amazon Q and accepted by the user. This metric includes code additions generated through the [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)).  | 
|  InlineChat\$1AcceptedLineDeletions  |  Lines of code deletions suggested by Amazon Q and accepted by the user. This metric includes code deletions suggested through the [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)).  | 
|  InlineChat\$1AcceptanceEventCount  |  Number of [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)) suggestions that were accepted by the user.  | 
|  InlineChat\$1DismissalEventCount  |  Number of [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)) suggestions that were abandoned by the user. By 'abandoned', we mean that the code suggestion was displayed but the user kept typing or performing other operations in their IDE, and did not explicitly accept or reject the code suggestion.  | 
|  InlineChat\$1DismissedLineAdditions  |  Lines of code additions suggested by Amazon Q and abandoned by the user. By 'abandoned', we mean that the code suggestion was displayed but the user kept typing or performing other operations in their IDE, and did not explicitly accept or reject the code suggestion. This metric includes code additions generated through the [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)).  | 
|  InlineChat\$1DismissedLineDeletions  |  Lines of code deletions suggested by Amazon Q and abandoned by the user. By 'abandoned', we mean that the code suggestion was displayed but the user kept typing or performing other operations in their IDE, and did not explicitly accept or reject the code suggestion. This metric includes code deletions suggested through the [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)).  | 
|  InlineChat\$1EventCount  |  Number of [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)) sessions that the user engaged in.  | 
|  InlineChat\$1RejectedLineAdditions  |  Lines of code additions suggested by Amazon Q and rejected by the user. This metric includes code additions generated through the [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)).  | 
|  InlineChat\$1RejectedLineDeletions  |  Lines of code deletions suggested by Amazon Q and rejected by the user. This metric includes code deletions suggested through the [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)).  | 
|  InlineChat\$1RejectionEventCount  |  Number of [inline chat](q-in-IDE-inline-chat.md) (not [Amazon Q chat](q-in-IDE-chat.md)) suggestions that were rejected by the user.  | 
|  Inline\$1AICodeLines  |  Lines of code suggested by Amazon Q and accepted by the user. This metric includes code that was accepted as [inline suggestions](inline-suggestions.md).  | 
|  Inline\$1AcceptanceCount  |  Number of [inline suggestions](inline-suggestions.md) accepted by the user.  | 
|  Inline\$1SuggestionsCount  |  Number of [inline suggestions](inline-suggestions.md) displayed to the user.  | 
|  TestGeneration\$1AcceptedLines  |  Lines of code suggested by Amazon Q and accepted by the user. This metric applies to lines of code generated through the [/test command](q-in-IDE-chat.md#unit-tests).  | 
|  TestGeneration\$1AcceptedTests  |  Number of unit tests suggested by Amazon Q and accepted by the user. This metric applies to unit tests generated through the [/test command](q-in-IDE-chat.md#unit-tests).  | 
|  TestGeneration\$1EventCount  |  Number of times the user engaged with Amazon Q through the [/test command](q-in-IDE-chat.md#unit-tests).   | 
|  TestGeneration\$1GeneratedLines  |  Lines of code suggested by Amazon Q. This metric applies to lines of code generated through the [/test command](q-in-IDE-chat.md#unit-tests).  | 
|  TestGeneration\$1GeneratedTests  |  Number of unit tests suggested by Amazon Q. This metric applies to unit tests generated through the [/test command](q-in-IDE-chat.md#unit-tests).  | 
|  Transformation\$1EventCount  |  Number of times the user engaged with Amazon Q through the [/transform command](transform-in-IDE.md), excluding the times when the when the user [transformed code on the command line](transform-CLI.md).  | 
|  Transformation\$1LinesGenerated  |  Lines of code suggested by Amazon Q. This metric applies to code generated through the [/transform command](transform-in-IDE.md), excluding code [transformed on the command line](transform-CLI.md).  | 
|  Transformation\$1LinesIngested  |  Lines of code provided to Amazon Q for transformation. This metric applies to code that is provided through the [/transform command](transform-in-IDE.md), excluding code provided for [transformation on the command line](transform-CLI.md), or for an [SQL conversion](transform-sql.md).  | 

# Logging users' prompts in Amazon Q Developer
Logging users' prompts

Administrators can enable the logging of all [inline suggestions](inline-suggestions.md) and [chat conversations](q-in-IDE-chat.md) that users have with Amazon Q in their integrated development environment (IDE). These logs can help with auditing, debugging, analytics, and ensuring compliance.

When developers use inline suggestions, Amazon Q will log the accepted and actively rejected suggestions. When developers chat with Amazon Q, Amazon Q will log both the developers' prompts and Amazon Q's responses. When developers chat with [the Amazon Q Agent for software development](q-in-IDE-chat.md#develop-code) using the **/dev** command, only the prompts will be logged.

Amazon Q stores the logs in an Amazon S3 bucket that you create, at the following path:

`bucketName/prefix/AWSLogs/accountId/QDeveloperLogs/log-type/region/year/month/day/utc-hour/zipFile.gz/logFile.json`

At the previous path, `log-type` is one of the following:
+ `GenerateAssistantResponse` — holds chat logs
+ `GenerateCompletions` — holds inline completion logs
+ `StartTaskAssistCodeGeneration` — holds **/dev** logs

For examples and explanations of log file contents, see [Prompt log examples in Amazon Q Developer](q-admin-prompt-log-examples.md).

There is no charge for the prompt logging feature other than the storage cost of the Amazon S3 bucket used to hold the logs, and a small fee for the optional KMS key used to encrypt the bucket.

Use the following instructions to enable prompt logging.

**Prerequisites**
+ Make sure users are subscribed in a standalone account or, if you're using [AWS Organizations](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html), a management account. Currently, Q Developer does not support logging the prompts of users who are subscribed in member accounts in AWS Organizations.
+ Create an Amazon S3 bucket to hold the prompt logs. The bucket must:
  + Be in the AWS Region where the Amazon Q Developer profile was installed. This profile was installed when you subscribed users to Amazon Q Developer Pro for the first time. For more information about this profile and the Regions where it's supported, see [What is the Amazon Q Developer profile?](subscribe-understanding-profile.md), and [Supported Regions for the Q Developer console and Q Developer profile](q-admin-setup-subscribe-regions.md#qdev-console-and-profile-regions).
  + Be in the AWS account where users are subscribed.
  + Have a bucket policy like the one that follows. Replace *bucketName*, *region*, *accountId*, and *prefix* with your own information.

------
#### [ JSON ]

****  

    ```
    {
        "Version":"2012-10-17",		 	 	 
        "Statement": [
            {
                "Sid": "QDeveloperLogsWrite",
                "Effect": "Allow",
                "Principal": {
                    "Service": "q.amazonaws.com"
                },
                "Action": [
                    "s3:PutObject"
                ],
                "Resource": [
                    "arn:aws:s3:::bucketName/prefix/*"
                ],
                "Condition": {
                    "StringEquals": {
                        "aws:SourceAccount": "111122223333"
                    },
                    "ArnLike": {
                    "aws:SourceArn": "arn:aws:codewhisperer:us-east-1:111122223333:*"
                    }
                }
            }
        ]
    }
    ```

------

    If you're configuring SSE-KMS on the bucket, add the following policy on the KMS key:

    ```
    {
        "Effect": "Allow",
        "Principal": {
            "Service": "q.amazonaws.com"
        },
        "Action": "kms:GenerateDataKey",
        "Resource": "*",
        "Condition": {
            "StringEquals": {
              "aws:SourceAccount": "accountId" 
            },
            "ArnLike": {
               "aws:SourceArn": "arn:aws:codewhisperer:region:accountId:*"
            }
        }
    }
    ```

    To learn about protecting the data in your Amazon S3 bucket, see [Protecting data with encryption](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingEncryption.html) in the *Amazon Simple Storage Service User Guide*.

**To enable prompt logging**

1. Open the Amazon Q Developer console.

   To use the Amazon Q Developer console, you must have the permissions defined in [Allow administrators to use the Amazon Q Developer console](id-based-policy-examples-admins.md#q-admin-setup-admin-users).
**Note**  
You must sign in as a standalone account administrator, or management account administrator. Member account administrators cannot enable prompt logging because prompt logging is not supported for users subscribed in member accounts.

1. Choose **Settings**.

1. Under **Preferences**, choose **Edit**.

1. In the Edit preferences window, toggle **Q Developer prompt logging**.

1. Under Amazon S3 location, enter the Amazon S3 URI that you will use to receive the logs. Example: `s3://amzn-s3-demo-bucket/qdev-prompt-logs/`

# Prompt log examples in Amazon Q Developer
Prompt log examples

This section provides examples of prompt logs generated by Amazon Q Developer. 

Following each example is a table that describes the log file's fields.

For more information about prompt logs, see [Logging users' prompts in Amazon Q Developer](q-admin-prompt-logging.md).

**Topics**
+ [

## Inline suggestions log example
](#prompt-log-examples-inline)
+ [

## Chat log example
](#prompt-log-examples-chat)
+ [

## /dev log example
](#prompt-log-examples-dev)

## Inline suggestions log example
Inline suggestions log example

The following example shows a log file that is generated when a user accepts an inline suggestion.

```
{
    "records": [
        {
            "generateCompletionsEventRequest": {
                "leftContext": "import * cdk from 'aws-cdk-lib';\r\nimport * s3 from 'aws-cdk-lib/aws-s3';\r\nimport { Stack, StackProps } from 'constructs';\r\nexport class MyStack extends Stack {\r\n  constructor(scope: cdk.App, id: string, props?: StackProps) {\r\n    super(scope, id, props);\r\n\r\n    new s3.Bucket(this, 'XXXXXXXX', {\r\n      versioned: true\r\n    });\r\n  }\r\n  ",
                "rightContext": "",
                "fileName": "cdk-modified.ts",
                "customizationArn": null,
                "userId": "d-92675051d5.b8f1f340-9081-70ad-5fc5-0f37151937a6",
                "timeStamp": "2025-01-06T15:09:16.412719Z"
            },
            "generateCompletionsEventResponse": {
                "completions": ["synth() {\n    return cdk.App.prototype.synth.apply(this, arguments);\n  }"],
                "requestId": "797c70ee-abc9-4cc7-a148-b9df17f6ce48"
            }
        }
    ]
}
```

The following table describes the fields in the log file for inline suggestions.


| Field name | Description | 
| --- | --- | 
|  `records`  |  Top-level field that contains a set of inline suggestions, also known as inline completions.  | 
|  `generateCompletionsEventRequest`  |  Describes the request for an inline code suggestion. The request is made by Amazon Q, on behalf of the user.  | 
|  `leftContext`  |  Indicates the code before the cursor that Amazon Q is using for context to generate an inline suggestion.  | 
|  `rightContext`  |  Indicates the code after the cursor that Amazon Q is using for context to generate an inline suggestion.  | 
|  `fileName`  |  Indicates the name of the file in which an inline suggestion was requested.  | 
|  `customizationArn`  |  Indicates the Amazon Resource Name (ARN) of the customization applied to inline suggestions. In this example, there is no customization.   | 
|  `userId`  |  Indicates the user ID of the user who requested an inline suggestion.  | 
|  `timeStamp`  |  Indicates the date and time that the inline suggestion was requested. The timestamp is in Coordinated Universal Time (UTC).  | 
|  `generateCompletionsEventResponse`  |  Describes the inline suggestion generated by Amazon Q.  | 
|  `completions`  |  Indicates the inline suggestion that Amazon Q provided and that the user accepted.  | 
|  `requestId`  |  The ID of the inline request that uniquely identifies the event.  | 

## Chat log example
Chat log example

The following example shows a log file that is generated when a user chats using Amazon Q in their IDE.

```
{
    "records": [
        {
            "generateAssistantResponseEventRequest": {
                "prompt": "Can you explain how to set up object-level access control in an S3 bucket using AWS CDK?",
                "chatTriggerType": "MANUAL",
                "customizationArn": null,
                "userId": "d-92675051d5.b8f1f340-9081-70ad-5fc5-0f37151937a6",
                "timeStamp": "2025-01-06T15:05:56.313070Z"
            },
            "generateAssistantResponseEventResponse": {
                "assistantResponse": "I'll explain how to set up object-level access control for an S3 bucket using AWS CDK. Here's how you can implement different access control configurations: [[1]](https://docs.aws.amazon.com/AmazonS3/latest/API/s3_example_s3_Scenario_ManageACLs_section.html)\n\n1. Using Bucket Owner Enforced (Recommended Modern Approach):\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport * as s3 from 'aws-cdk-lib/aws-s3';\n\nnew s3.Bucket(this, 'XXXXXXXX', {\n  objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,\n  blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL\n});\n```\n\n2. Using Public Access Block Configuration:\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport * as s3 from 'aws-cdk-lib/aws-s3';\n\nnew s3.Bucket(this, 'XXXXXXXX', {\n  blockPublicAccess: new s3.BlockPublicAccess({\n    blockPublicAcls: true,\n    blockPublicPolicy: true,\n    ignorePublicAcls: true,\n    restrictPublicBuckets: true\n  })\n});\n```\n\n3. Setting Access Control for Specific Use Cases:\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport * as s3 from 'aws-cdk-lib/aws-s3';\nimport * as iam from 'aws-cdk-lib/aws-iam';\n\nconst bucket = new s3.Bucket(this, 'XXXXXXXX', {\n  // Enable versioning for object-level recovery\n  versioned: true,\n  \n  // Enforce encryption\n  encryption: s3.BucketEncryption.S3_MANAGED,\n  \n  // Block all public access\n  blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,\n  \n  // Enforce object ownership\n  objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,\n  \n  // Enable server access logs\n  serverAccessLogsPrefix: 'logs/'\n});\n\n// Grant read access to specific IAM role\nconst role = new iam.Role(this, 'MyRole', {\n  assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),\n});\nbucket.grantRead(role);\n\n// Grant write access to specific objects with prefix\nbucket.addToResourcePolicy(new iam.PolicyStatement({\n  actions: ['s3:PutObject'],\n  resources: [bucket.arnForObjects('uploads/*')],\n  principals: [new iam.AccountRootPrincipal()]\n}));\n```\n\n4. Setting up Lifecycle Rules for Objects:\n```typescript\nimport * as cdk from 'aws-cdk-lib';\nimport * as s3 from 'aws-cdk-lib/aws-s3';\n\nnew s3.Bucket(this, 'XXXXXXXX', {\n  lifecycle: [\n    {\n      transitions: [\n        {\n          storageClass: s3.StorageClass.INFREQUENT_ACCESS,\n          transitionAfter: cdk.Duration.days(30)\n        },\n        {\n          storageClass: s3.StorageClass.GLACIER,\n          transitionAfter: cdk.Duration.days(90)\n        }\n      ],\n      expiration: cdk.Duration.days(365)\n    }\n  ]\n});\n```\n\nKey points to remember:\n- Always use the principle of least privilege\n- Block public access by default unless explicitly required\n- Use BUCKET_OWNER_ENFORCED for object ownership when possible\n- Consider implementing lifecycle rules for cost optimization\n- Use versioning for sensitive data\n- Implement server-side encryption\n- Use resource policies and IAM roles for access control instead of ACLs\n- Monitor access patterns using server access logging\n\nThese configurations help create a secure and well-managed S3 bucket with appropriate access controls at both bucket and object levels.",
                "followupPrompts": "How can you implement multi-factor authentication for S3 bucket access using AWS CDK?What are the best practices for setting up object-level versioning in AWS S3 using CDK?How can you use AWS CDK to create a custom error message for unauthorized access attempts on an S3 bucket?",
                "messageMetadata": {
                    "conversationId": "491bd3cd-d70d-40c0-a452-5ef3f0878422",
                    "utteranceId": null
                },
                "codeReferenceEvents": [],
                "supplementaryWebLinksEvent": [
                    {
                        "uri": "https://docs.aws.amazon.com/AmazonS3/latest/API/s3_example_s3_Scenario_ManageACLs_section.html",
                        "title": "[1] Manage access control lists (ACLs) for Amazon S3 buckets using an AWS SDK - Amazon Simple Storage Service",
                        "snippet": "The following code example shows how to manage access control lists (ACLs) for Amazon S3 buckets.\n\n.NET\n\n**AWS SDK for .NET**\n\n```\n    using System;\n    using System.Collections.Generic;\n    using System.Threading.Tasks;\n    using Amazon.S3;\n    using Amazon.S3.Model;\n\n    /// <summary>\n    /// This example shows how to manage Amazon Simple Storage Service\n    /// (Amazon S3) access control lists (ACLs) to control Amazon S3 bucket\n    /// access.\n    /// </summary>\n    public class ManageACLs\n    {\n        public static async Task Main()\n        {\n            string bucketName = \"amzn-s3-demo-bucket1\";\n            string newBucketName = \"amzn-s3-demo-bucket2\";\n            string keyName = \"sample-object.txt\";\n            string emailAddress = \"someone@example.com\";\n\n            // If the AWS Region where your bucket is located is different from\n            // the Region defined for the default user, pass the Amazon S3 bucket's\n            // name to the client constructor. It should look like this:\n            // RegionEndpoint bucketRegion = RegionEndpoint.USEast1;\n            IAmazonS3 client = new AmazonS3Client();\n\n            await TestBucketObjectACLsAsync(client, bucketName, newBucketName, keyName, emailAddress);\n        }\n\n        /// <summary>\n        /// Creates a new Amazon S3 bucket with a canned ACL, then retrieves the ACL\n        /// information and then adds a new ACL to one of the objects in the\n        /// Amazon S3 bucket.\n        /// </summary>\n        /// <param name=\"client\">The initialized Amazon S3 client object used to call\n        /// methods to create a bucket, get an ACL, and add a different ACL to\n        /// one of the objects.</param>\n        /// <param name=\"bucketName\">A string representing the original Amazon S3\n        /// bucket name.</param>\n        /// <param name=\"newBucketName\">A string representing the name of the\n        /// new bucket that will be created.</param>\n        /// <param name=\"keyName\">A string representing the key name of an Amazon S3\n        /// object for which we will change the ACL.</param>\n        /// <param name=\"emailAddress\">A string representing the email address\n        /// belonging to the person to whom access to the Amazon S3 bucket will be\n        /// granted.</param>\n        public static async Task TestBucketObjectACLsAsync(\n            IAmazonS3 client,\n            string bucketName,\n            string newBucketName,\n            string keyName,\n            string emailAddress)\n        {\n            try\n            {\n                // Create a new Amazon S3 bucket and specify canned ACL.\n                var success = await CreateBucketWithCannedACLAsync(client, newBucketName);\n\n                // Get the ACL on a bucket.\n                await GetBucketACLAsync(client, bucketName);\n\n                // Add (replace) the ACL on an object in a bucket.\n                await AddACLToExistingObjectAsync(client, bucketName, keyName, emailAddress);\n            }\n            catch (AmazonS3Exception amazonS3Exception)\n            {\n                Console.WriteLine($\"Exception: {amazonS3Exception.Message}\");\n            }\n        }\n\n        /// <summary>\n        /// Creates a new Amazon S3 bucket with a canned ACL attached.\n        /// </summary>\n        /// <param name=\"client\">The initialized client object used to call\n        /// PutBucketAsync.</param>\n        /// <param name=\"newBucketName\">A string representing the name of the\n        /// new Amazon S3 bucket.</param>\n        /// <returns>Returns a boolean value indicating success or failure.</returns>\n        public static async Task<bool> CreateBucketWithCannedACLAsync(IAmazonS3 client, string newBucketName)\n        {\n            var request = new PutBucketRequest()\n            {\n                BucketName = newBucketName,\n                BucketRegion = S3Region.EUWest1,\n\n                // Add a canned ACL.\n                CannedACL = S3CannedACL.LogDeliveryWrite,\n            };\n\n            var response = await client.PutBucketAsync(request);\n            return response.HttpStatusCode == System.Net.HttpStatusCode.OK;\n        }\n\n\n        /// <summary>\n        /// Retrieves the ACL associated with the Amazon S3 bucket name in the\n        /// bucketName parameter.\n        /// </summary>\n        /// <param name=\"client\">The initialized client object used to call\n        /// PutBucketAsync.</param>\n        /// <param name=\"bucketName\">The Amazon S3 bucket for which we want to get the\n        /// ACL list.</param>\n        /// <returns>Returns an S3AccessControlList returned from the call to\n        /// GetACLAsync.</returns>\n        public static async Task<S3AccessControlList> GetBucketACLAsync(IAmazonS3 client, string bucketName)\n        {\n            GetACLResponse response = await client.GetACLAsync(new GetACLRequest\n            {\n                BucketName = bucketName,\n            });\n\n            return response.AccessControlList;\n        }\n\n\n\n        /// <summary>\n        /// Adds a new ACL to an existing object in the Amazon S3 bucket.\n        /// </summary>\n        /// <param name=\"client\">The initialized client object used to call\n        /// PutBucketAsync.</param>\n        /// <param name=\"bucketName\">A string representing the name of the Amazon S3\n        /// bucket containing the object to which we want to apply a new ACL.</param>\n        /// <param name=\"keyName\">A string representing the name of the object\n        /// to which we want to apply the new ACL.</param>\n        /// <param name=\"emailAddress\">The email address of the person to whom\n        /// we will be applying to whom access will be granted.</param>\n        public static async Task AddACLToExistingObjectAsync(IAmazonS3 client, string bucketName, string keyName, string emailAddress)\n        {\n            // Retrieve the ACL for an object.\n            GetACLResponse aclResponse = await client.GetACLAsync(new GetACLRequest\n            {\n                BucketName = bucketName,\n                Key = keyName,\n            });\n\n            S3AccessControlList acl = aclResponse.AccessControlList;\n\n            // Retrieve the owner.\n            Owner owner = acl.Owner;\n\n            // Clear existing grants.\n            acl.Grants.Clear();\n\n            // Add a grant to reset the owner's full permission\n            // (the previous clear statement removed all permissions).\n            var fullControlGrant = new S3Grant\n            {\n                Grantee = new S3Grantee { CanonicalUser = acl.Owner.Id },\n            };\n            acl.AddGrant(fullControlGrant.Grantee, S3Permission.FULL_CONTROL);\n\n            // Specify email to identify grantee for granting permissions.\n            var grantUsingEmail = new S3Grant\n            {\n                Grantee = new S3Grantee { EmailAddress = emailAddress },\n                Permission = S3Permission.WRITE_ACP,\n            };\n\n            // Specify log delivery group as grantee.\n            var grantLogDeliveryGroup = new S3Grant\n            {\n                Grantee = new S3Grantee { URI = \"http://acs.amazonaws.com/groups/s3/LogDelivery\" },\n                Permission = S3Permission.WRITE,\n            };\n\n            // Create a new ACL.\n            var newAcl = new S3AccessControlList\n            {\n                Grants = new List<S3Grant> { grantUsingEmail, grantLogDeliveryGroup },\n                Owner = owner,\n            };\n\n            // Set the new ACL. We're throwing away the response here.\n            _ = await client.PutACLAsync(new PutACLRequest\n            {\n                BucketName = bucketName,\n                Key = keyName,\n                AccessControlList = newAcl,\n            });\n        }\n\n    }\n\n\n```\n\n* For API details, see the following topics in _AWS SDK for .NET API Reference_.\n  \n  * GetBucketAcl\n\n* GetObjectAcl\n\n* PutBucketAcl\n\n* PutObjectAcl\n\nFor a complete list of AWS SDK developer guides and code examples, see Developing with Amazon S3 using the AWS SDKs. This topic also includes information about getting started and details about previous SDK versions.\n"
                    }
                ],
                "requestId": "dad38fc0-815c-45f7-970a-db916cb7f131"
            }
        }
    ]
}
```


| Field name | Description | 
| --- | --- | 
|  `records`  |  Top-level field that contains a set of prompts and responses.  | 
|  `generateAssistantResponseEventRequest`  |  Describes the prompt entered by the user in the chat window in their IDE.  | 
|  `prompt`  |  Indicates the prompt the user entered into the chat window.  | 
|  `chatTriggerType`  |  `MANUAL` indicates that the user entered a prompt into the chat window, or clicked on one of the suggested questions in the chat window. `INLINE_CHAT` indicates that the user entered a prompt into the small input screen in the main coding window. For more information about chatting inline, see [Chatting inline with Amazon Q Developer](q-in-IDE-inline-chat.md).  | 
|  `customizationArn`  |  Indicates the Amazon Resource Name (ARN) of the customization applied to the chat. In this example, there is no customization. For   | 
|  `userId`  |  Indicates the user ID of the user who entered the prompt.  | 
|  `timeStamp`  |  Indicates the date and time that the user entered the prompt. The timestamp is in universal time (UTC).  | 
|  `generateAssistantResponseEventResponse`  |  Describes the response generated by Amazon Q.  | 
|  `assistantResponse`  |  Indicates the response that Amazon Q provided to the user's prompt.  | 
|  `followupPrompts`  |  Indicates the follow-up example prompts that were displayed to the user at the end of the response.  | 
|  `messageMetadata`  |  Describes metadata associated with the response.  | 
|  `conversationId`  |  Indicates the conversation ID of the response. The conversation ID groups together messages in a chat session.  | 
|  `utteranceId`  |  Indicates the utterance ID of the response. An utterance ID is a label that distinguishes one prompt from another within a dialogue or data set.  | 
|  `codeReferenceEvents`  |  Describes links to code references included in the response.  | 
|  `supplementaryWebLinksEvent`  |  Indicates the links that were displayed to the user at the end of the response.  | 
|  `requestId`  |  The ID of the response that uniquely identifies the event.  | 

## /dev log example
/dev log example

The following example shows a log file that is generated with a user enters a **/dev** command in the Amazon Q chat in their IDE.

```
{
    "records": [
        {
            "startTaskAssistCodeGenerationEventRequest": {
                "prompt": "write a python application that prints 'hello world!' text to the screen and format it in red bold text",
                "chatTriggerType": "MANUAL",
                "conversationId": "da1c95b6-84e1-46a2-9ef9-fe92f5ee169e",
                "customizationArn": null,
                "userId": "d-92675051d5.b8f1f340-9081-70ad-5fc5-0f37151937a6",
                "timeStamp": "2025-01-13T15:40:27.808027101Z"
            },
            "startTaskAssistCodeGenerationEventResponse": {
                "requestId": "e504f126-7197-4e3c-a046-1a10d5a3f3e0"
            }
        }
    ]
}
```


| Field name | Description | 
| --- | --- | 
|  `records`  |  Top-level field that contains a set of prompts and responses.  | 
|  `startTaskAssistCodeGenerationEventRequest`  |  Describes the **/dev** prompt entered by the user in the chat window in their IDE.  | 
|  `prompt`  |  Indicates the **/dev** prompt the user entered into the chat window.  | 
|  `chatTriggerType`  |  `MANUAL` indicates that the user entered a prompt into the chat window, or clicked on one of the suggested questions in the chat window. `INLINE_CHAT` indicates that the user entered a prompt into the small input screen in the main coding window. For more information about chatting inline, see [Chatting inline with Amazon Q Developer](q-in-IDE-inline-chat.md).  | 
|  `conversationId`  |  Indicates the conversation ID of the response. The conversation ID groups together messages in a chat session.  | 
|  `customizationArn`  |  Indicates the Amazon Resource Name (ARN) of the customization applied to the chat. In this example, there is no customization. For   | 
|  `userId`  |  Indicates the user ID of the user who entered the prompt.  | 
|  `timeStamp`  |  Indicates the date and time that the user entered the prompt. The timestamp is in universal time (UTC).  | 
|  `startTaskAssistCodeGenerationEventResponse`  |  Describes the response generated by Amazon Q. Currently, recording the responses to **/dev** commands is not supported, so the field won't include a response.  | 
|  `assistantResponse`  |  Indicates the response that Amazon Q provided to the user's prompt.  | 
|  `requestId`  |  The ID of the response that uniquely identifies the event.  | 