Skip to content

Commit 223af40

Browse files
Aditi2424adishaa
andauthored
Update telemetry status to be Integer for parity (#130)
Co-authored-by: adishaa <[email protected]>
1 parent c9571ae commit 223af40

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/sagemaker/hyperpod/common/telemetry/telemetry_logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def wrapper(*args, **kwargs):
160160
duration = round(perf_counter() - start, 2)
161161
extra += f"&x-latency={duration}"
162162
_send_telemetry_request(
163-
Status.SUCCESS,
163+
STATUS_TO_CODE[str(Status.SUCCESS)],
164164
[FEATURE_TO_CODE[str(feature)]],
165165
None,
166166
None,
@@ -172,7 +172,7 @@ def wrapper(*args, **kwargs):
172172
duration = round(perf_counter() - start, 2)
173173
extra += f"&x-latency={duration}"
174174
_send_telemetry_request(
175-
Status.FAILURE,
175+
STATUS_TO_CODE[str(Status.FAILURE)],
176176
[FEATURE_TO_CODE[str(feature)]],
177177
None,
178178
str(e),

test/unit_tests/common/telemetry/test_telemetry_logging.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import requests
1818
import logging
1919

20+
from src.sagemaker.hyperpod.common.telemetry.telemetry_logging import STATUS_TO_CODE
21+
2022
# Test data
2123
MOCK_CONTEXTS = {
2224
"eks_arn": "arn:aws:eks:us-west-2:123456789012:cluster/my-cluster",
@@ -163,7 +165,7 @@ def sample_function():
163165
args = mock_telemetry.call_args[0]
164166

165167
# Check status
166-
assert args[0] == Status.SUCCESS
168+
assert args[0] == STATUS_TO_CODE[str(Status.SUCCESS)]
167169

168170
# Check feature code
169171
assert args[1] == [FEATURE_TO_CODE[str(Feature.HYPERPOD)]]
@@ -198,11 +200,11 @@ def sample_function(succeed: bool):
198200

199201
# Check success call
200202
success_call = mock_telemetry.call_args_list[0]
201-
assert success_call[0][0] == Status.SUCCESS
203+
assert success_call[0][0] == STATUS_TO_CODE[str(Status.SUCCESS)]
202204

203205
# Check failure call
204206
failure_call = mock_telemetry.call_args_list[1]
205-
assert failure_call[0][0] == Status.FAILURE
207+
assert failure_call[0][0] == STATUS_TO_CODE[str(Status.FAILURE)]
206208

207209

208210
# Test _requests_helper

0 commit comments

Comments
 (0)