Skip to content

Commit

Permalink
the magic fix?
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Sep 22, 2023
1 parent 54110ce commit bb9ec2b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/host_tools/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ def get_metrics_logger():

def emit_raw_emf(emf_msg: dict):
"""Emites a raw EMF log message to the local cloudwatch agent"""
if "AWS_EMF_AGENT_ENDPOINT" not in os.environ:
return

emf_msg["_aws"]["LogGroupName"] = os.environ["AWS_EMF_NAMESPACE"]
emf_msg["_aws"]["LogStreamName"] = ""

emf_endpoint = urlparse(os.environ["AWS_EMF_AGENT_ENDPOINT"])
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
print(json.dumps(emf_msg), emf_endpoint.hostname, emf_endpoint.port)
Expand Down

0 comments on commit bb9ec2b

Please sign in to comment.