-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Populate process.command_args
for Java 9+ and improve process.command_line
for Java 8
#8130
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When running the test in intellij, it generates an attribute like this:
|
laurit
reviewed
Mar 27, 2023
...ources/library/src/main/java/io/opentelemetry/instrumentation/resources/ProcessResource.java
Outdated
Show resolved
Hide resolved
laurit
reviewed
Mar 27, 2023
...ources/library/src/main/java/io/opentelemetry/instrumentation/resources/ProcessResource.java
Outdated
Show resolved
Hide resolved
laurit
reviewed
Mar 27, 2023
...ources/library/src/main/java/io/opentelemetry/instrumentation/resources/ProcessResource.java
Outdated
Show resolved
Hide resolved
laurit
reviewed
Mar 27, 2023
...ources/library/src/main/java/io/opentelemetry/instrumentation/resources/ProcessResource.java
Outdated
Show resolved
Hide resolved
`command_args` is defined as: > All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from proc/[pid]/cmdline. For libc-based executables, this would be the full argv vector passed to main. `process.command_line` only included vm arguments, not the program arguments: > The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of GetCommandLineW. Do not set this if you have to assemble it just for monitoring; use process.command_args instead. (I didn't remove `command_line` to maintain backward compatibility, but it should be removed in the future in favor of `command_args`.)
Not sure of a better way to do this without going to the proc file in linux... Java seems to forget about that param.
tylerbenson
force-pushed
the
tyler/command_args
branch
from
April 10, 2023 21:25
2adb089
to
95697cc
Compare
And only set `ResourceAttributes.PROCESS_COMMAND_LINE` if Java 8. Without the actual `ProcessHandle` arguments command, we can't distinguish between `a b` vs `"a b"`.
tylerbenson
changed the title
Populate
Populate Apr 10, 2023
process.command_args
and fix process.command_line
process.command_args
with Java 9+ and improve process.command_line
for Java 8
tylerbenson
changed the title
Populate
Populate Apr 10, 2023
process.command_args
with Java 9+ and improve process.command_line
for Java 8process.command_args
for Java 9+ and improve process.command_line
for Java 8
mateuszrzeszutek
approved these changes
Apr 11, 2023
...urces/library/src/main/java/io/opentelemetry/instrumentation/resources/ProcessArguments.java
Outdated
Show resolved
Hide resolved
laurit
approved these changes
Apr 11, 2023
tylerbenson
force-pushed
the
tyler/command_args
branch
2 times, most recently
from
April 11, 2023 17:41
aa25674
to
c60d72a
Compare
tylerbenson
force-pushed
the
tyler/command_args
branch
from
April 11, 2023 18:10
c60d72a
to
f45daae
Compare
trask
approved these changes
Apr 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
command_args
is defined as:process.command_line
only included vm arguments, not the program arguments:Based on review below, I opted to only provide
command_line
for Java 8 and prefercommand_args
for Java 9+.