Skip to content

Conversation

@Horiodino
Copy link
Contributor

Description:
Fixes incorrect environment variable propagation priority in the Instrumentation CR. Previously, environment variables defined under spec.env were ignored in favor of instrumentation defaults, unless overridden in language-specific sections.

This ensures users can define global environment variables in one place without duplicating them per language.

Link to tracking Issue(s):

Testing:

  • Updated unit tests .
  • Updated e2e-instrumentation tests.

Documentation:

NIL

@Horiodino Horiodino requested a review from a team as a code owner September 1, 2025 15:22
@gemini-code-assist
Copy link

Important

Installation incomplete: to start using Gemini Code Assist, please ask the organization owner(s) to visit the Gemini Code Assist Admin Console and sign the Terms of Services.

@Horiodino Horiodino changed the title Resolve spec.env Fix: variable propagation priority in Instrumentation CR. Sep 1, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

E2E Test Results

 34 files  ±0  225 suites  +4   2h 20m 20s ⏱️ - 41m 26s
 89 tests +1   89 ✅ +1  0 💤 ±0  0 ❌ ±0 
229 runs  +4  229 ✅ +4  0 💤 ±0  0 ❌ ±0 

Results for commit 332f3fe. ± Comparison against base commit c1d96e6.

♻️ This comment has been updated with latest results.

@Horiodino Horiodino force-pushed the resolve_spec.env branch 5 times, most recently from 4ca1b3f to 79311a7 Compare September 3, 2025 07:06
@swiatekm
Copy link
Contributor

swiatekm commented Sep 3, 2025

Is fixing this for Python enough? Do other languages do the right thing already?

@iblancasa iblancasa self-requested a review September 8, 2025 07:14
@Horiodino
Copy link
Contributor Author

Hey @frzifus can you verify running the e2e-instrumentation locally ?not sure i think its due to the sidecar changes

    --- FAIL: chainsaw/instrumentation-go (366.15s)
FAIL
Tests Summary...
- Passed  tests 20
- Failed  tests 1
- Skipped tests 0
Saving report...
Done with failures.
Error: some tests failed
make: *** [Makefile:351: e2e-instrumentation] Error 1
git branch
* main
  resolve_spec.env

Latest commit :

git log
commit 08312f444170a78673e3b2558955e8695f44fddc (HEAD -> main, tag: v0.1.1, tag: v0.1.0, origin/main, origin/HEAD)
Author: Ben B. <bongartz@klimlive.de>
Date:   Fri Sep 5 12:03:21 2025 +0200

    remove batch processor references (#4334)
    
    Signed-off-by: Benedikt Bongartz <bongartz@klimlive.de>

@pavolloffay pavolloffay requested a review from Copilot September 8, 2025 11:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes incorrect environment variable precedence in the Instrumentation CR, ensuring that variables defined under spec.env correctly override default instrumentation settings. Previously, global environment variables were ignored unless overridden in language-specific sections.

  • Refactors environment variable injection to establish proper precedence: language-specific env vars > spec.env > defaults
  • Introduces new injectDefaultEnvVars method to centralize default environment variable management
  • Prevents modification of environment variables that use ValueFrom references

Reviewed Changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/instrumentation/sdk.go Adds new method for default env var injection and modifies existing injection flow
internal/instrumentation/python.go Moves Python default env vars to separate function and removes inline injection
internal/instrumentation/nodejs.go Extracts Node.js default env vars to separate function with ValueFrom protection
internal/instrumentation/javaagent.go Moves Java agent defaults to separate function with ValueFrom protection
internal/instrumentation/dotnet.go Extracts .NET default env vars to separate function with ValueFrom protection
tests/e2e-instrumentation/* Updates test expectations to reflect new environment variable ordering
internal/instrumentation/*_test.go Modifies unit tests to verify new injection behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

…ectly over defaults

Signed-off-by: Praful Khanduri <holiodin@gmail.com>
…gation fix

Signed-off-by: Praful Khanduri <holiodin@gmail.com>
@Horiodino Horiodino force-pushed the resolve_spec.env branch 2 times, most recently from 85afb82 to 332f3fe Compare September 9, 2025 14:30
@Horiodino Horiodino requested a review from frzifus September 10, 2025 15:51
@Horiodino
Copy link
Contributor Author

Hey folks, could you please review the changes when you get a chance!

…nvs at last

Signed-off-by: Praful Khanduri <holiodin@gmail.com>

fix(auto-instrumentation): updated nodejs & javaagent for propagate the default envs at last

Signed-off-by: Praful Khanduri <holiodin@gmail.com>

test(auto-instrumentation): updated e2e & unit tests

Signed-off-by: Praful Khanduri <holiodin@gmail.com
@Horiodino
Copy link
Contributor Author

cc @frzifus

@Horiodino
Copy link
Contributor Author

I’d really appreciate it if anyone could review. Thank you!

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Given the size and potential for breakage in this change, I'd prefer if another maintainer reviewed this PR before we merge. @jaronoff97 you had plans for refactoring instrumentation injection, can you check if this change interferes with that?

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.

4 participants