I'm trying to fetch timeseries points of VCPU count for a VM instance using monitoring_v3
API. While reading the documentation, I encountered two metric types
instance/cpu/guest_visible_vcpus
instance/cpu/reserved_cores
Which metric type is appropriate for VCPU count and why?
Google documents those metrics here.
Which one to use depends on what you are trying to measure and the types of instances you are running. In most cases, the reserved_cores
represents real CPU power. guest_visible_vcpu
represents what the guest appears to have, which might appear to be a lot more than the reserved amount.
instance/cpu/guest_visible_vcpu
Number of vCPUs visible inside the guest. For many GCE machine types, the number of vCPUs visible inside the guest is equal to the
compute.googleapis.com/instance/cpu/reserved_cores
metric. For shared-core machine types, the number of guest-visible vCPUs differs from the number of resereved cores. For example, e2-small instances have two vCPUs visible inside the guest and 0.5 fractional vCPUs reserved. Therefore, for an e2-small instance,compute.googleapis.com/instance/cpu/guest_visible_vcpus
has a value of 2 andcompute.googleapis.com/instance/cpu/reserved_cores
has a value of 0.5. Sampled every 60 seconds. After sampling, data is not visible for up to 240 seconds.
instance/cpu/reserved_cores
Number of vCPUs reserved on the host of the instance. Sampled every 60 seconds. After sampling, data is not visible for up to 240 seconds.