Skip to content

Commit

Permalink
Fixes formatting issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwils committed Jun 20, 2024
1 parent a8a8ec5 commit fc76a5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions canvas_sdk/utils/stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from time import time
from typing import Any


def get_duration_ms(start_time: time) -> int:
Expand Down
6 changes: 4 additions & 2 deletions plugin_runner/plugin_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ async def HandleEvent(self, request: Event, context):
effects = await asyncio.get_running_loop().run_in_executor(None, protocol.compute)
compute_duration = get_duration_ms(compute_start_time)
log.info(f"{plugin_name}.compute() completed ({compute_duration} ms)")
statsd_tags = tags_to_line_protocol({"plugin": plugin_name})
self.statsd_client.timing(
f"plugins.protocol_duration_ms,{tags_to_line_protocol({"plugin": plugin_name})}",
f"plugins.protocol_duration_ms,{statsd_tags}",
delta=compute_duration,
)
except Exception as e:
Expand All @@ -85,8 +86,9 @@ async def HandleEvent(self, request: Event, context):
# Don't log anything if a protocol didn't actually run.
if relevant_plugins:
log.info(f"Responded to Event {event_name} ({event_duration} ms)")
statsd_tags = tags_to_line_protocol({"event": event_name})
self.statsd_client.timing(
f"plugins.event_duration_ms,{tags_to_line_protocol({"event": event_name})}",
f"plugins.event_duration_ms,{statsd_tags}",
delta=event_duration,
)
yield EventResponse(success=True, effects=effect_list)
Expand Down

0 comments on commit fc76a5c

Please sign in to comment.