# Doc bug for system.cpu.user.pct (and other pct)?

**URL:** <https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301>\
**Category:** Beats\
**Created:** [September 26, 2019, 7:00pm UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301 "2019-09-26T19:00:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![suryaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suryaj/32/48680_2.png) [@suryaj](https://discuss.elastic.co/u/suryaj)\
**Post date:** [September 26, 2019, 7:00pm UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301/1 "2019-09-26T19:00:36Z")

</div>

I got thrown off by the documentation here for system.cpu.user.pct.

> **[System fields | Metricbeat Reference \[8.11\] | Elastic](https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-system.html#_cpu_8)**

> The percentage of CPU time spent in user space. On multi-core systems, you can have percentages that are greater than 100%. For example, if 3 cores are at 60% use, then the `system.cpu.user.pct` will be 180%.

It seems to indicate the value is in percent. Looking at the [code](https://github.com/elastic/beats/blob/dd5938ed03d73c7578e91e42216b8fa948a63ecc/libbeat/metric/system/cpu/cpu.go#L114) though, it is clear that it is a decimal value and not a percent.

If we agree this is a doc bug, I am happy to submit a PR if someone can point me to the process for that.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [September 26, 2019, 8:45pm UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301/2 "2019-09-26T20:45:16Z")

</div>

Hi @suryaj welcome to the forum, and thanks for the close look.

I believe both the code and the docs are correct...

A percent is a float number that is a ratio of the part divided by the total possible. When that total percent 100% is represented as a float number between 0.0 and 1.0 When the total Percent is 300% is represented as a number between 0.0 and 3.0. So 80% is equal to .80 when represented as a float. If you were to represent that value as 80.0 that would really be 8000%

You can see this if you look at the source document and then look at the same document in discover.

Example Source from Dev Tools

```
GET /metricbeat-7.3.1/_doc/OwZAb20BjKA62DgGHqIA

{
  "_index" : "metricbeat-7.3.1-2019.09.18-000001",
  "_type" : "_doc",
  "_id" : "OwZAb20BjKA62DgGHqIA",
  "_version" : 1,
  "_seq_no" : 258823,
  "_primary_term" : 1,
  "found" : true,
  "_source" : {
    "@timestamp" : "2019-09-26T20:25:34.959Z",
    "service" : {
      "type" : "system"
    },
    "system" : {
      "process" : {
        "cmdline" : "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        "state" : "running",
        "cpu" : {
          "start_time" : "2019-09-20T15:14:53.688Z",
          "total" : {
            "pct" : 0.0852,
            "norm" : {
              "pct" : 0.0107
            },
            "value" : 1.3449285E7
          }
        },
        "memory" : {
          "rss" : {
            "bytes" : 391880704,
            "pct" : 0.0228
          },
          "share" : 0,
          "size" : 6627667968
        }
      }
    },

```

.......  
}

In discover, the Discover tab recognizes that they data type is a percent and thus makes it easier

 ![21%20PM](https://us1.discourse-cdn.com/elastic/original/3X/e/3/e3512f3cf03f1c963f3bfd412b91fc5e8e39b9cd.png)

You can even change you that is presented in the Settings -\> Advanced Settings

 ![50%20PM](https://us1.discourse-cdn.com/elastic/original/3X/e/c/ec956200c990106f19709fce136eee70aa4282dd.png)

---

<div class="post-metadata">

**Author:** ![suryaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suryaj/32/48680_2.png) [@suryaj](https://discuss.elastic.co/u/suryaj)\
**Post date:** [September 26, 2019, 11:03pm UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301/3 "2019-09-26T23:03:38Z")

</div>

Hi Stephen, appreciate your quick comment.

> A percent is a float number that is a ratio of the part divided by the total possible.

I am not sure where you are applying that definition from. Percent is a number that is expressed as a fraction of 100. What you are referring to above is what is generally called ratio. If the ratio is 0.5, the equivalent percent is 50%; similarly if the ratio is 0.05, the equivalent percent is 5%.

> When the total Percent is 300% is represented as a number between 0.0 and 3.0.

Are you saying this is how percentage values are represented in Elastic? This is in direct contrast to how it is referred in the doc I referred in the start of the thread, specifically this part:

> For example, if 3 cores are at 60% use, then the `system.cpu.user.pct` will be 180%.

Based on what you are saying (and what I am seeing in code), this should perhaps say

"For example, if 3 cores are at 60% use, then the `system.cpu.user.pct` will be 1.8."

This will make it consistent with the default experience that a user sees when they try to visualize the `system.cpu.user.pct` metric.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [September 27, 2019, 12:53am UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301/4 "2019-09-27T00:53:39Z")

</div>

Hi @suryaj

Thanks for the reply and apologies for any confusion...

I guess what I am saying is that I see no discrepancy between the document, the data stored in elastic or how it is represented in Kibana.

`1.8` and `180%` represent the same value and when speaking or documenting a percent. In general people write or display `180%` rather than `1.8` but when doing math or storing the data it is `1.8`

If you look at the raw data in Elasticsearch as I showed about you will see the `type: scaled_float 1.8` and when you look in Kibana it will recognized the `format: percent` and you will see 180%

So it make sense to me, but feel to write up an issue if you feel strongly about it.

---

<div class="post-metadata">

**Author:** ![suryaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suryaj/32/48680_2.png) [@suryaj](https://discuss.elastic.co/u/suryaj)\
**Post date:** [September 27, 2019, 11:08pm UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301/5 "2019-09-27T23:08:32Z")

</div>

Here is the default experience:

 ![VisualizeMetric](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0e74bae4249dd6a79e4e8d3e49f8636eafbd6777.png)

In this case the value stored and displayed are both 0.119 and I am not seeing what you are stating here:

> when you look in Kibana it will recognized the `format: percent` and you will see 180%

What am I missing? Our Kibana version is: 6.3.1 in case that has anything to do with this.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [September 28, 2019, 12:28am UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301/6 "2019-09-28T00:28:18Z")

</div>

Hi @suryaj

I stood up a 6.3.1 cluster here is what I see

Raw : Note the Float Representation `1.2058`

 ![12%20PM](https://us1.discourse-cdn.com/elastic/original/3X/c/d/cd9cfa7b3bd0e4986f4ade9e5d01cb687d59972b.png)

In Discover : Note the Percent Representation `120.58%`

 ![19%20PM](https://us1.discourse-cdn.com/elastic/original/3X/4/a/4a2ea78d0a59a62a392904264ca2862dcbcf4be1.png)

In the Data Table: Note the Percent Format

 ![38%20PM](https://us1.discourse-cdn.com/elastic/original/3X/c/d/cd1a9772072abbdcf1331e750ba74b4bb5dc1af0.png)

What I think may have happened is that the the `format:percent:defaultPattern` is not properly set the default is `0,0.[000]%` this is what is should look like under Management -\> Advanced Settings.

 ![07%20PM](https://us1.discourse-cdn.com/elastic/original/3X/1/6/1621459166b62059176a3854af64876bb2208f87.png)

Take a look and see what you see...

---

<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:** [October 26, 2019, 2:28am UTC](https://discuss.elastic.co/t/doc-bug-for-system-cpu-user-pct-and-other-pct/201301/7 "2019-10-26T02:28:20Z")

</div>

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