-
Notifications
You must be signed in to change notification settings - Fork 0
Implement service level profiling for command control logic #22
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
base: master
Are you sure you want to change the base?
Conversation
good summary @artursarlo |
CREATE TABLE ProfilingHierarchyCommands ( | ||
ID bigserial PRIMARY KEY, | ||
command_id uuid NOT NULL, | ||
service_name text NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need process_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hummm, up until now we were only dealing with PIDs at the backend, not process names.
I can see the use case behind this, though (we might need to change the agent code to add process name instead of PID only).
The only reason I did not add PIDs into this table is because there is no reason to create a broad command based on PIDs (each host will have different PIDs)
one_value=True, | ||
return_dict=True, | ||
) | ||
existing_command = self.get_current_profiling_command(hostname, service_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice !
) VALUES ( | ||
%(command_id)s::uuid, %(hostname)s, %(service_name)s, %(command_type)s, | ||
%(final_request_ids)s::uuid[], %(final_config)s::jsonb, | ||
%(new_command_id)s::uuid, %(hostname)s, %(service_name)s, %(command_type)s, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably modularize this into different method
"""Create a stop command for an entire host""" | ||
"""Create a stop command for a specific host or all active hosts of a service""" | ||
if hostname is None: # Broadcast to all active hosts of the service | ||
active_hosts = self.get_active_hosts(service_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great to see we have already indexed idx_hostheartbeats_service_name, idx_profilinghierarchycommands_service_name
hostname=heartbeat.hostname, | ||
service_name=heartbeat.service_name, | ||
) | ||
if not current_command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this abstracted away ? why does heartbeat needs to know about these methods
get_current_profiling_command
generate_profiling_command_from_hierarchy
So order will be get_current_profiling_command function -> inside this function, it will attempt to ask for host level commands and hieararchy level commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add read me
logger.error(f"Failed to build hierarchy combined config for requests {request_ids}: {e}") | ||
return {} | ||
|
||
def _merge_hierarchy_configs(self, existing_config: Dict, new_request: Dict) -> Dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a blocker but merging logic could get complicated, i think we simply overwrite with the new config
This PR aims to:
This PR introduces changes to:
Description
Key features:
Related Issue
N/A
Motivation and Context
The motivation behind this feature is:
How Has This Been Tested?
Tested locally on DEV environment
Screenshots
N/A
Checklist: