Details
-
Task
-
Resolution: Done
-
Minor
-
6.5.0
-
KV Sprint 2020-February
Description
Description
There has been a request to ensure that if an audit event is to include elapsed time, they do that in the same format as Query
Background
An existing example of a Query audit event that uses elapsed time is
{
|
"description": "A N1QL SELECT statement was executed",
|
"enabled": false,
|
"filtering_permitted": true,
|
"id": 28672,
|
"mandatory_fields": {
|
"isAdHoc": true,
|
"metrics": {
|
"elapsedTime": "1.0s",
|
"errorCount": 0,
|
"executionTime": "0.75s",
|
"mutationCount": 0,
|
"resultCount": 1,
|
"resultSize": 18,
|
"sortCount": 1,
|
"warningCount": 1
|
},
|
"node": "",
|
"real_userid": {
|
"domain": "",
|
"user": ""
|
},
|
"remote": {
|
"ip": "",
|
"port": 1
|
},
|
"requestId": "",
|
"statement": "",
|
"status": "",
|
"timestamp": "",
|
"userAgent": ""
|
},
|
"name": "SELECT statement",
|
"optional_fields": {
|
"clientContextId": "",
|
"namedArgs": {
|
"name1": "",
|
"name2": ""
|
},
|
"positionalArgs": [
|
""
|
]
|
},
|
"sync": false
|
}
|
For query's elapsed time is generated from the golang's time library: func (Duration) String func (d Duration) String() string
String returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s.