-
Notifications
You must be signed in to change notification settings - Fork 18
environment settings support for agents #148
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
base: main
Are you sure you want to change the base?
environment settings support for agents #148
Conversation
| # SPDX-License-Identifier: Apache-2.0 | ||
| all_auto_instrumentation_agent_env_path=/etc/opentelemetry/env.conf | ||
| dotnet_auto_instrumentation_agent_path_prefix=/usr/lib/opentelemetry/dotnet | ||
| dotnet_auto_instrumentation_agent_env_path=/etc/opentelemetry/dotnet/env.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a heads up, the next iteration of the injector will use setenv unconditionally to inject environment variables. In particular, it will no longer possess the knowledge whether the host process (the process we are injecting env vars into) is the Node.js runtime, a JVM, .NET or anything else.
With that in mind, I think implementing a mechanism that is supposed to only inject environment variables into specific runtimes (dotnet_auto_instrumentation_agent_env_path vs jvm_auto_instrumentation_agent_env_path) becomes unfeasible.
For context, the plan is to upstream the latest changes from here: https://github.com/dash0hq/dash0-operator/tree/main/images/instrumentation/injector
For the details why we plan to switch to a setenv based approach, you can read up on that here: https://github.com/dash0hq/dash0-operator/blob/main/images/instrumentation/injector/README.md#design-constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we've had discussed in the issue, I removed language-specific options
|
Oh, by the way, @basti1302, I have a somewhat off-topic question: Why the format of config is not a yaml/toml/json/...? I'm not against the current simple key-value approach, but was just wondering why not just go for yaml/toml/json/... format and take a handy 3rd-party parser instead of doing it by hand? |
Good question. I don't have a strong opinion on that, to be honest. I think one motivation was to keep the injector binary as small and free of dependencies as possible. Adding a yaml or toml parser would probably be fine though. There was also some prior art, even before I added the Zig injector code, there was a simpler injector in this repository, written in C, and it had the same key-value pair config file format https://github.com/open-telemetry/opentelemetry-injector/blob/d41f25f73143adbf0a3041aa467afcee31c851fc/tests/java/otelinject.conf, so I think I just went with that. |
|
Hi @basti1302 ! I think I mostly finished this one. But I've run into a problem: for some reason, new integration test just won't pass for JVM and dotnet (passes for nodejs). After a little bit of debugging, it seems like JVM and dotnet processes just don't call our substituted To see for yourself, you can put something like: print.printMessage("getenv({s}) called", .{name_z});in My suspicion is that dotnet and jvm load all env variables into memory at the startup, therefore all subsequent "System.getenv" calls don't actually perform a system call Could you please take a look at it? How should we proceed? upd: I've got an idea: |
That is absolutely correct, and it is exactly one of the reasons why we will be switching to a It is described in detail in the writeup I posted earlier:
Admittedly, this section comes way down from what I linked to. I hadn't thought about how this would affect your solution here, but in hindsight it is clear that this issue rears its ugly head here as well.
That is the right idea, but am not sure if it is in scope for this PR. We will switch to using setenv in general soon. The work has already been done downstream in the Dash0 injector: dash0hq/dash0-operator#490 This was a pretty large change. The plan was to upstream these changes into this project relatively soon. I am a bit worried that it will be harder to do this the more changes we introduce to the Zig code in this repository right now. But maybe if you are using setenv only for the new custom variables from the new config file, it would not be such a large change, so it might be fine. |
|
There is no direct way to "setenv" ( |
|
@basti1302 Please take a look at the PR :) |
|
Hey @basti1302 @atoulme, please review the PR :) Excuse me if I'm bothering you, I'm quite close to the university assignment deadline, so I would really appreciate if you'd review it today or in the next few days, thanks! |

Resolves #82