Skip to content

Commit a2f3385

Browse files
CopilotnikhilNava
andcommitted
Address code review feedback
- Remove unused _wall_clock_start_ms variable - Fix documentation to accurately describe TimeInput accepted formats - Remove unused time import Co-authored-by: nikhilNava <211831449+nikhilNava@users.noreply.github.com>
1 parent 44aca2e commit a2f3385

4 files changed

Lines changed: 22 additions & 18 deletions

File tree

libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ def start(
4343
request: Optional request details for additional context
4444
parent_id: Optional parent Activity ID used to link this span to an upstream
4545
operation
46-
start_time: Optional explicit start time (ms epoch, Date, or HrTime). Useful when
46+
start_time: Optional explicit start time. Accepts int (nanoseconds since epoch),
47+
float (seconds since epoch), tuple[int, int] (HrTime), or datetime. Useful when
4748
recording a tool call after execution has already completed.
48-
end_time: Optional explicit end time (ms epoch, Date, or HrTime). When provided,
49-
the span will use this timestamp when disposed instead of the current
50-
wall-clock time.
49+
end_time: Optional explicit end time in the same formats as start_time. When
50+
provided, the span will use this timestamp when disposed instead of the
51+
current wall-clock time.
5152
5253
Returns:
5354
A new ExecuteToolScope instance
@@ -75,11 +76,12 @@ def __init__(
7576
request: Optional request details for additional context
7677
parent_id: Optional parent Activity ID used to link this span to an upstream
7778
operation
78-
start_time: Optional explicit start time (ms epoch, Date, or HrTime). Useful when
79+
start_time: Optional explicit start time. Accepts int (nanoseconds since epoch),
80+
float (seconds since epoch), tuple[int, int] (HrTime), or datetime. Useful when
7981
recording a tool call after execution has already completed.
80-
end_time: Optional explicit end time (ms epoch, Date, or HrTime). When provided,
81-
the span will use this timestamp when disposed instead of the current
82-
wall-clock time.
82+
end_time: Optional explicit end time in the same formats as start_time. When
83+
provided, the span will use this timestamp when disposed instead of the
84+
current wall-clock time.
8385
"""
8486
super().__init__(
8587
kind="Internal",

libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/inference_scope.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ def start(
4747
request: Optional request details for additional context
4848
parent_id: Optional parent Activity ID used to link this span to an upstream
4949
operation
50-
start_time: Optional explicit start time (ms epoch, Date, or HrTime)
51-
end_time: Optional explicit end time (ms epoch, Date, or HrTime)
50+
start_time: Optional explicit start time. Accepts int (nanoseconds since epoch),
51+
float (seconds since epoch), tuple[int, int] (HrTime), or datetime.
52+
end_time: Optional explicit end time in the same formats as start_time.
5253
5354
Returns:
5455
A new InferenceScope instance
@@ -76,8 +77,9 @@ def __init__(
7677
request: Optional request details for additional context
7778
parent_id: Optional parent Activity ID used to link this span to an upstream
7879
operation
79-
start_time: Optional explicit start time (ms epoch, Date, or HrTime)
80-
end_time: Optional explicit end time (ms epoch, Date, or HrTime)
80+
start_time: Optional explicit start time. Accepts int (nanoseconds since epoch),
81+
float (seconds since epoch), tuple[int, int] (HrTime), or datetime.
82+
end_time: Optional explicit end time in the same formats as start_time.
8183
"""
8284

8385
super().__init__(

libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/invoke_agent_scope.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ def start(
6262
request: Optional request details for additional context
6363
caller_agent_details: Optional details of the caller agent
6464
caller_details: Optional details of the non-agentic caller
65-
start_time: Optional explicit start time (ms epoch, Date, or HrTime)
66-
end_time: Optional explicit end time (ms epoch, Date, or HrTime)
65+
start_time: Optional explicit start time. Accepts int (nanoseconds since epoch),
66+
float (seconds since epoch), tuple[int, int] (HrTime), or datetime.
67+
end_time: Optional explicit end time in the same formats as start_time.
6768
6869
Returns:
6970
A new InvokeAgentScope instance
@@ -96,8 +97,9 @@ def __init__(
9697
request: Optional request details for additional context
9798
caller_agent_details: Optional details of the caller agent
9899
caller_details: Optional details of the non-agentic caller
99-
start_time: Optional explicit start time (ms epoch, Date, or HrTime)
100-
end_time: Optional explicit end time (ms epoch, Date, or HrTime)
100+
start_time: Optional explicit start time. Accepts int (nanoseconds since epoch),
101+
float (seconds since epoch), tuple[int, int] (HrTime), or datetime.
102+
end_time: Optional explicit end time in the same formats as start_time.
101103
"""
102104
activity_name = INVOKE_AGENT_OPERATION_NAME
103105
if invoke_agent_details.details.agent_name:

libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/opentelemetry_scope.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import logging
77
import os
8-
import time
98
from datetime import datetime
109
from threading import Lock
1110
from typing import TYPE_CHECKING, Any
@@ -111,7 +110,6 @@ def __init__(
111110
instead of the current wall-clock time.
112111
"""
113112
self._span: Span | None = None
114-
self._wall_clock_start_ms = time.time() * 1000 # milliseconds
115113
self._custom_start_time: TimeInput = start_time
116114
self._custom_end_time: TimeInput = end_time
117115
self._has_ended = False

0 commit comments

Comments
 (0)