flexmetric 0.5.3__py3-none-any.whl → 0.5.4__py3-none-any.whl

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.
@@ -218,7 +218,10 @@ def measure(args):
218
218
  # print(label_dict)
219
219
 
220
220
  try:
221
- gauge.labels(**label_dict).set(convert_to_data_type(result["value"]))
221
+ if len(label_dict) > 0:
222
+ gauge.labels(**label_dict).set(convert_to_data_type(result["value"]))
223
+ else:
224
+ gauge.set(result["value"])
222
225
  except Exception as ex:
223
226
  logger.error(f"Failed to set gauge for labels {label_dict}: {ex}")
224
227
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexmetric
3
- Version: 0.5.3
3
+ Version: 0.5.4
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
@@ -22,6 +22,7 @@ Requires-Dist: twine
22
22
  Requires-Dist: flask
23
23
  Requires-Dist: clickhouse-connect
24
24
  Requires-Dist: psycopg2-binary
25
+ Requires-Dist: ollama
25
26
  Dynamic: author
26
27
  Dynamic: classifier
27
28
  Dynamic: description
@@ -141,7 +142,31 @@ curl -X POST http://localhost:5000/update_metric \
141
142
  "labels": ["metric_type", "core"],
142
143
  "main_label": "cpu_usage_metric"
143
144
  }'
145
+ ```
146
+ Python client
147
+ ```python
148
+ import requests
149
+ import json
150
+
151
+ url = "http://localhost:5000/update_metric"
152
+ headers = {
153
+ "Content-Type": "application/json"
154
+ }
155
+ data = {
156
+ "result": [
157
+ {
158
+ "label": ["cpu", "core_1"],
159
+ "value": 42.5
160
+ }
161
+ ],
162
+ "labels": ["metric_type", "core"],
163
+ "main_label": "cpu_usage_metric"
164
+ }
165
+
166
+ response = requests.post(url, headers=headers, data=json.dumps(data))
144
167
 
168
+ print(f"Status Code: {response.status_code}")
169
+ print("Response:", response.text)
145
170
  ```
146
171
 
147
172
  ### Using flex metrics in secure mode
@@ -10,11 +10,11 @@ flexmetric/metric_process/database_connections.py,sha256=Pa_Lcs8Im6pZxmET2pQRR3-
10
10
  flexmetric/metric_process/database_processing.py,sha256=Sbbk-ktdUSx7zFpjaJdC_8L6r61d82t4VKGOr7oAlB0,5066
11
11
  flexmetric/metric_process/expiring_queue.py,sha256=1oC0MjloitPiRo7yDgVarz81ETEQavKI_W-GFUvp5_Y,1920
12
12
  flexmetric/metric_process/process_commands.py,sha256=clGMQhLNcuJUO1gElpAS9Dyk0KU5w41DIguczjo7ceA,4089
13
- flexmetric/metric_process/prometheus_agent.py,sha256=pDPqiPtHLv1cfF6dPRNg2LtAhVF1UKf8MNZ_S9xuRQY,7712
13
+ flexmetric/metric_process/prometheus_agent.py,sha256=9M6WN-iXKtE5LkweuRH96MwuwLcPh89pRG5YoYhK4Vo,7825
14
14
  flexmetric/metric_process/queries_execution.py,sha256=ed8GnWbBdvCb7WfQOmeJdpR0DarF_EHbXBPc6tKaEyg,1229
15
15
  flexmetric/metric_process/views.py,sha256=BY695dCpTkJRc1KLC9RNpFTieFdHeHvyqyefmHhMauE,3297
16
- flexmetric-0.5.3.dist-info/METADATA,sha256=CVkAz_6fG6cJgoKN7e_GB-RxTBQJM1ehGz_s5p23Q8I,13820
17
- flexmetric-0.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- flexmetric-0.5.3.dist-info/entry_points.txt,sha256=urVePn5EWr3JqNvkYP7OsB_h2_Bqvv-Wq1MJRBexm8A,79
19
- flexmetric-0.5.3.dist-info/top_level.txt,sha256=zBlrNwKhXUNhgu9RRZnXxYwYnmE-eocRe6wKSmQROA4,11
20
- flexmetric-0.5.3.dist-info/RECORD,,
16
+ flexmetric-0.5.4.dist-info/METADATA,sha256=A4lS-lUf7AG1npmXgha49dNDpZB8tuwI0rBAcDHgmX4,14343
17
+ flexmetric-0.5.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ flexmetric-0.5.4.dist-info/entry_points.txt,sha256=urVePn5EWr3JqNvkYP7OsB_h2_Bqvv-Wq1MJRBexm8A,79
19
+ flexmetric-0.5.4.dist-info/top_level.txt,sha256=zBlrNwKhXUNhgu9RRZnXxYwYnmE-eocRe6wKSmQROA4,11
20
+ flexmetric-0.5.4.dist-info/RECORD,,