Skip to content

Commit 33ceb33

Browse files
authored
Fix "no snapshot data found" error when agent check <check> -m/--profile-memory (#19197)
* Fix namespaces for profile_memory * changelog * update comment * fix lint
1 parent 0e37c69 commit 33ceb33

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix "no snapshot data found" error when `agent check <check> --profile-memory`

datadog_checks_base/datadog_checks/base/checks/base.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,13 @@ def run(self):
12851285

12861286
enter_pdb(self.check, line=self.init_config['set_breakpoint'], args=(instance,))
12871287
elif self.should_profile_memory():
1288-
self.profile_memory(self.check, self.init_config, args=(instance,))
1288+
# self.init_config['profile_memory'] could be `/tmp/datadog-agent-memory-profiler*`
1289+
# that is generated by Datadog Agent.
1290+
# If we use `--m-dir` for `agent check` command, a hidden flag, it should be same as a given value.
1291+
namespaces = [self.init_config['profile_memory']]
1292+
for id in self.check_id.split(":"):
1293+
namespaces.append(id)
1294+
self.profile_memory(func=self.check, namespaces=namespaces, args=(instance,))
12891295
else:
12901296
self.check(instance)
12911297

0 commit comments

Comments
 (0)