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

Value of "collect_analytics" isn't read if set via Helm #5787

Closed
csavage5 opened this issue Apr 26, 2024 · 0 comments
Closed

Value of "collect_analytics" isn't read if set via Helm #5787

csavage5 opened this issue Apr 26, 2024 · 0 comments

Comments

@csavage5
Copy link
Contributor

Describe the bug
In the Label Studio Helm chart, all environment variables are forced upper case: https://github.com/HumanSignal/charts/blob/master/heartex/label-studio/templates/app-deployment.yaml#L128
https://github.com/HumanSignal/charts/blob/master/heartex/label-studio/templates/_helpers.tpl#L338

The environment variable collect_analytics is searched for as lower-case, while all other environment variables are upper-case:

COLLECT_ANALYTICS = get_bool_env('collect_analytics', True)

To Reproduce
Steps to reproduce the behavior:

  1. Overwrite global.extraEnvironmentVars.collect_analytics: "False" in Helm
  2. Install to Kubernetes with helm install ...
  3. Value of COLLECT_ANALYTICS in base.py will always be True, since Helm will set the environment variable COLLECT_ANALYTICS to False instead of collect_analytics
  4. Default value True will always be used, as collect_analytics is never set

Expected behavior
As mentioned in the documentation, backend analytics should be disabled when the environment variable "collect_analytics" is set to "False": https://github.com/HumanSignal/label-studio/blob/a9ddaa8c6fe6a8ac21f3728d03127ac656a68c9e/docs/source/guide/security.md#information-collected-by-label-studio

Screenshots
After setting collect_analytics to "False" via Helm, egress traffic to external AWS endpoints is still observed:
324642105-5f862c34-a5f1-40b3-bd96-5d8739b23801

Environment (please complete the following information):

  • OS: Linux
  • Label Studio Version 1.12.0

Additional context
Issue is further discussed here: #4612

jombooth added a commit that referenced this issue May 3, 2024
…5788)

- [x] Commit message(s) and PR title follows the format
`[fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made`
ex. `fix: DEV-XXXX: Removed inconsistent code usage causing intermittent
errors`
- [x] Tests for the changes have been added/updated (for bug
fixes/features)
- [x] Docs have been added/updated (for bug fixes/features)
- [x] Best efforts were made to ensure docs/code are concise and
coherent (checked for spelling/grammatical errors, commented out code,
debug logs etc.)
- [x] Self-reviewed and ran all changes on a local instance (for bug
fixes/features)

_(check all that apply)_
- [ ] Product design
- [ ] Backend (Database)
- [x] Backend (API)
- [ ] Frontend

_(link to issue, supportive screenshots etc.)_
#5787

_(if this is a bug fix)_

Updates `base.py` to search for `COLLECT_ANALYTICS` environment variable
instead of `collect_analytics`

_(if this is a breaking or feature change)_

_(if this is a breaking or feature change)_

_(list all with version changes)_

_(if so describe the impacts positive or negative)_

_(if so describe the impacts positive or negative)_

Positive: backend analytics are properly disabled when deploying with
Helm.

_(briefly list any if applicable)_

_(briefly list any if applicable)_

_(check only one)_
- [ ] Yes, and covered entirely by feature flag(s)
- [ ] Yes, and covered partially by feature flag(s)
- [ ] No
- [x] Not sure (briefly explain the situation below)
The environment variable name is changing to all upper-case - no impact
if using Helm, as it enforces all caps. Other users who pass variables
in with Docker Compose or other setup methods may already be using lower
case, and their setup methods may not enforce all-caps.

_(check all that apply)_
- [ ] e2e
- [ ] integration
- [x] unit

_(for bug fixes/features, be as precise as possible. ex. Authentication,
Annotation History, Review Stream etc.)_
Analytics / logging

---------

Co-authored-by: Jo Booth <jo.m.booth@gmail.com>
bmartel pushed a commit that referenced this issue May 7, 2024
…5788)

### PR fulfills these requirements
- [x] Commit message(s) and PR title follows the format
`[fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made`
ex. `fix: DEV-XXXX: Removed inconsistent code usage causing intermittent
errors`
- [x] Tests for the changes have been added/updated (for bug
fixes/features)
- [x] Docs have been added/updated (for bug fixes/features)
- [x] Best efforts were made to ensure docs/code are concise and
coherent (checked for spelling/grammatical errors, commented out code,
debug logs etc.)
- [x] Self-reviewed and ran all changes on a local instance (for bug
fixes/features)



#### Change has impacts in these area(s)
_(check all that apply)_
- [ ] Product design
- [ ] Backend (Database)
- [x] Backend (API)
- [ ] Frontend



### Describe the reason for change
_(link to issue, supportive screenshots etc.)_
#5787


#### What does this fix?
_(if this is a bug fix)_

Updates `base.py` to search for `COLLECT_ANALYTICS` environment variable
instead of `collect_analytics`

#### What is the new behavior?
_(if this is a breaking or feature change)_



#### What is the current behavior?
_(if this is a breaking or feature change)_



#### What libraries were added/updated?
_(list all with version changes)_



#### Does this change affect performance?
_(if so describe the impacts positive or negative)_



#### Does this change affect security?
_(if so describe the impacts positive or negative)_

Positive: backend analytics are properly disabled when deploying with
Helm.


#### What alternative approaches were there?
_(briefly list any if applicable)_



#### What feature flags were used to cover this change?
_(briefly list any if applicable)_



### Does this PR introduce a breaking change?
_(check only one)_
- [ ] Yes, and covered entirely by feature flag(s)
- [ ] Yes, and covered partially by feature flag(s)
- [ ] No
- [x] Not sure (briefly explain the situation below)
The environment variable name is changing to all upper-case - no impact
if using Helm, as it enforces all caps. Other users who pass variables
in with Docker Compose or other setup methods may already be using lower
case, and their setup methods may not enforce all-caps.


### What level of testing was included in the change?
_(check all that apply)_
- [ ] e2e
- [ ] integration
- [x] unit



### Which logical domain(s) does this change affect?
_(for bug fixes/features, be as precise as possible. ex. Authentication,
Annotation History, Review Stream etc.)_
Analytics / logging

---------

Co-authored-by: Jo Booth <jo.m.booth@gmail.com>
bmartel added a commit that referenced this issue May 7, 2024
…5842)

Cherry-picking a0b30e9

Co-authored-by: Cameron Savage <csavage5@me.com>
Co-authored-by: Jo Booth <jo.m.booth@gmail.com>
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

No branches or pull requests

1 participant