summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/go_expvar/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin/go_expvar/README.md')
-rw-r--r--collectors/python.d.plugin/go_expvar/README.md120
1 files changed, 70 insertions, 50 deletions
diff --git a/collectors/python.d.plugin/go_expvar/README.md b/collectors/python.d.plugin/go_expvar/README.md
index 3942a7be8..7d78fabd0 100644
--- a/collectors/python.d.plugin/go_expvar/README.md
+++ b/collectors/python.d.plugin/go_expvar/README.md
@@ -7,28 +7,34 @@ The `go_expvar` module can monitor any Go application that exposes its metrics w
For the memory statistics, it produces the following charts:
-1. **Heap allocations** in kB
- * alloc: size of objects allocated on the heap
- * inuse: size of allocated heap spans
+1. **Heap allocations** in kB
-2. **Stack allocations** in kB
- * inuse: size of allocated stack spans
+ - alloc: size of objects allocated on the heap
+ - inuse: size of allocated heap spans
-3. **MSpan allocations** in kB
- * inuse: size of allocated mspan structures
+2. **Stack allocations** in kB
-4. **MCache allocations** in kB
- * inuse: size of allocated mcache structures
+ - inuse: size of allocated stack spans
-5. **Virtual memory** in kB
- * sys: size of reserved virtual address space
+3. **MSpan allocations** in kB
-6. **Live objects**
- * live: number of live objects in memory
+ - inuse: size of allocated mspan structures
-7. **GC pauses average** in ns
- * avg: average duration of all GC stop-the-world pauses
+4. **MCache allocations** in kB
+ - inuse: size of allocated mcache structures
+
+5. **Virtual memory** in kB
+
+ - sys: size of reserved virtual address space
+
+6. **Live objects**
+
+ - live: number of live objects in memory
+
+7. **GC pauses average** in ns
+
+ - avg: average duration of all GC stop-the-world pauses
## Monitoring Go Applications
@@ -102,9 +108,9 @@ Apart from the runtime memory stats, this application publishes two counters and
number of currently running Goroutines and updates these stats every second.
In the next section, we will cover how to monitor and chart these exposed stats with
-the use of `netdata`s ```go_expvar``` module.
+the use of `netdata`s `go_expvar` module.
-### Using netdata go_expvar module
+### Using Netdata go_expvar module
The `go_expvar` module is disabled by default. To enable it, edit [`python.d.conf`](../python.d.conf)
(to edit it on your system run `/etc/netdata/edit-config python.d.conf`), and change the `go_expvar`
@@ -141,22 +147,30 @@ app1:
Let's go over each of the defined options:
- name: 'app1'
+```
+name: 'app1'
+```
-This is the job name that will appear at the netdata dashboard.
+This is the job name that will appear at the Netdata dashboard.
If not defined, the job_name (top level key) will be used.
- url: 'http://127.0.0.1:8080/debug/vars'
+```
+url: 'http://127.0.0.1:8080/debug/vars'
+```
This is the URL of the expvar endpoint. As the expvar handler can be installed
in a custom path, the whole URL has to be specified. This value is mandatory.
- collect_memstats: true
+```
+collect_memstats: true
+```
Whether to enable collecting stats about Go runtime's memory. You can find more
information about the exposed values at the [runtime package docs](https://golang.org/pkg/runtime/#MemStats).
- extra_charts: {}
+```
+extra_charts: {}
+```
Enables the user to specify custom expvars to monitor and chart.
Will be explained in more detail below.
@@ -164,52 +178,58 @@ Will be explained in more detail below.
**Note: if `collect_memstats` is disabled and no `extra_charts` are defined, the plugin will
disable itself, as there will be no data to collect!**
-Apart from these options, each job supports options inherited from netdata's `python.d.plugin`
+Apart from these options, each job supports options inherited from Netdata's `python.d.plugin`
and its base `UrlService` class. These are:
- update_every: 1 # the job's data collection frequency
- priority: 60000 # the job's order on the dashboard
- user: admin # use when the expvar endpoint is protected by HTTP Basic Auth
- password: sekret # use when the expvar endpoint is protected by HTTP Basic Auth
+```
+update_every: 1 # the job's data collection frequency
+priority: 60000 # the job's order on the dashboard
+user: admin # use when the expvar endpoint is protected by HTTP Basic Auth
+password: sekret # use when the expvar endpoint is protected by HTTP Basic Auth
+```
### Monitoring custom vars with go_expvar
-Now, memory stats might be useful, but what if you want netdata to monitor some custom values
+Now, memory stats might be useful, but what if you want Netdata to monitor some custom values
that your Go application exposes? The `go_expvar` module can do that as well with the use of
the `extra_charts` configuration variable.
-The `extra_charts` variable is a YaML list of netdata chart definitions.
+The `extra_charts` variable is a YaML list of Netdata chart definitions.
Each chart definition has the following keys:
- id: netdata chart ID
- options: a key-value mapping of chart options
- lines: a list of line definitions
+```
+id: Netdata chart ID
+options: a key-value mapping of chart options
+lines: a list of line definitions
+```
**Note: please do not use dots in the chart or line ID field.
See [this issue](https://github.com/netdata/netdata/pull/1902#issuecomment-284494195) for explanation.**
-Please see these two links to the official netdata documentation for more information about the values:
+Please see these two links to the official Netdata documentation for more information about the values:
-- [External plugins - charts](../../plugins.d/#chart)
-- [Chart variables](../#global-variables-order-and-chart)
+- [External plugins - charts](../../plugins.d/#chart)
+- [Chart variables](../#global-variables-order-and-chart)
**Line definitions**
Each chart can define multiple lines (dimensions).
A line definition is a key-value mapping of line options.
Each line can have the following options:
-
- # mandatory
- expvar_key: the name of the expvar as present in the JSON output of /debug/vars endpoint
- expvar_type: value type; supported are "float" or "int"
- id: the id of this line/dimension in netdata
-
- # optional - netdata defaults are used if these options are not defined
- name: ''
- algorithm: absolute
- multiplier: 1
- divisor: 100 if expvar_type == float, 1 if expvar_type == int
- hidden: False
+
+```
+# mandatory
+expvar_key: the name of the expvar as present in the JSON output of /debug/vars endpoint
+expvar_type: value type; supported are "float" or "int"
+id: the id of this line/dimension in Netdata
+
+# optional - Netdata defaults are used if these options are not defined
+name: ''
+algorithm: absolute
+multiplier: 1
+divisor: 100 if expvar_type == float, 1 if expvar_type == int
+hidden: False
+```
Please see the following link for more information about the options and their default values:
[External plugins - dimensions](../../plugins.d/#dimension)
@@ -219,6 +239,7 @@ All dicts in the resulting JSON document are then flattened to one level.
Expvar names are joined together with '.' when flattening.
Example:
+
```
{
"counters": {"cnt1": 1042, "cnt2": 1512.9839999999983},
@@ -267,11 +288,10 @@ app1:
**Netdata charts example**
-The images below show how do the final charts in netdata look.
+The images below show how do the final charts in Netdata look.
![Memory stats charts](https://cloud.githubusercontent.com/assets/15180106/26762052/62b4af58-493b-11e7-9e69-146705acfc2c.png)
![Custom charts](https://cloud.githubusercontent.com/assets/15180106/26762051/62ae915e-493b-11e7-8518-bd25a3886650.png)
-
-[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fpython.d.plugin%2Fgo_expvar%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fpython.d.plugin%2Fgo_expvar%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)