Skip to content

Commit

Permalink
Update opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Browse files Browse the repository at this point in the history
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
  • Loading branch information
asasvari and xrmx committed Jul 14, 2024
1 parent c81cb51 commit d1d97f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def detect(self) -> "Resource":
),
)
)
_process_pid = str(os.getpid())
_process_pid = os.getpid()
_process_executable_name = sys.executable
_process_executable_path = os.path.dirname(_process_executable_name)
_process_command = sys.argv[0]
Expand All @@ -369,18 +369,18 @@ def detect(self) -> "Resource":
PROCESS_EXECUTABLE_PATH: _process_executable_path,
PROCESS_COMMAND: _process_command,
PROCESS_COMMAND_LINE: _process_command_line,
PROCESS_COMMAND_ARGS: "".join(_process_command_args),
PROCESS_COMMAND_ARGS: _process_command_args,
}
if hasattr(os, "getppid"):
# pypy3 does not have getppid()
resource_info[PROCESS_PARENT_PID] = str(os.getppid())
resource_info[PROCESS_PARENT_PID] = os.getppid()

if psutil is not None:
process: pustil_module.Process = psutil.Process()
username = process.username()
resource_info[PROCESS_OWNER] = username

return Resource(resource_info)
return Resource(resource_info) # type: ignore


def get_aggregated_resources(
Expand Down

0 comments on commit d1d97f4

Please sign in to comment.