diff --git a/datanode/src/datanode_server.py b/datanode/src/datanode_server.py index 3983d06..8da3f7a 100644 --- a/datanode/src/datanode_server.py +++ b/datanode/src/datanode_server.py @@ -22,11 +22,10 @@ throughput = Histogram('disk_total_size', 'Total size of disk', labelnames=["provider"], _labelvalues=[ConfigManager.get_prop('datanode_name')]) -# DECORATORS{ def inc_message_count(func): def wrapper(*args, **kwargs): result = func(*args, **kwargs) - message_count.labels(provider=ConfigManager.get_prop('datanode_name')).inc() + message_count.inc() return result return wrapper @@ -34,7 +33,7 @@ def wrapper(*args, **kwargs): def dec_message_count(func): def wrapper(*args, **kwargs): result = func(*args, **kwargs) - message_count.labels(provider=ConfigManager.get_prop('datanode_name')).dec() + message_count.dec() return result return wrapper @@ -42,21 +41,19 @@ def wrapper(*args, **kwargs): def set_message_count(func): def wrapper(*args, **kwargs): result = func(*args, **kwargs) - message_count.labels(provider=ConfigManager.get_prop('datanode_name')).set(result) + message_count.set(result) return result return wrapper def get_disk_info_decorator(func): - def wrapper(): - result = func() + def wrapper(*args, **kwargs): path = ConfigManager.get_prop('partition_home_path') st = os.statvfs(path) total = st.f_blocks * st.f_frsize used = (st.f_blocks - st.f_bfree) * st.f_frsize - disk_total_size.labels(provider=ConfigManager.get_prop('datanode_name')).set(total) - disk_total_size.labels(provider=ConfigManager.get_prop('datanode_name')).set(used) - return result + disk_total_size.set(total) + disk_total_size.set(used) return wrapper @@ -173,6 +170,7 @@ def push_to_partition(partition_index: int, def serve(): + # Start metrics server start_http_server(9000) port = ConfigManager.get_prop('server_port')