Skip to content
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

feat(injector): add custom Dash0 LD_PRELOAD injector #155

Merged
merged 8 commits into from
Oct 26, 2024
Merged

Conversation

mmanciop
Copy link
Member

Add to the Dash0 instrumentation image an LD_PRELOAD injector that:

  1. Works irrespective of the libc flavour used by the dynamically-linked host process (e.g., Node v8, CPython, the JVM)
  2. Modified on-demand the value of environment variables looked up by the host process through the getenv LibC API (currently implemented: NODE_OPTIONS)

The injector replicates internally a subset of the libc APIs related with string comparison and manipulation. That code is adapted from muse libc, and the respective copyright notice is included.

@mmanciop mmanciop marked this pull request as draft September 25, 2024 07:55
@mmanciop
Copy link
Member Author

mmanciop commented Sep 25, 2024

TODOs as of f292f12:

1. Integrate multi-arch image building and testing
2. Test more scenarios relevant for injection, e.g., unrelated var remain untouched
3. Adjust the env vars set by the operator on injection to use LD_PRELOAD

@basti1302 basti1302 force-pushed the injector branch 8 times, most recently from 0f45a9b to 5dd3b60 Compare October 21, 2024 10:51
@basti1302 basti1302 changed the title Introduce the Dash0 Injector feat(injector): add custom Dash0 LD_PRELOAD injector Oct 21, 2024
@basti1302 basti1302 force-pushed the injector branch 12 times, most recently from 7386085 to 14d9986 Compare October 23, 2024 09:53
@basti1302 basti1302 force-pushed the injector branch 6 times, most recently from f751104 to ab00394 Compare October 23, 2024 15:14
@basti1302 basti1302 force-pushed the injector branch 3 times, most recently from c6a9102 to aafa553 Compare October 23, 2024 16:08
mmanciop and others added 7 commits October 25, 2024 15:21
Add LD_PRELOAD injector binary to the Dash0 instrumentation image. This
image works irrespective of the libc flavour used by the
dynamically-linked host process (e.g., Node v8, CPython, JVM).
Environment variables that the host process looks up through getenv are
modified on the fly, to inject Dash0 OpenTelemetry distributions.

For now, this is only implemented for Node.js via NODE_OPTIONS.

The injector replicates a subset of internal libc APIs related to string
comparison and manipulation. This code is adapted from musl libc, and
the respective copyright notice is included.
Also:
- refactor test scripts
- lint scripts with shellcheck
@basti1302 basti1302 force-pushed the injector branch 10 times, most recently from fc4d0f3 to 566255d Compare October 26, 2024 09:48
@basti1302 basti1302 marked this pull request as ready for review October 26, 2024 09:49
@basti1302 basti1302 force-pushed the injector branch 2 times, most recently from 73a23b9 to 07ecffe Compare October 26, 2024 09:55
Also: Enable both tests to use an existing (local or remote)
instrumentation image instead of building the instrumentation image from
local sources.
Copy link

sonarcloud bot commented Oct 26, 2024

@basti1302 basti1302 enabled auto-merge (rebase) October 26, 2024 09:58
@basti1302 basti1302 merged commit 9dd8b6b into main Oct 26, 2024
9 checks passed
@basti1302 basti1302 deleted the injector branch October 26, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants