# Metricbeat cpu metricset: what is sample rate?

**URL:** <https://discuss.elastic.co/t/metricbeat-cpu-metricset-what-is-sample-rate/74679>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 10, 2017, 3:22pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-metricset-what-is-sample-rate/74679 "2017-02-10T15:22:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leigh](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@leigh](https://discuss.elastic.co/u/leigh)\
**Post date:** [February 10, 2017, 3:22pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-metricset-what-is-sample-rate/74679/1 "2017-02-10T15:22:12Z")

</div>

We can set the period of the cpu metricset using the metricbeat.yml config file (which I believe represents the frequency with which the metricset is run). What is the minimum value that can be set? is it one second. If this is the case then something must be going on under the hood to aggregate cpu samples which are happening much much more frequently than for example 1 per second.

Could someone explain what the sample rate or other mechanisms are as we need to be sure that we have high resolution cpu metrics?

Thx

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [February 10, 2017, 4:57pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-metricset-what-is-sample-rate/74679/2 "2017-02-10T16:57:29Z")

</div>

The [period](https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-metricbeat.html#_period) configuration option controls how often the metricset is executed (frequency = 1/period). As far as I know the only requirement on `period` is that the value must be greater than 0. The config value is a [duration](https://www.elastic.co/guide/en/beats/libbeat/current/config-file-format-type.html#_duration) which allows for the following unit types: ns, us, ms, s, m, h.

The OS is responsible for doing the CPU cycle accounting. Metricbeat is sampling the counters provided by the operating system (or reading timers on Windows).

So if you want a higher resolution samples of those counters you can decrease the `period`. If you set the period lower than the amount of time that it takes the metricset to execute one iteration then the metricset will be constantly running which won't be ideal. So take a look at the [`metricset.rtt`](https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-common.html#_metricset_rtt) value, which is the elapsed execution time for the collection operation, and keep the `period` above that value.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 10, 2017, 4:57pm UTC](https://discuss.elastic.co/t/metricbeat-cpu-metricset-what-is-sample-rate/74679/3 "2017-03-10T16:57:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
