-
Notifications
You must be signed in to change notification settings - Fork 494
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
Use LD_PRELOAD for setting environment variables e.g. JAVA_TOOL_OPTIONS / OTEL_ #2375
Comments
@pavolloffay, are you working on it or can I take this one? |
I haven't started. I think this needs maybe a POC and see what are the other implications. |
OG of the Lumigo operator here :-) We do this in the Dash0 operator (fully OSS), and while I personally built it as well in the Lumigo operator a couple of years ago, the injector there is not OSS iirc. We have used
(Additional tidbits in this blog post.) From Dash0's side, we'd be delighted to see |
Besides, the |
@mmanciop thanks for looping in. We would appreciate collaboration on this feature 👍🏼 https://lumigo.io/blog/the-magic-behind-the-lumigo-kubernetes-operator/ mentions that the init-container is also used to copy the instrumentation/SDK. Does it mean that the docker image for the init container needs to bundle instrumentation for all languages? |
Yes, the init container image must bundle all languages that the LD_PRELOAD can activate. And of course the LD_PRELOAD object itself. |
Hi there, I would like to inquire about any updates or progress on the feature related to concatenating JAVA_TOOL_OPTIONS with OpenTelemetry auto-instrumentation agent options. As of now, it seems that it is only possible to concatenate environment variables explicitly defined within the deployment YAML under the env section. However, it appears that concatenation of the values from JAVA_TOOL_OPTIONS with the OpenTelemetry agent options (e.g., -javaagent or other configuration flags) is still not supported or automatic. Could you please clarify whether this functionality is in the works or if there are any workarounds available? Any update would be greatly appreciated! Thank you for your time and efforts. |
Hi @berezinsn , it's a functionality we have working with the Dash0 operator and that I would love to contribute upstream. In your specific case, you maybe also use the |
With respect to the PoC in #3731, we discussed in the SIG the two following points:
Consensus was that the
This is an open topic. I reported about a promising PoC I am working on for a Zig-based injector, which would lift these limitations (e.g., by being able to determine the LibC flavor based on ELF metadata from |
I am not sure using LD_PRELOAD here helps, because the code prepends to the env var our path to the jar ; that might mean we load multiple agents in the application, and it is my understanding that having multiple precompiler agents is not well supported by OpenTelemetry. So I'm not sure this is going to solve the premise of the issue. |
For host-based LD_PRELOAD instrumentation, we have a proposal up for a donation of the same functionality here: open-telemetry/community#2580 |
Technically, nothing prevents this injector to be modified to scrub from the env vars other agents it finds, or prevent adding an OTel one when other agents are found. |
OK, and which way are we leaning? |
If I read the code correctly, since that injector will link against a libc, it is viable when the packaging implies the LibC flavor (which is pretty much true for all Linux distros I know), but will likely crash processes that link against a different libc flavor (which is a commonplace risk in containers). The existence of musl and Alpine do make injectors harder by several orders of magnitude… |
That's for sure. Does your LD_PRELOAD approach work with images built with scratch? |
Yes, it’s entirely self-contained. I am aware of an issue affecting processes that are dynamically linked, but that do not link against a libc (so they do not expose a |
Component(s)
No response
Is your feature request related to a problem? Please describe.
At the moment the operator sets the env variables directly on the pod spec. The downside is if user defines the same variables in docker image or in config map. The operator does not know anything about those env vars. The solution might be to use LD_PRELOAD to set and override env vars.
The same approach is used by Lumigo operator and probably other vendors. https://github.com/lumigo-io/lumigo-kubernetes-operator/blob/88a3f78e5a32b965210659db11ef97f2a0c6f6c6/controller/src/mutation/mutate.go#L50
This would also resolve #1814
Describe the solution you'd like
Use LD_PRELOAD to set env vars for the instrumentation CR.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: