Skip to content

Commit

Permalink
update metric channel name
Browse files Browse the repository at this point in the history
  • Loading branch information
孙永强 committed Jan 6, 2025
1 parent 6f88830 commit 0af65d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions events/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
local_metric = {'metrics': {}}

NODE_NAME = os.environ.get('NODE_NAME', 'default')

METRIC_CHANNEL_NAME = "metic-channel"

### metrics decorator
def seasearch_index_timing_decorator(func):
Expand All @@ -31,7 +31,7 @@ def wrapper(*args, **kwargs):
duration_seconds = end_time - start_time
publish_metric['metric_value'] = round(duration_seconds, 3)
if ENABLE_METRIC:
redis_client.publish("metric-channel", json.dumps(publish_metric))
redis_client.publish(METRIC_CHANNEL_NAME, json.dumps(publish_metric))
return wrapper


Expand Down Expand Up @@ -75,7 +75,7 @@ def __init__(self, app, config):

def run(self):
logging.info('Starting handle redis channel')
subscriber = self._redis_client.get_subscriber('metric-channel')
subscriber = self._redis_client.get_subscriber(METRIC_CHANNEL_NAME)

while not self._finished.is_set():
try:
Expand All @@ -94,7 +94,7 @@ def run(self):
time.sleep(0.5)
except Exception as e:
logging.error('Failed handle metrics: %s' % e)
subscriber = self._redis_client.get_subscriber('metric-channel')
subscriber = self._redis_client.get_subscriber(METRIC_CHANNEL_NAME)


class MetricRedisRecorder(object):
Expand Down
4 changes: 2 additions & 2 deletions seafevent_server/request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from seafevents.repo_metadata.metadata_server_api import MetadataServerAPI
from seafevents.repo_metadata.utils import add_file_details
from seafevents.app.event_redis import redis_cache
from seafevents.events.metrics import NODE_NAME
from seafevents.events.metrics import NODE_NAME, METRIC_CHANNEL_NAME



Expand All @@ -30,7 +30,7 @@ def publish_io_qsize_metric(qsize):
}
}
if ENABLE_METRIC:
redis_cache.publish('metric-channel', json.dumps(publish_metric))
redis_cache.publish(METRIC_CHANNEL_NAME, json.dumps(publish_metric))


def check_auth_token(req):
Expand Down

0 comments on commit 0af65d3

Please sign in to comment.