Hello,
I was hoping someone can help. I'm working on a project where we use Angular app to monitor queues and if one "breaks" we alert the team so we can fix it. I've modelled our app using the sample app here: https://developer.genesys.cloud/blueprints/angular-app-with-genesys-cloud-sdk/, but I encountered some metrics not working.
This is what it looks like when I have oWaiting metric enabled (seems like if number in oWaiting is greater than zero, it breaks):
And this is what it looks like when oWaiting is disabled and other metrics are used:
This is what I have for genesys-cloud.service.ts
:
getQueueObservations(queueId: string): Observable<platformClient.Models.QueueObservationDataContainer>{
return from(this.analyticsApi.postAnalyticsQueuesObservationsQuery({
filter: {
type: 'or',
predicates: [
{
type: 'dimension',
dimension: 'queueId',
operator: 'matches',
value: queueId
}
]
},
metrics: [ 'oOnQueueUsers', 'oActiveUsers', 'oOffQueueUsers', 'oWaiting' ]
}))
.pipe(
map(data => {
const result = data.results?.find(r => r.group?.queueId === queueId);
if(!result) throw new Error(`No results queried for ${queueId}`);
console.log(result)
return result;
})
);
}
This is what I have for queue-details.component.ts
:
getQueueObservations(){
if(!this.queue) throw Error('Invalid queue.');
this.fetching = true;
this.genesysCloudService.getQueueObservations(this.queue.id!)
.subscribe(result => {
if(!result.data) throw new Error('Error in getting observations.')
this.onQueueAgents = result.data
.filter(d => d.metric === 'oOnQueueUsers')
.reduce((acc, d) => acc + d.stats!.count!, 0)
this.totalAgents = result.data
.find(d => d.metric === 'oActiveUsers')!.stats!.count || 0;
this.offQueueAgents = result.data
.filter(d => d.qualifier === 'ccf3c10a-aa2c-4845-8e8d-f59fa48c58e5')
.reduce((acc, d) => acc + d.stats!.count!, 0)
this.waiting = result.data
.filter(d => d.metric === 'oWaiting')
.reduce((acc, d) => acc + d.stats!.count!, 0)
this.fetching = false;
});
}
Is it because oWaiting is in a different group than the rest of the metrics I'm using? How can I fix this?
Thank you!