connect: OLDEST_CONTACT_AGE incorrect unit.
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- [x] I've gone through Developer Guide and API reference
- [x] I've checked AWS Forums and StackOverflow for answers
- [x] I've searched for previous similar issues and didn't find any solution
Describe the bug
When using the aws sdk to pull real time metrics from connect (per the documentation here), the entry for OLDEST_CONTACT_AGE indicates the unit is seconds. However, it appears to actually be in milliseconds.
For example, in the response from the getCurrentMetricData call, we commonly get items like:
{"Metric":{"Name":"OLDEST_CONTACT_AGE","Unit":"SECONDS"},"Value":324812}
But 324812 seconds is over 90 hours, this cannot be right. As milliseconds, this is a little over five minutes, which matches what we see in the connect dashboard.
Is the issue in the browser/Node.js? Node.js
If on Node.js, are you running this on AWS Lambda? Yes
Details of the browser/Node.js version lambda runtime: nodejs12.x
SDK version number 2.631.0
To Reproduce (observed behavior)
const AWS = require("aws-sdk");
new AWS.connect().getCurrentMetricData({
InstanceId: "CONNECT_INSTANCE_ID",
CurrentMetrics: [{Name: 'OLDEST_CONTACT_AGE', Unit: 'SECONDS'}],
Filters: {
Channels: ['VOICE'],
Queues: [/* some queue IDs */]
},
}).promise().then(data => {
console.log(data.MetricResults[0].Collections.find(m => m.Metric.Name === "OLDEST_CONTACT_AGE").Value) // Note that this is typically quite large (>1000)
})
Expected behavior For the value of that metric to be given in seconds, like the documentation and the response indicate.
Update This is a problem not only for the js-sdk but also for python's boto3.
@crrice Thank-you for reporting this.
Documentation bug, reached out to the documentation/service team.
Will update you once I hear back from them.
Hey @crrice just heard back from the team, you are right in this case however a lot of customers are already converting the value to milliseconds manually and the service team wont like to break their code. As a fix they have mentioned the disconnect between second and millisecond in the docs here.
Would be closing this issue now, please reach out if you have any additional questions.
Thank you, as you mention we have a lot of code already converting these values to seconds so it's nice not to have to change that. However, your note in the documentation seems backwards to me:
Unit says MILLISECONDS but the Value is returned in SECONDS.
Rather the opposite is true, the unit says SECONDS, but the value is returned in MILLISECONDS.
Rather the opposite is true, the unit says SECONDS, but the value is returned in MILLISECONDS. I already requested for that change, thankyou.
If they decide to make a change in future, I will let you know.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.