File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 66
77import os
88import json
9+ from datetime import datetime
10+
911import urllib3
1012import requests
11- from datetime import datetime
1213
1314from ..log import logger
1415from .base import BaseAgent
@@ -219,7 +220,6 @@ def report_data_payload(self, payload):
219220
220221 # Report metrics
221222 metric_bundle = payload ["metrics" ]["plugins" ][0 ]["data" ]
222- # logger.debug(to_json(metric_bundle))
223223 response = self .client .post (self .__data_url (),
224224 data = to_json (metric_bundle ),
225225 headers = {"Content-Type" : "application/json" },
Original file line number Diff line number Diff line change @@ -32,7 +32,14 @@ def collect_metrics(self, with_snapshot=False):
3232 plugin_data ["name" ] = "com.instana.plugin.python"
3333 plugin_data ["entityId" ] = str (os .getpid ())
3434 plugin_data ["data" ] = DictionaryOfStan ()
35- plugin_data ["data" ]["pid" ] = str (os .getpid ())
35+
36+ if hasattr (self .collector .agent , "announce_data" ):
37+ try :
38+ plugin_data ["data" ]["pid" ] = self .collector .agent .announce_data .pid
39+ except Exception :
40+ plugin_data ["data" ]["pid" ] = str (os .getpid ())
41+ else :
42+ plugin_data ["data" ]["pid" ] = str (os .getpid ())
3643
3744 self ._collect_runtime_metrics (plugin_data , with_snapshot )
3845
You can’t perform that action at this time.
0 commit comments