@cryptotaxi247 / netdata-1 / commits / 76ba49765

remove python.d/springboot (#14075)

Ilya Mashchenko committed Dec 1, 2022 at 12:28 UTC 76ba49765eb5e9682ba2fb6bc11df1d320a1d63a
7 files changed +1 -441
collectors/COLLECTORS.md
+1 -3
@@ -84,10 +84,8 @@ configure any of these collectors according to your setup and infrastructure.
84 - [Go applications](/collectors/python.d.plugin/go_expvar/README.md): Monitor any Go application that exposes its
85 metrics with the `expvar` package from the Go standard library.
86 - [Java Spring Boot 2
87 - applications](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/springboot2/) (Go version):
87 + applications](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/springboot2/):
88 Monitor running Java Spring Boot 2 applications that expose their metrics with the use of the Spring Boot Actuator.
89 -- [Java Spring Boot 2 applications](/collectors/python.d.plugin/springboot/README.md) (Python version): Monitor
90 - running Java Spring Boot applications that expose their metrics with the use of the Spring Boot Actuator.
89 - [statsd](/collectors/statsd.plugin/README.md): Implement a high performance `statsd` server for Netdata.
90 - [phpDaemon](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/phpdaemon/): Collect worker
91 statistics (total, active, idle), and uptime for web and network applications.
collectors/python.d.plugin/Makefile.am
-1
@@ -83,7 +83,6 @@ include samba/Makefile.inc
83 include sensors/Makefile.inc
84 include smartd_log/Makefile.inc
85 include spigotmc/Makefile.inc
86 -include springboot/Makefile.inc
86 include squid/Makefile.inc
87 include tomcat/Makefile.inc
88 include tor/Makefile.inc
collectors/python.d.plugin/python.d.conf
-1
@@ -73,7 +73,6 @@ logind: no
73 # sensors: yes
74 # smartd_log: yes
75 # spigotmc: yes
76 -# springboot: yes
76 # squid: yes
77 # traefik: yes
78 # tomcat: yes
collectors/python.d.plugin/springboot/Makefile.inc deleted
-13
@@ -1,13 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -# THIS IS NOT A COMPLETE Makefile
4 -# IT IS INCLUDED BY ITS PARENT'S Makefile.am
5 -# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
6 -
7 -# install these files
8 -dist_python_DATA += springboot/springboot.chart.py
9 -dist_pythonconfig_DATA += springboot/springboot.conf
10 -
11 -# do not install these files, but include them in the distribution
12 -dist_noinst_DATA += springboot/README.md springboot/Makefile.inc
13 -
collectors/python.d.plugin/springboot/README.md deleted
-145
@@ -1,145 +0,0 @@
1 -<!--
2 -title: "Java Spring Boot 2 application monitoring with Netdata"
3 -custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/springboot/README.md
4 -sidebar_label: "Java Spring Boot 2 applications"
5 --->
6 -
7 -# Java Spring Boot 2 application monitoring with Netdata
8 -
9 -Monitors one or more Java Spring-boot applications depending on configuration.
10 -Netdata can be used to monitor running Java [Spring Boot](https://spring.io/) applications that expose their metrics with the use of the **Spring Boot Actuator** included in Spring Boot library.
11 -
12 -## Configuration
13 -
14 -The Spring Boot Actuator exposes these metrics over HTTP and is very easy to use:
15 -
16 -- add `org.springframework.boot:spring-boot-starter-actuator` to your application dependencies
17 -- set `endpoints.metrics.sensitive=false` in your `application.properties`
18 -
19 -You can create custom Metrics by add and inject a PublicMetrics in your application.
20 -This is a example to add custom metrics:
21 -
22 -```java
23 -package com.example;
24 -
25 -import org.springframework.boot.actuate.endpoint.PublicMetrics;
26 -import org.springframework.boot.actuate.metrics.Metric;
27 -import org.springframework.stereotype.Service;
28 -
29 -import java.lang.management.ManagementFactory;
30 -import java.lang.management.MemoryPoolMXBean;
31 -import java.util.ArrayList;
32 -import java.util.Collection;
33 -
34 -@Service
35 -public class HeapPoolMetrics implements PublicMetrics {
36 -
37 - private static final String PREFIX = "mempool.";
38 - private static final String KEY_EDEN = PREFIX + "eden";
39 - private static final String KEY_SURVIVOR = PREFIX + "survivor";
40 - private static final String KEY_TENURED = PREFIX + "tenured";
41 -
42 - @Override
43 - public Collection<Metric<?>> metrics() {
44 - Collection<Metric<?>> result = new ArrayList<>(4);
45 - for (MemoryPoolMXBean mem : ManagementFactory.getMemoryPoolMXBeans()) {
46 - String poolName = mem.getName();
47 - String name = null;
48 - if (poolName.indexOf("Eden Space") != -1) {
49 - name = KEY_EDEN;
50 - } else if (poolName.indexOf("Survivor Space") != -1) {
51 - name = KEY_SURVIVOR;
52 - } else if (poolName.indexOf("Tenured Gen") != -1 || poolName.indexOf("Old Gen") != -1) {
53 - name = KEY_TENURED;
54 - }
55 -
56 - if (name != null) {
57 - result.add(newMemoryMetric(name, mem.getUsage().getMax()));
58 - result.add(newMemoryMetric(name + ".init", mem.getUsage().getInit()));
59 - result.add(newMemoryMetric(name + ".committed", mem.getUsage().getCommitted()));
60 - result.add(newMemoryMetric(name + ".used", mem.getUsage().getUsed()));
61 - }
62 - }
63 - return result;
64 - }
65 -
66 - private Metric<Long> newMemoryMetric(String name, long bytes) {
67 - return new Metric<>(name, bytes / 1024);
68 - }
69 -}
70 -```
71 -
72 -Please refer [Spring Boot Actuator: Production-ready Features](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready) and [81. Actuator - Part IX. ‘How-to’ guides](https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-actuator) for more information.
73 -
74 -## Charts
75 -
76 -1. **Response Codes** in requests/s
77 -
78 - - 1xx
79 - - 2xx
80 - - 3xx
81 - - 4xx
82 - - 5xx
83 - - others
84 -
85 -2. **Threads**
86 -
87 - - daemon
88 - - total
89 -
90 -3. **GC Time** in milliseconds and **GC Operations** in operations/s
91 -
92 - - Copy
93 - - MarkSweep
94 - - ...
95 -
96 -4. **Heap Memory Usage** in KB
97 -
98 - - used
99 - - committed
100 -
101 -## Usage
102 -
103 -Edit the `python.d/springboot.conf` configuration file using `edit-config` from the Netdata [config
104 -directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`.
105 -
106 -```bash
107 -cd /etc/netdata # Replace this path with your Netdata config directory, if different
108 -sudo ./edit-config python.d/springboot.conf
109 -```
110 -
111 -This module defines some common charts, and you can add custom charts by change the configurations.
112 -
113 -The configuration format is like:
114 -
115 -```yaml
116 -<id>:
117 - name: '<name>'
118 - url: '<metrics endpoint>' # ex. http://localhost:8080/metrics
119 - user: '<username>' # optional
120 - pass: '<password>' # optional
121 - defaults:
122 - [<chart-id>]: true|false
123 - extras:
124 - - id: '<chart-id>'
125 - options:
126 - title: '***'
127 - units: '***'
128 - family: '***'
129 - context: 'springboot.***'
130 - charttype: 'stacked' | 'area' | 'line'
131 - lines:
132 - - { dimension: 'myapp_ok', name: 'ok', algorithm: 'absolute', multiplier: 1, divisor: 1} # it shows "myapp.ok" metrics
133 - - { dimension: 'myapp_ng', name: 'ng', algorithm: 'absolute', multiplier: 1, divisor: 1} # it shows "myapp.ng" metrics
134 -```
135 -
136 -By default, it creates `response_code`, `threads`, `gc_time`, `gc_ope` abd `heap` charts.
137 -You can disable the default charts by set `defaults.<chart-id>: false`.
138 -
139 -The dimension name of extras charts should replace `.` to `_`.
140 -
141 -Please check
142 -[springboot.conf](https://raw.githubusercontent.com/netdata/netdata/master/collectors/python.d.plugin/springboot/springboot.conf)
143 -for more examples.
144 -
145 -
collectors/python.d.plugin/springboot/springboot.chart.py deleted
-160
@@ -1,160 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: tomcat netdata python.d module
3 -# Author: Wing924
4 -# SPDX-License-Identifier: GPL-3.0-or-later
5 -
6 -import json
7 -
8 -from bases.FrameworkServices.UrlService import UrlService
9 -
10 -DEFAULT_ORDER = [
11 - 'response_code',
12 - 'threads',
13 - 'gc_time',
14 - 'gc_ope',
15 - 'heap',
16 -]
17 -
18 -DEFAULT_CHARTS = {
19 - 'response_code': {
20 - 'options': [None, "Response Codes", "requests/s", "response", "springboot.response_code", "stacked"],
21 - 'lines': [
22 - ["resp_other", 'Other', 'incremental'],
23 - ["resp_1xx", '1xx', 'incremental'],
24 - ["resp_2xx", '2xx', 'incremental'],
25 - ["resp_3xx", '3xx', 'incremental'],
26 - ["resp_4xx", '4xx', 'incremental'],
27 - ["resp_5xx", '5xx', 'incremental'],
28 - ]
29 - },
30 - 'threads': {
31 - 'options': [None, "Threads", "current threads", "threads", "springboot.threads", "area"],
32 - 'lines': [
33 - ["threads_daemon", 'daemon', 'absolute'],
34 - ["threads", 'total', 'absolute'],
35 - ]
36 - },
37 - 'gc_time': {
38 - 'options': [None, "GC Time", "milliseconds", "garbage collection", "springboot.gc_time", "stacked"],
39 - 'lines': [
40 - ["gc_copy_time", 'Copy', 'incremental'],
41 - ["gc_marksweepcompact_time", 'MarkSweepCompact', 'incremental'],
42 - ["gc_parnew_time", 'ParNew', 'incremental'],
43 - ["gc_concurrentmarksweep_time", 'ConcurrentMarkSweep', 'incremental'],
44 - ["gc_ps_scavenge_time", 'PS Scavenge', 'incremental'],
45 - ["gc_ps_marksweep_time", 'PS MarkSweep', 'incremental'],
46 - ["gc_g1_young_generation_time", 'G1 Young Generation', 'incremental'],
47 - ["gc_g1_old_generation_time", 'G1 Old Generation', 'incremental'],
48 - ]
49 - },
50 - 'gc_ope': {
51 - 'options': [None, "GC Operations", "operations/s", "garbage collection", "springboot.gc_ope", "stacked"],
52 - 'lines': [
53 - ["gc_copy_count", 'Copy', 'incremental'],
54 - ["gc_marksweepcompact_count", 'MarkSweepCompact', 'incremental'],
55 - ["gc_parnew_count", 'ParNew', 'incremental'],
56 - ["gc_concurrentmarksweep_count", 'ConcurrentMarkSweep', 'incremental'],
57 - ["gc_ps_scavenge_count", 'PS Scavenge', 'incremental'],
58 - ["gc_ps_marksweep_count", 'PS MarkSweep', 'incremental'],
59 - ["gc_g1_young_generation_count", 'G1 Young Generation', 'incremental'],
60 - ["gc_g1_old_generation_count", 'G1 Old Generation', 'incremental'],
61 - ]
62 - },
63 - 'heap': {
64 - 'options': [None, "Heap Memory Usage", "KiB", "heap memory", "springboot.heap", "area"],
65 - 'lines': [
66 - ["heap_committed", 'committed', "absolute"],
67 - ["heap_used", 'used', "absolute"],
68 - ]
69 - }
70 -}
71 -
72 -
73 -class ExtraChartError(ValueError):
74 - pass
75 -
76 -
77 -class Service(UrlService):
78 - def __init__(self, configuration=None, name=None):
79 - UrlService.__init__(self, configuration=configuration, name=name)
80 - self.url = self.configuration.get('url', "http://localhost:8080/metrics")
81 - self._setup_charts()
82 -
83 - def _get_data(self):
84 - """
85 - Format data received from http request
86 - :return: dict
87 - """
88 - raw_data = self._get_raw_data()
89 - if not raw_data:
90 - return None
91 -
92 - try:
93 - data = json.loads(raw_data)
94 - except ValueError:
95 - self.debug('%s is not a valid JSON page' % self.url)
96 - return None
97 -
98 - result = {
99 - 'resp_1xx': 0,
100 - 'resp_2xx': 0,
101 - 'resp_3xx': 0,
102 - 'resp_4xx': 0,
103 - 'resp_5xx': 0,
104 - 'resp_other': 0,
105 - }
106 -
107 - for key, value in data.iteritems():
108 - if 'counter.status.' in key:
109 - status_type = key[15:16] + 'xx'
110 - if status_type[0] not in '12345':
111 - status_type = 'other'
112 - result['resp_' + status_type] += value
113 - else:
114 - result[key.replace('.', '_')] = value
115 -
116 - return result or None
117 -
118 - def _setup_charts(self):
119 - self.order = []
120 - self.definitions = {}
121 - defaults = self.configuration.get('defaults', {})
122 -
123 - for chart in DEFAULT_ORDER:
124 - if defaults.get(chart, True):
125 - self.order.append(chart)
126 - self.definitions[chart] = DEFAULT_CHARTS[chart]
127 -
128 - for extra in self.configuration.get('extras', []):
129 - self._add_extra_chart(extra)
130 - self.order.append(extra['id'])
131 -
132 - def _add_extra_chart(self, chart):
133 - chart_id = chart.get('id', None) or self.die('id is not defined in extra chart')
134 - options = chart.get('options', None) or self.die('option is not defined in extra chart: %s' % chart_id)
135 - lines = chart.get('lines', None) or self.die('lines is not defined in extra chart: %s' % chart_id)
136 -
137 - title = options.get('title', None) or self.die('title is missing: %s' % chart_id)
138 - units = options.get('units', None) or self.die('units is missing: %s' % chart_id)
139 - family = options.get('family', title)
140 - context = options.get('context', 'springboot.' + title)
141 - charttype = options.get('charttype', 'line')
142 -
143 - result = {
144 - 'options': [None, title, units, family, context, charttype],
145 - 'lines': [],
146 - }
147 -
148 - for line in lines:
149 - dimension = line.get('dimension', None) or self.die('dimension is missing: %s' % chart_id)
150 - name = line.get('name', dimension)
151 - algorithm = line.get('algorithm', 'absolute')
152 - multiplier = line.get('multiplier', 1)
153 - divisor = line.get('divisor', 1)
154 - result['lines'].append([dimension, name, algorithm, multiplier, divisor])
155 -
156 - self.definitions[chart_id] = result
157 -
158 - @staticmethod
159 - def die(error_message):
160 - raise ExtraChartError(error_message)
collectors/python.d.plugin/springboot/springboot.conf deleted
-118
@@ -1,118 +0,0 @@
1 -# netdata python.d.plugin configuration for springboot
2 -#
3 -# This file is in YaML format. Generally the format is:
4 -#
5 -# name: value
6 -#
7 -# There are 2 sections:
8 -# - global variables
9 -# - one or more JOBS
10 -#
11 -# JOBS allow you to collect values from multiple sources.
12 -# Each source will have its own set of charts.
13 -#
14 -# JOB parameters have to be indented (using spaces only, example below).
15 -
16 -# ----------------------------------------------------------------------
17 -# Global Variables
18 -# These variables set the defaults for all JOBs, however each JOB
19 -# may define its own, overriding the defaults.
20 -
21 -# update_every sets the default data collection frequency.
22 -# If unset, the python.d.plugin default is used.
23 -# update_every: 1
24 -
25 -# priority controls the order of charts at the netdata dashboard.
26 -# Lower numbers move the charts towards the top of the page.
27 -# If unset, the default for python.d.plugin is used.
28 -# priority: 60000
29 -
30 -# penalty indicates whether to apply penalty to update_every in case of failures.
31 -# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes.
32 -# penalty: yes
33 -
34 -# autodetection_retry sets the job re-check interval in seconds.
35 -# The job is not deleted if check fails.
36 -# Attempts to start the job are made once every autodetection_retry.
37 -# This feature is disabled by default.
38 -# autodetection_retry: 0
39 -
40 -# ----------------------------------------------------------------------
41 -# JOBS (data collection sources)
42 -#
43 -# Any number of jobs is supported.
44 -#
45 -# All python.d.plugin JOBS (for all its modules) support a set of
46 -# predefined parameters. These are:
47 -#
48 -# job_name:
49 -# name: myname # the JOB's name as it will appear at the
50 -# # dashboard (by default is the job_name)
51 -# # JOBs sharing a name are mutually exclusive
52 -# update_every: 1 # the JOB's data collection frequency
53 -# priority: 60000 # the JOB's order on the dashboard
54 -# penalty: yes # the JOB's penalty
55 -# autodetection_retry: 0 # the JOB's re-check interval in seconds
56 -#
57 -# Additionally to the above, this plugin also supports the following:
58 -#
59 -# url: 'http://127.0.0.1/metrics' # the URL of the spring boot actuator metrics
60 -#
61 -# if the URL is password protected, the following are supported:
62 -#
63 -# user: 'username'
64 -# pass: 'password'
65 -#
66 -# defaults:
67 -# [chart_id]: true | false # enables/disables default charts, defaults true.
68 -# extras: {} # defines extra charts to monitor, please see the example below
69 -# - id: [chart_id]
70 -# options: {}
71 -# lines: []
72 -#
73 -# If all defaults is disabled and no extra charts are defined, this module will disable itself, as it has no data to
74 -# collect.
75 -#
76 -# Configuration example
77 -# ---------------------
78 -# example:
79 -# name: 'example'
80 -# url: 'http://localhost:8080/metrics'
81 -# defaults:
82 -# response_code: true
83 -# threads: true
84 -# gc_time: true
85 -# gc_ope: true
86 -# heap: false
87 -# extras:
88 -# - id: 'heap'
89 -# options: { title: 'Heap Memory Usage', units: 'KB', family: 'heap memory', context: 'springboot.heap', charttype: 'stacked' }
90 -# lines:
91 -# - { dimension: 'mem_free', name: 'free'}
92 -# - { dimension: 'mempool_eden_used', name: 'eden', algorithm: 'absolute', multiplier: 1, divisor: 1}
93 -# - { dimension: 'mempool_survivor_used', name: 'survivor', algorithm: 'absolute', multiplier: 1, divisor: 1}
94 -# - { dimension: 'mempool_tenured_used', name: 'tenured', algorithm: 'absolute', multiplier: 1, divisor: 1}
95 -# - id: 'heap_eden'
96 -# options: { title: 'Eden Memory Usage', units: 'KB', family: 'heap memory', context: 'springboot.heap_eden', charttype: 'area' }
97 -# lines:
98 -# - { dimension: 'mempool_eden_used', name: 'used'}
99 -# - { dimension: 'mempool_eden_committed', name: 'committed'}
100 -# - id: 'heap_survivor'
101 -# options: { title: 'Survivor Memory Usage', units: 'KB', family: 'heap memory', context: 'springboot.heap_survivor', charttype: 'area' }
102 -# lines:
103 -# - { dimension: 'mempool_survivor_used', name: 'used'}
104 -# - { dimension: 'mempool_survivor_committed', name: 'committed'}
105 -# - id: 'heap_tenured'
106 -# options: { title: 'Tenured Memory Usage', units: 'KB', family: 'heap memory', context: 'springboot.heap_tenured', charttype: 'area' }
107 -# lines:
108 -# - { dimension: 'mempool_tenured_used', name: 'used'}
109 -# - { dimension: 'mempool_tenured_committed', name: 'committed'}
110 -
111 -
112 -local:
113 - name: 'local'
114 - url: 'http://localhost:8080/metrics'
115 -
116 -local_ip:
117 - name: 'local'
118 - url: 'http://127.0.0.1:8080/metrics'