Skip to content

Commit 3825e6e

Browse files
committed
Add support for app ids in spark
1 parent f28f20d commit 3825e6e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

gprofiler/metadata/application_identifiers_java.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class _JavaSparkApplicationIdentifier(_ApplicationIdentifier):
5050
_SPARK_PROPS_FILE = os.path.join("__spark_conf__", "__spark_conf__.properties")
5151
_APP_NAME_NOT_FOUND = "app name not found"
5252
_APP_NAME_KEY = "spark.app.name"
53+
_APP_ID_KEY = "--app-id"
5354

5455
@staticmethod
5556
def _is_java_spark_executor(process: Process) -> bool:
@@ -73,4 +74,11 @@ def get_app_id(self, process: Process) -> Optional[str]:
7374
)
7475
if self._APP_NAME_KEY in props:
7576
return f"spark: {props[self._APP_NAME_KEY]}"
77+
args = process.cmdline()
78+
try:
79+
for idx,x in enumerate(args):
80+
if x == self._APP_ID_KEY:
81+
return f"spark: {args[idx+1]}"
82+
except Exception:
83+
pass
7684
return self._APP_NAME_NOT_FOUND

0 commit comments

Comments
 (0)