Skip to content

Commit b2a3e69

Browse files
Fix key for agent metadata based on schema: from 'memory_usage_mb' to 'memoryInMB'.
1 parent cca9d6c commit b2a3e69

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

codeguru_profiler_agent/agent_metadata/agent_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def fleet_info(self):
6969
def serialize_to_json(self, sample_weight, duration_ms, cpu_time_seconds,
7070
average_num_threads, overhead_ms, memory_usage_mb, total_sample_count):
7171
"""
72-
This needs to be compliant with agent profile schema.
72+
This needs to be compliant with the AgentMetadata schema that is used on the service side.
7373
"""
7474
if self.json_rep is None:
7575
self.json_rep = {
@@ -83,7 +83,7 @@ def serialize_to_json(self, sample_weight, duration_ms, cpu_time_seconds,
8383
"version": self.agent_info.version
8484
},
8585
"agentOverhead": {
86-
"memory_usage_mb": int(memory_usage_mb)
86+
"memoryInMB": int(memory_usage_mb)
8787
},
8888
"runtimeVersion": self.runtime_version,
8989
"cpuTimeInSeconds": cpu_time_seconds,

test/acceptance/test_end_to_end_profile_and_save_to_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def assert_valid_agent_metadata(agent_metadata):
9292
assert agent_metadata["agentOverhead"]
9393
assert agent_metadata["durationInMs"]
9494
assert agent_metadata["sampleWeights"]["WALL_TIME"]
95-
assert type(agent_metadata["agentOverhead"]["memory_usage_mb"]) is int
95+
assert type(agent_metadata["agentOverhead"]["memoryInMB"]) is int
9696

9797
if platform.system() != "Windows":
9898
# Due to the issue mentioned on https://bugs.python.org/issue37859, we would skip checking agentOverhead for

test/unit/sdk_reporter/test_sdk_profile_encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_it_includes_the_overhead_ms_in_the_agent_metadata(self):
122122
assert (self.decoded_json_result()["agentMetadata"]["agentOverhead"]["timeInMs"] == 256)
123123

124124
def test_it_includes_the_memory_overhead_in_the_agent_metadata(self):
125-
assert (type(self.decoded_json_result()["agentMetadata"]["agentOverhead"]["memory_usage_mb"]) is int)
125+
assert (type(self.decoded_json_result()["agentMetadata"]["agentOverhead"]["memoryInMB"]) is int)
126126

127127
def test_it_includes_the_num_times_sampled_in_the_agent_metadata(self):
128128
assert (self.decoded_json_result()["agentMetadata"]["numTimesSampled"] > 0)

0 commit comments

Comments
 (0)