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

PMM-12619: Make PMM environment variables more consistent #2857

Merged
merged 29 commits into from
Apr 24, 2024

Conversation

idoqo
Copy link
Contributor

@idoqo idoqo commented Feb 28, 2024

PMM-12619

Link to the Feature Build: SUBMODULES-0

If this PR adds or removes or alters one or more API endpoints, please review and add or update the relevant API documents as well:

  • API Docs updated

If this PR is related to some other PRs in this or other repositories, please provide links to those PRs:

  • Links to related pull requests (optional).

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (v3@c6044df). Click here to learn what that means.

❗ Current head 8c2ad98 differs from pull request most recent head 9d049da. Consider uploading reports for the commit 9d049da to get more accurate results

Additional details and impacted files
@@          Coverage Diff          @@
##             v3    #2857   +/-   ##
=====================================
  Coverage      ?   43.52%           
=====================================
  Files         ?      364           
  Lines         ?    42558           
  Branches      ?        0           
=====================================
  Hits          ?    18525           
  Misses        ?    22427           
  Partials      ?     1606           
Flag Coverage Δ
admin 11.54% <ø> (?)
vmproxy 68.57% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

managed/services/server/server.go Outdated Show resolved Hide resolved
managed/utils/envvars/parser.go Outdated Show resolved Hide resolved
managed/services/checks/checks.go Outdated Show resolved Hide resolved
managed/CONTRIBUTING.md Outdated Show resolved Hide resolved
@idoqo idoqo marked this pull request as ready for review March 3, 2024 11:17
@idoqo idoqo requested review from a team as code owners March 3, 2024 11:17
@idoqo idoqo requested review from ademidoff, BupycHuk and JiriCtvrtka and removed request for a team March 3, 2024 11:17
managed/CONTRIBUTING.md Outdated Show resolved Hide resolved
.github/workflows/api-tests.yml Outdated Show resolved Hide resolved
agent/docker-compose.yml Outdated Show resolved Hide resolved
api-tests/docker-compose.yml Outdated Show resolved Hide resolved
build/docker/server/README.md Outdated Show resolved Hide resolved
docs/process/v2_to_v3_environment_variables.md Outdated Show resolved Hide resolved
docs/process/v2_to_v3_environment_variables.md Outdated Show resolved Hide resolved
docs/process/v2_to_v3_environment_variables.md Outdated Show resolved Hide resolved
docs/process/v2_to_v3_environment_variables.md Outdated Show resolved Hide resolved
managed/utils/envvars/parser.go Outdated Show resolved Hide resolved
agent/docker-compose.yml Outdated Show resolved Hide resolved
build/docker/server/README.md Show resolved Hide resolved
@BupycHuk BupycHuk self-requested a review March 8, 2024 15:38
@idoqo idoqo force-pushed the PMM-12619-env-vars-rename branch from 5bf5bf7 to 47c31c6 Compare March 11, 2024 21:47
@idoqo idoqo requested a review from ademidoff March 12, 2024 02:00
Copy link
Member

@BupycHuk BupycHuk left a comment

Choose a reason for hiding this comment

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

please check if we have any other env variables used that we missed in this PR

managed/CONTRIBUTING.md Outdated Show resolved Hide resolved
- PMM_CLICKHOUSE_DATABASE=pmm
- PMM_CLICKHOUSE_BLOCK_SIZE=10000
- PMM_CLICKHOUSE_POOL_SIZE=2
- PMM_TEST_PMM_DISABLE_BUILTIN_CLICKHOUSE=1
Copy link
Member

Choose a reason for hiding this comment

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

@idoqo this one isn't addressed yet

docker-compose.yml Outdated Show resolved Hide resolved
managed/services/supervisord/supervisord.go Outdated Show resolved Hide resolved
managed/utils/envvars/parser.go Outdated Show resolved Hide resolved
managed/utils/envvars/parser.go Show resolved Hide resolved
managed/utils/envvars/parser.go Show resolved Hide resolved
managed/utils/envvars/parser.go Show resolved Hide resolved
@idoqo idoqo requested a review from BupycHuk March 27, 2024 11:32
// - PMM_METRICS_RESOLUTION, PMM_METRICS_RESOLUTION_MR, PMM_METRICS_RESOLUTION_HR, PMM_METRICS_RESOLUTION_LR are durations of metrics resolution;
// - PMM_DATA_RETENTION is the duration of how long keep time-series data in ClickHouse;
// - PMM_ENABLE_AZURE_DISCOVER enables Azure Discover;
// - PMM_ENABLE_RBAC enables Access control;
Copy link
Member

Choose a reason for hiding this comment

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

@idoqo @BupycHuk
Guys, do we want this to be PMM_ENABLE_ACCESS_CONTROL going forward? That seems to be in line with the other migration, where we rename the gRPC service "Roles" to AccessControl.

