Commit Graph

6 Commits

Author SHA1 Message Date
jack-berg 97f036c3e5
Stop relocating :instrumentation:resources:library (#7136)
Per the discussion in the today's SIG and this
[comment](https://github.com/open-telemetry/opentelemetry-java/issues/4919#issuecomment-1305774636).

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-11-15 22:37:17 +00:00
jason plumb b09fb67e6b
Support cgroup v2 (#7167)
This resolves #6694.

We've been tracking the update to cgroup version support and want to get
ahead of the widespread usage. The surface of the existing
`ContainerResource` has not changed, but its internals have been
factored out to two "extractor" utilities -- one that understands cgroup
v1 and another for v2. v1 is attempted and, if successful, the result is
used. If v1 fails, then the `ContainerResource` will fall back to v2.

As mentioned in #6694, the approach taken in this PR is borrowed from
[this SO
post](https://stackoverflow.com/questions/68816329/how-to-get-docker-container-id-from-within-the-container-with-cgroup-v2)
combined with local experimentation on docker desktop on a Mac, which
already uses cgroup2 v2.
2022-11-15 12:12:11 -08:00
Mateusz Rzeszutek 33b06889fa
Auto-detect service name based on the jar name (#6817)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-10-22 18:10:21 -07:00
Etienne Dysli Metref 6fb1f00241
Refactor `io.opentelemetry.instrumentation.resources.ContainerResource` to avoid using null (#6889)
While I was looking at issues
open-telemetry/opentelemetry-java-instrumentation#6694 and
open-telemetry/opentelemetry-java#2337, I saw that the code in
`io.opentelemetry.instrumentation.resources.ContainerResource` used
`null` several times as return value which isn't safe. Nowadays,
`Optional` is better suited to signal the absence of a result, so I
refactored `ContainerResource` to use `Optional`s instead of null.

On the way, I also refactored this class's unit tests into parameterised
tests to reduce test code duplication. These improvements should help
implementing a solution to
open-telemetry/opentelemetry-java-instrumentation#6694.

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
2022-10-19 03:00:43 +00:00
Fabien Crespel 7cb57e1fb1
Fix directory separator in ProcessResource attributes (#6716)
The separator char used to build the Java executable path in
ProcessResource is wrong: `File.pathSeparatorChar` is the PATH variable
separator (`:` on Linux, `;` on Windows), the right one for directories
is `File.separatorChar` (`/` on Linux, `\` on Windows).

Note that this issue was already present in
[sdk-extensions-resources](https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/resources/src/main/java/io/opentelemetry/sdk/extension/resources/ProcessResource.java#L64)
before it was moved here; should it be fixed there too?
2022-09-26 16:17:21 -07:00
jack-berg 6b607c1e18
Add resource providers (#6574)
* Add resource providers

* Use autoservice annotation
2022-09-14 15:45:24 -07:00