open-telemetry / semantic-conventions

Defines standards for generating consistent, accessible telemetry across a variety of domains
Apache License 2.0
251 stars 163 forks source link

Process and Process Runtime Resources: typos in references to Java system properties #1395

Closed ghannington-Rocket closed 2 weeks ago

ghannington-Rocket commented 3 weeks ago

Excerpt of content

From the Markdown source of the topic "Process and Process Runtime Resources":

Java instrumentation SHOULD fill in the values by copying from system properties.

- `process.runtime.name` - Fill in the value of `java.runtime.name` as is
- `process.runtime.version` - Fill in the value of `java.runtime.version` as is
- `process.runtime.description` - Fill in the values of `java.vm.vendor`, `java.vm.name`, `java.vm.version`
  in that order, separated by spaces.

Issue

The qualifier runtime in java.runtime.name and java.runtime.version is a typo. There are no such Java system properties.

Suggestion

In those particular references, replace the runtime qualifier with vm.

Discussion

I think the docs are referring to the Java system properties java.vm.name and java.vm.version. I suspect that the writer has muddled process.runtime.* OpenTelemetry attributes with java.vm.* Java system properties.

References

joaopgrassi commented 2 weeks ago

Hi @ghannington-Rocket

I just tried and for me the keys actually are working as expected:

String runtime = java.lang.System.getProperty("java.runtime.name");
String runtimeVersion = java.lang.System.getProperty("java.runtime.version");

The result is: image

Did you tried something that didn't work?

The property keys you suggested return different values:

image

So I think actually what we have is correct, as it's returning the runtime info, not the vm info.

ghannington-Rocket commented 2 weeks ago

I'm wrong. Sincere apologies for wasting your time.

I should have tried this myself, but didn't. I'm a Java noob. I relied on the Oracle docs topic that I cited, System Properties, to be comprehensive. I'm guessing there are technical reasons why java.runtime.name and java.runtime.version don't appear in that topic, but are returned by System.getProperties(). I'm on a learning curve.

Thanks for correcting me gently!

joaopgrassi commented 2 weeks ago

No problem :). I'm going to close this issue then.