flexmetric 0.4.3__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flexmetric-0.4.3 → flexmetric-0.5.0}/PKG-INFO +43 -12
- {flexmetric-0.4.3 → flexmetric-0.5.0}/README.md +42 -11
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/database_connections.py +3 -2
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/queries_execution.py +5 -9
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric.egg-info/PKG-INFO +43 -12
- {flexmetric-0.4.3 → flexmetric-0.5.0}/setup.py +1 -1
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/__init__.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/config/__init__.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/config/configuration.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/file_recognition/__init__.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/file_recognition/exec_file.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/logging_module/__init__.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/logging_module/logger.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/__init__.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/database_processing.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/expiring_queue.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/process_commands.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/prometheus_agent.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric/metric_process/views.py +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric.egg-info/SOURCES.txt +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric.egg-info/dependency_links.txt +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric.egg-info/entry_points.txt +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric.egg-info/requires.txt +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/flexmetric.egg-info/top_level.txt +0 -0
- {flexmetric-0.4.3 → flexmetric-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: flexmetric
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.0
|
4
4
|
Summary: A secure flexible Prometheus exporter for commands, databases, functions.
|
5
5
|
Home-page: https://github.com/nikhillingadhal1999/flexmetric
|
6
6
|
Author: Nikhil Lingadhal
|
@@ -189,21 +189,52 @@ Filesystem Size Used Avail Use% Mounted on
|
|
189
189
|
| `timeout_seconds` | Maximum time (in seconds) to wait for the command to complete. If it exceeds this time, the command is aborted. |
|
190
190
|
|
191
191
|
## Database mode
|
192
|
-
|
192
|
+
file - database.yaml
|
193
193
|
```yaml
|
194
194
|
databases:
|
195
|
-
-
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
- id: "active_user_count"
|
196
|
+
type: "clickhouse"
|
197
|
+
host: "localhost"
|
198
|
+
port: 8123
|
199
|
+
username: "default"
|
200
|
+
password: ""
|
201
|
+
client_cert: ""
|
202
|
+
client_key: ""
|
203
|
+
ca_cert: ""
|
204
|
+
|
205
|
+
- id: "userdb"
|
206
|
+
type: "sqlite"
|
207
|
+
db_connection: "/path/to/my.db"
|
208
|
+
```
|
209
|
+
file - queries.yaml
|
199
210
|
```yaml
|
200
211
|
commands:
|
201
|
-
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
212
|
+
- id: "active_user_count"
|
213
|
+
type: "clickhouse"
|
214
|
+
database_id: "active_user_count"
|
215
|
+
query: |
|
216
|
+
SELECT
|
217
|
+
country AS country_name,
|
218
|
+
COUNT() AS active_user_count
|
219
|
+
FROM users
|
220
|
+
WHERE is_active = 1
|
221
|
+
GROUP BY country
|
222
|
+
main_label: "active_user_count"
|
223
|
+
labels: ["country_name"]
|
224
|
+
value_column: "active_user_count"
|
225
|
+
|
226
|
+
- id: "list_all_users_sqlite"
|
227
|
+
type: "sqlite"
|
228
|
+
database_id: "userdb"
|
229
|
+
query: |
|
230
|
+
SELECT
|
231
|
+
id,
|
232
|
+
name
|
233
|
+
FROM users
|
234
|
+
main_label: "user_list"
|
235
|
+
labels: ["id", "name"]
|
236
|
+
value_column: "id"
|
237
|
+
|
207
238
|
```
|
208
239
|
## Functions mode
|
209
240
|
|
@@ -155,21 +155,52 @@ Filesystem Size Used Avail Use% Mounted on
|
|
155
155
|
| `timeout_seconds` | Maximum time (in seconds) to wait for the command to complete. If it exceeds this time, the command is aborted. |
|
156
156
|
|
157
157
|
## Database mode
|
158
|
-
|
158
|
+
file - database.yaml
|
159
159
|
```yaml
|
160
160
|
databases:
|
161
|
-
-
|
162
|
-
|
163
|
-
|
164
|
-
|
161
|
+
- id: "active_user_count"
|
162
|
+
type: "clickhouse"
|
163
|
+
host: "localhost"
|
164
|
+
port: 8123
|
165
|
+
username: "default"
|
166
|
+
password: ""
|
167
|
+
client_cert: ""
|
168
|
+
client_key: ""
|
169
|
+
ca_cert: ""
|
170
|
+
|
171
|
+
- id: "userdb"
|
172
|
+
type: "sqlite"
|
173
|
+
db_connection: "/path/to/my.db"
|
174
|
+
```
|
175
|
+
file - queries.yaml
|
165
176
|
```yaml
|
166
177
|
commands:
|
167
|
-
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
178
|
+
- id: "active_user_count"
|
179
|
+
type: "clickhouse"
|
180
|
+
database_id: "active_user_count"
|
181
|
+
query: |
|
182
|
+
SELECT
|
183
|
+
country AS country_name,
|
184
|
+
COUNT() AS active_user_count
|
185
|
+
FROM users
|
186
|
+
WHERE is_active = 1
|
187
|
+
GROUP BY country
|
188
|
+
main_label: "active_user_count"
|
189
|
+
labels: ["country_name"]
|
190
|
+
value_column: "active_user_count"
|
191
|
+
|
192
|
+
- id: "list_all_users_sqlite"
|
193
|
+
type: "sqlite"
|
194
|
+
database_id: "userdb"
|
195
|
+
query: |
|
196
|
+
SELECT
|
197
|
+
id,
|
198
|
+
name
|
199
|
+
FROM users
|
200
|
+
main_label: "user_list"
|
201
|
+
labels: ["id", "name"]
|
202
|
+
value_column: "id"
|
203
|
+
|
173
204
|
```
|
174
205
|
## Functions mode
|
175
206
|
|
@@ -15,7 +15,7 @@ def create_clickhouse_client(db_conf):
|
|
15
15
|
password = db_conf.get('password', '')
|
16
16
|
|
17
17
|
client_cert = db_conf.get('client_cert')
|
18
|
-
client_cert_key = db_conf.get('
|
18
|
+
client_cert_key = db_conf.get('client_key')
|
19
19
|
ca_cert = db_conf.get('ca_cert')
|
20
20
|
|
21
21
|
secure = bool(client_cert and client_cert_key and ca_cert)
|
@@ -26,13 +26,14 @@ def create_clickhouse_client(db_conf):
|
|
26
26
|
'username': username,
|
27
27
|
'password': password,
|
28
28
|
'secure': secure,
|
29
|
+
'verify': True
|
29
30
|
}
|
30
31
|
|
31
32
|
if secure:
|
32
33
|
settings.update({
|
33
34
|
'client_cert': client_cert,
|
34
35
|
'client_cert_key': client_cert_key,
|
35
|
-
'
|
36
|
+
'ca_cert': ca_cert,
|
36
37
|
})
|
37
38
|
|
38
39
|
client = clickhouse_connect.get_client(**settings)
|
@@ -12,17 +12,13 @@ def execute_clickhouse_command(client, command: str):
|
|
12
12
|
except Exception as e:
|
13
13
|
logger.error(f"Error executing command: {e}")
|
14
14
|
return None
|
15
|
-
def execute_sqlite_query(conn,query):
|
15
|
+
def execute_sqlite_query(conn, query):
|
16
16
|
try:
|
17
17
|
cursor = conn.cursor()
|
18
18
|
cursor.execute(query)
|
19
|
-
|
19
|
+
rows = cursor.fetchall()
|
20
20
|
column_names = [desc[0] for desc in cursor.description]
|
21
|
-
|
22
|
-
return float(result[0]) if result and result[0] is not None else None , column_names
|
21
|
+
return rows, column_names
|
23
22
|
except Exception as ex:
|
24
|
-
logger.error(f"Exception : {ex}")
|
25
|
-
return
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
logger.error(f"Exception during SQLite query: {ex}")
|
24
|
+
return [], []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: flexmetric
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.0
|
4
4
|
Summary: A secure flexible Prometheus exporter for commands, databases, functions.
|
5
5
|
Home-page: https://github.com/nikhillingadhal1999/flexmetric
|
6
6
|
Author: Nikhil Lingadhal
|
@@ -189,21 +189,52 @@ Filesystem Size Used Avail Use% Mounted on
|
|
189
189
|
| `timeout_seconds` | Maximum time (in seconds) to wait for the command to complete. If it exceeds this time, the command is aborted. |
|
190
190
|
|
191
191
|
## Database mode
|
192
|
-
|
192
|
+
file - database.yaml
|
193
193
|
```yaml
|
194
194
|
databases:
|
195
|
-
-
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
- id: "active_user_count"
|
196
|
+
type: "clickhouse"
|
197
|
+
host: "localhost"
|
198
|
+
port: 8123
|
199
|
+
username: "default"
|
200
|
+
password: ""
|
201
|
+
client_cert: ""
|
202
|
+
client_key: ""
|
203
|
+
ca_cert: ""
|
204
|
+
|
205
|
+
- id: "userdb"
|
206
|
+
type: "sqlite"
|
207
|
+
db_connection: "/path/to/my.db"
|
208
|
+
```
|
209
|
+
file - queries.yaml
|
199
210
|
```yaml
|
200
211
|
commands:
|
201
|
-
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
212
|
+
- id: "active_user_count"
|
213
|
+
type: "clickhouse"
|
214
|
+
database_id: "active_user_count"
|
215
|
+
query: |
|
216
|
+
SELECT
|
217
|
+
country AS country_name,
|
218
|
+
COUNT() AS active_user_count
|
219
|
+
FROM users
|
220
|
+
WHERE is_active = 1
|
221
|
+
GROUP BY country
|
222
|
+
main_label: "active_user_count"
|
223
|
+
labels: ["country_name"]
|
224
|
+
value_column: "active_user_count"
|
225
|
+
|
226
|
+
- id: "list_all_users_sqlite"
|
227
|
+
type: "sqlite"
|
228
|
+
database_id: "userdb"
|
229
|
+
query: |
|
230
|
+
SELECT
|
231
|
+
id,
|
232
|
+
name
|
233
|
+
FROM users
|
234
|
+
main_label: "user_list"
|
235
|
+
labels: ["id", "name"]
|
236
|
+
value_column: "id"
|
237
|
+
|
207
238
|
```
|
208
239
|
## Functions mode
|
209
240
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="flexmetric",
|
5
|
-
version="0.
|
5
|
+
version="0.5.0",
|
6
6
|
author="Nikhil Lingadhal",
|
7
7
|
description="A secure flexible Prometheus exporter for commands, databases, functions.",
|
8
8
|
long_description=open("README.md").read(),
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|