Skip to content

Commit

Permalink
Merge pull request #21 from odigos-io/dynamic-imports
Browse files Browse the repository at this point in the history
Dynamic imports
  • Loading branch information
tamirdavid1 authored Sep 11, 2024
2 parents 0ebecec + f016538 commit 62ab2c6
Show file tree
Hide file tree
Showing 6 changed files with 540 additions and 144 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ ipython_config.py


# Virtual environment
venv/
*venv/
64 changes: 48 additions & 16 deletions opamp/anyvalue_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions opamp/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ def worker(self):
opamp_logger.error(f"Error fetching data: {e}")
self.condition.wait(30)

def send_heartbeat(self) -> opamp_pb2.ServerToAgent:
def send_heartbeat(self) -> opamp_pb2.ServerToAgent: # type: ignore
opamp_logger.debug("Sending heartbeat to OpAMP server...")
try:
agent_to_server = opamp_pb2.AgentToServer(remote_config_status=self.remote_config_status)
return self.send_agent_to_server_message(agent_to_server)
except requests_odigos.RequestException as e:
opamp_logger.error(f"Error sending heartbeat to OpAMP server: {e}")

def get_agent_description(self) -> opamp_pb2.AgentDescription:
def get_agent_description(self) -> opamp_pb2.AgentDescription: # type: ignore
identifying_attributes = [
anyvalue_pb2.KeyValue(
key=ResourceAttributes.SERVICE_INSTANCE_ID,
Expand All @@ -176,10 +176,10 @@ def get_agent_description(self) -> opamp_pb2.AgentDescription:
non_identifying_attributes=[]
)

def get_agent_disconnect(self) -> opamp_pb2.AgentDisconnect:
def get_agent_disconnect(self) -> opamp_pb2.AgentDisconnect: # type: ignore
return opamp_pb2.AgentDisconnect()

def get_agent_health(self, component_health: bool = None, last_error : str = None, status: str = None) -> opamp_pb2.ComponentHealth:
def get_agent_health(self, component_health: bool = None, last_error : str = None, status: str = None) -> opamp_pb2.ComponentHealth: # type: ignore
health = opamp_pb2.ComponentHealth(
)
if component_health is not None:
Expand All @@ -192,7 +192,7 @@ def get_agent_health(self, component_health: bool = None, last_error : str = Non
return health


def send_agent_to_server_message(self, message: opamp_pb2.AgentToServer) -> opamp_pb2.ServerToAgent:
def send_agent_to_server_message(self, message: opamp_pb2.AgentToServer) -> opamp_pb2.ServerToAgent: # type: ignore

message.instance_uid = self.instance_uid.encode('utf-8')
message.sequence_num = self.next_sequence_num
Expand Down Expand Up @@ -256,7 +256,7 @@ def shutdown(self, custom_failure_message: str = None):

self.send_agent_to_server_message(disconnect_message)

def update_remote_config_status(self, server_to_agent: opamp_pb2.ServerToAgent) -> bool:
def update_remote_config_status(self, server_to_agent: opamp_pb2.ServerToAgent) -> bool: # type: ignore
if server_to_agent.HasField("remote_config"):
remote_config_hash = server_to_agent.remote_config.config_hash
remote_config_status = opamp_pb2.RemoteConfigStatus(last_remote_config_hash=remote_config_hash)
Expand Down
Loading

0 comments on commit 62ab2c6

Please sign in to comment.