Copy link
Member

Choose a reason for hiding this comment

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

agree

PMM_POSTGRES_SSL_KEY_PATH="{{ .PostgresSSLKeyPath }}",
PMM_POSTGRES_SSL_CERT_PATH="{{ .PostgresSSLCertPath }}",
PMM_CLICKHOUSE_DATASOURCE_ADDR="{{ .ClickhouseDataSourceAddr }}",
PERCONA_DEV_PMM_CLICKHOUSE_HOST="{{ .ClickhouseHost }}",
Copy link
Member

Choose a reason for hiding this comment

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

missed?

Copy link
Member

Choose a reason for hiding this comment

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

please check if we have it anywhere else

Copy link
Member

Choose a reason for hiding this comment

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

I meant that it supposed to be PMM_CLICKHOUSE_HOST

// - PMM_METRICS_RESOLUTION, PMM_METRICS_RESOLUTION_MR, PMM_METRICS_RESOLUTION_HR, PMM_METRICS_RESOLUTION_LR are durations of metrics resolution;
// - PMM_DATA_RETENTION is the duration of how long keep time-series data in ClickHouse;
// - PMM_ENABLE_AZURE_DISCOVER enables Azure Discover;
// - PMM_ENABLE_RBAC enables Access control;
Copy link
Member

Choose a reason for hiding this comment

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

agree

docs/process/v2_to_v3_environment_variables.md Outdated Show resolved Hide resolved
managed/CONTRIBUTING.md Outdated Show resolved Hide resolved
managed/CONTRIBUTING.md Outdated Show resolved Hide resolved
managed/utils/envvars/parser.go Outdated Show resolved Hide resolved
managed/utils/envvars/parser.go Outdated Show resolved Hide resolved
Copy link
Member

@BupycHuk BupycHuk left a comment

Choose a reason for hiding this comment

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

CI is failing and we still have PERCONA_DEV_PMM_CLICKHOUSE_HOST which supposed to be PMM_CLICKHOUSE_HOST

managed/utils/envvars/parser.go Outdated Show resolved Hide resolved
Comment on lines 61 to 76
t.Run("Unknown env variables", func(t *testing.T) {
t.Parallel()

envs := []string{"UNKNOWN_VAR=VAL", "ANOTHER_UNKNOWN_VAR=VAL"}
expectedEnvVars := &models.ChangeSettingsParams{}
expectedWarns := []string{
`unknown environment variable "UNKNOWN_VAR=VAL"`,
`unknown environment variable "ANOTHER_UNKNOWN_VAR=VAL"`,
}

gotEnvVars, gotErrs, gotWarns := ParseEnvVars(envs)
assert.Equal(t, gotEnvVars, expectedEnvVars)
assert.Nil(t, gotErrs)
assert.Equal(t, expectedWarns, gotWarns)
})

Copy link
Member

Choose a reason for hiding this comment

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

can we return this test?

managed/utils/envvars/parser_test.go Outdated Show resolved Hide resolved
@idoqo idoqo requested a review from BupycHuk April 23, 2024 08:19
@BupycHuk
Copy link
Member

CI is still failing with message

managed/services/server/server.go:491: line is 171 characters (lll)
  		return status.Error(codes.FailedPrecondition, "High resolution for metrics is set via PMM_METRICS_RESOLUTION_HR (or PMM_METRICS_RESOLUTION) environment variable.")

@idoqo idoqo merged commit 3aed8f3 into v3 Apr 24, 2024
22 checks passed
@idoqo idoqo deleted the PMM-12619-env-vars-rename branch April 24, 2024 10:26
idoqo added a commit that referenced this pull request Apr 30, 2024
* refactored environment variables

* update migration doc

* replace test line

* drop no lint rule

* fix parser tests

* re-order table values

* remove deprecated env variables

* fix tests

* use singluar advisor

* introduce PMM_DEV_ prefix for dev-related variables

* clean up environment variables

* drop printf

* drop unused variable

* update tests

* add notes for removed variable

* update oauth variables

* update changed variable list

* update variable check validation

* refactor tests

* surpress linter error
idoqo added a commit that referenced this pull request May 21, 2024
…2982)

* PMM-12619: Make PMM environment variables more consistent (#2857)

* refactored environment variables

* update migration doc

* replace test line

* drop no lint rule

* fix parser tests

* re-order table values

* remove deprecated env variables

* fix tests

* use singluar advisor

* introduce PMM_DEV_ prefix for dev-related variables

* clean up environment variables

* drop printf

* drop unused variable

* update tests

* add notes for removed variable

* update oauth variables

* update changed variable list

* update variable check validation

* refactor tests

* surpress linter error

* fix docker readme

* restore error checks

* include backup management variable

* Update for grammar
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.

None yet

4 participants