charles-001 / dolphie

Your single pane of glass for real-time analytics into MySQL/MariaDB & ProxySQL
https://pypi.org/project/dolphie/
GNU General Public License v3.0
651 stars 40 forks source link

Error after click on AHI Tab (Dolphie v3.1.2) #33

Closed 6district9 closed 1 year ago

6district9 commented 1 year ago

Doing really basic test of dolphie after clicking on differents tabs I've got some errors trying to access to HAI tab. I tried again but couldn't reproduce the error.

Python version: 3.11

certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.2.0
cryptography==41.0.3
dolphie==3.1.2
idna==3.4
importlib-metadata==6.8.0
linkify-it-py==2.0.2
markdown-it-py==3.0.0
mdit-py-plugins==0.4.0
mdurl==0.1.2
myloginpath==0.0.4
packaging==23.1
plotext==5.2.8
pycparser==2.21
Pygments==2.16.1
PyMySQL==1.1.0
requests==2.31.0
rich==13.5.2
sqlparse==0.4.4
textual==0.36.0
textual-autocomplete==2.1.0b0
typing_extensions==4.7.1
uc-micro-py==1.0.2
urllib3==2.0.4
zipp==3.16.2
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.20    |
+-----------+
1 row in set (0,02 sec)

dolphie/venv/lib/python3.11/site-packages/dolphie/app.py:658 in update_graphs │ │ │ │ 655 │ │ for metric_instance in self.dolphie.metric_manager.metrics.dict.values(): │ │ 656 │ │ │ if tab_metric_instance_name == metric_instance.tab_name: │ │ 657 │ │ │ │ for graph_name in metric_instance.graphs: │ │ ❱ 658 │ │ │ │ │ self.query_one(f"#{graph_name}").render_graph(metric_instance) │ │ 659 │ │ │ │ 660 │ │ self.update_stats_label(tab_metric_instance_name) │ │ 661 │ │ │ │ ╭──────────────────────────────────── locals ────────────────────────────────────╮ │ │ │ graph_name = 'graph_adaptive_hash_index_hit_ratio' │ │ │ │ metric_instance = AdaptiveHashIndexHitRatioMetrics( │ │ │ │ │ hit_ratio=MetricData( │ │ │ │ │ │ label='Hit Ratio', │ │ │ │ │ │ color=(84, 239, 174), │ │ │ │ │ │ visible=True, │ │ │ │ │ │ save_history=True, │ │ │ │ │ │ per_second_calculation=False, │ │ │ │ │ │ last_value=None, │ │ │ │ │ │ graphable=True, │ │ │ │ │ │ values=[1.9230769230769231] │ │ │ │ │ ), │ │ │ │ │ graphs=[ │ │ │ │ │ │ 'graph_adaptive_hash_index_hit_ratio' │ │ │ │ │ ], │ │ │ │ │ smoothed_hit_ratio=1.9230769230769231, │ │ │ │ │ tab_name='adaptive_hash_index', │ │ │ │ │ metric_source='none', │ │ │ │ │ datetimes=['08/09/23 11:59:52'] │ │ │ │ ) │ │ │ │ self = DolphieApp(title='Dolphie', classes={'-dark-mode'}) │ │ │ │ tab_metric_instance_name = 'adaptive_hash_index' │ │ │ ╰────────────────────────────────────────────────────────────────────────────────╯

dolphie/venv/lib/python3.11/site-packages/dolphie/Modules/MetricManager.py:154 in render_graph │ │ │ │ 151 │ │ if y_tick_interval >= 1: │ │ 152 │ │ │ y_ticks = [i * y_tick_interval for i in range(max_y_ticks + 1)] │ │ 153 │ │ else: │ │ ❱ 154 │ │ │ y_ticks = [i for i in range(max_y_value + 1)] │ │ 155 │ │ │ │ 156 │ │ format_function = get_number_format_function(self.metric_instance) │ │ 157 │ │ y_labels = [format_function(val) for val in y_ticks] │ │ │ │ ╭─────────────────────────────── locals ────────────────────────────────╮ │ │ │ max_y_ticks = 5 │ │ │ │ max_y_value = 1.9230769230769231 │ │ │ │ metric_data = ['08/09/23 11:59:52'] │ │ │ │ metric_instance = AdaptiveHashIndexHitRatioMetrics( │ │ │ │ │ hit_ratio=MetricData( │ │ │ │ │ │ label='Hit Ratio', │ │ │ │ │ │ color=(84, 239, 174), │ │ │ │ │ │ visible=True, │ │ │ │ │ │ save_history=True, │ │ │ │ │ │ per_second_calculation=False, │ │ │ │ │ │ last_value=None, │ │ │ │ │ │ graphable=True, │ │ │ │ │ │ values=[1.9230769230769231] │ │ │ │ │ ), │ │ │ │ │ graphs=[ │ │ │ │ │ │ 'graph_adaptive_hash_index_hit_ratio' │ │ │ │ │ ], │ │ │ │ │ smoothed_hit_ratio=1.9230769230769231, │ │ │ │ │ tab_name='adaptive_hash_index', │ │ │ │ │ metric_source='none', │ │ │ │ │ datetimes=['08/09/23 11:59:52'] │ │ │ │ ) │ │ │ │ self = Graph(id='graph_adaptive_hash_index_hit_ratio') │ │ │ │ x = ['08/09/23 11:59:52'] │ │ │ │ y = [1.9230769230769231] │ │ │ │ y_tick_interval = 0.38461538461538464 │ │ │ ╰───────────────────────────────────────────────────────────────────────╯ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: 'float' object cannot be interpreted as an integer

NOTE: 1 of 2 errors shown. Run with --dev to see all errors.

charles-001 commented 1 year ago

Hi @6district9 - thanks for your bug report! I think I've fixed it in my latest push.

6district9 commented 1 year ago

Hi @charles-001 , thank to you for that valuable work!

charles-001 commented 1 year ago

This is now in v3.1.3