[Java] What is the proper way to get CPU usage by container?

Hello Everyone,

I have just started with New Relic and need some guidance on this topic.

I want to monitor CPU usage by each containers which are running in a K8s cluster. This container is running on a host which has 8 logical processors and CPU limit is 1.

I can see there are multiple ways New Relic is getting data. For example, while checking in Summary tab under services-APM it is using following NRQL which showed utilization sometimes exceed 100%:

SELECT rate(sum(apm.service.cpu.usertime.utilization), 1 second) * 100 as cpuUsage FROM Metric WHERE (entity.guid = 'MTcyMTUzOXxBUE18QVBQTElDQVRJT058OTk0NTc1NzM4') FACET host LIMIT 20 SINCE 1636747609019 UNTIL 1636751209019 TIMESERIES

In Metrics Explorer I am seeing following NRQL is getting used. This one also showed utilization sometimes exceed 100%:

SELECT average(newrelic.timeslice.value) * 1000 AS CPU/User/UtilizationFROM Metric FACET instanceName WHERE metricTimesliceName = 'CPU/User/Utilization' ANDentity.guid = 'MTcyMTUzOXxBUE18QVBQTElDQVRJT058OTk0NTc1NzM4' SINCE 1636747609019 UNTIL 1636751209019 TIMESERIES

My question is which one to use of these two?

One more thing, I tried to use NRQL like below to get core utilization but that’s not returning anything:
FROM Metric SELECT k8s.container.cpuCoresUtilization AS 'CPU usage' WHERE k8s.clusterName = 'eks-useast2-mycluster' AND k8s.podName = 'mycluster' FACET k8s.containerName TIMESERIES

Am I doing anything wrong here?

Thanks!