Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Allow config.FromEnv() to enrich an existing config object #436

Merged

Conversation

VineethReddy02
Copy link
Contributor

Which problem is this PR solving?

  • allow the user to override that configuration via env vars

Short description of the changes

  • Added another method with config receiver and modified the existing method to call the method with config receiver.

Signed-off-by: vineeth vineeth.pothulapati@aquasec.com

Resolves: #430

Added an other method with config receiver and modified the existing method to call the method with config receiver.

Resolves: 430
Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

I think this change is not enough though. If you look at the end of this function, samplerConfigFromEnv() and reporterConfigFromEnv() completely override c.Sampler and c.Reporter. Those helper functions also need to be changed to allow inflating the existing configurations.

If you add unit tests for config + env, you'd see it.

…tests.

Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>
config/config_test.go Outdated Show resolved Hide resolved
assert.Equal(t, false, cfg.Disabled)
assert.Equal(t, true, cfg.RPCMetrics)
assert.Equal(t, "KEY", cfg.Tags[0].Key)
assert.Equal(t, "VALUE", cfg.Tags[0].Value)
Copy link
Member

Choose a reason for hiding this comment

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

I suggest to change this test to be more comprehensive, as follows:

  1. manually initialize Config struct (as you do already)
  2. do not set any env vars, just call cfg.FromEnv and assert that the values remained as configured
  3. set env vars, call cfg.FromEnv again
  4. assert that values changed

Right now the test is missing step 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the required validation in the unit test.

… tests

Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>

made chnages to support allow FromEnv for sampler and reporter + Unit tests

Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>
Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>
Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>
Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>
Signed-off-by: vineeth <vineeth.pothulapati@aquasec.com>
@yurishkuro yurishkuro merged commit 0be28c3 into jaegertracing:master Oct 2, 2019
@yurishkuro
Copy link
Member

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow config.FromEnv() to enrich an existing config object
4 participants