Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node aggregation after changes to get_all_discovery_nodes_cached #7365

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/discovery-provider/src/tasks/index_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
discovery_node_service_type = bytes("discovery-node", "utf-8")


def get_metrics(endpoint, start_time):
def get_metrics(endpoint: str, start_time: int):
try:
route_metrics_endpoint = (
f"{endpoint}/v1/metrics/routes/cached?start_time={start_time}"
Expand Down Expand Up @@ -138,7 +138,7 @@ def consolidate_metrics_from_other_nodes(self, db, redis):
)
start_time_obj = datetime.strptime(start_time_str, datetime_format_secondary)
start_time = int(start_time_obj.timestamp())
new_route_metrics, new_app_metrics = get_metrics(node, start_time)
new_route_metrics, new_app_metrics = get_metrics(node["endpoint"], start_time)

logger.debug(
f"did attempt to receive route and app metrics from {node} at {start_time_obj} ({start_time})"
Expand All @@ -158,7 +158,7 @@ def consolidate_metrics_from_other_nodes(self, db, redis):
merge_app_metrics(new_app_metrics or {}, end_time, db)

if new_route_metrics is not None and new_app_metrics is not None:
visited_node_timestamps[node] = end_time
visited_node_timestamps[node["endpoint"]] = end_time
redis.set(metrics_visited_nodes, json.dumps(visited_node_timestamps))

# persist updated summed unique counts
Expand All @@ -169,7 +169,7 @@ def consolidate_metrics_from_other_nodes(self, db, redis):
logger.debug(f"visited node timestamps: {visited_node_timestamps}")


def get_historical_metrics(node):
def get_historical_metrics(node: str):
try:
endpoint = f"{node}/v1/metrics/aggregates/historical"
logger.debug(f"historical metrics request to: {endpoint}")
Expand Down