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-9374 external victoria metrics #1916

Merged
merged 35 commits into from
Sep 18, 2023
Merged

Conversation

BupycHuk
Copy link
Member

@BupycHuk BupycHuk commented Mar 28, 2023

PMM-9374

Link to the Feature Build: SUBMODULES-3331

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).

@BupycHuk BupycHuk requested review from talhabinrizwan and a team as code owners March 28, 2023 18:52
@BupycHuk BupycHuk requested review from idoqo and rishat-ishbulatov and removed request for a team March 28, 2023 18:52
…toria-metrics

# Conflicts:
#	managed/cmd/pmm-managed/main.go
#	managed/services/agents/vmagent.go
@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

Merging #1916 (adddb85) into main (04c35d3) will increase coverage by 0.02%.
Report is 6 commits behind head on main.
The diff coverage is 42.95%.

@@            Coverage Diff             @@
##             main    #1916      +/-   ##
==========================================
+ Coverage   42.71%   42.73%   +0.02%     
==========================================
  Files         384      384              
  Lines       48188    48273      +85     
==========================================
+ Hits        20582    20631      +49     
- Misses      25668    25700      +32     
- Partials     1938     1942       +4     
Flag Coverage Δ
admin 10.41% <ø> (-0.05%) ⬇️
agent 53.27% <ø> (+0.15%) ⬆️
managed 43.73% <42.64%> (-0.01%) ⬇️
vmproxy 68.57% <50.00%> (-1.13%) ⬇️

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

Files Changed Coverage Δ
managed/cmd/pmm-managed/main.go 0.00% <0.00%> (ø)
managed/services/agents/registry.go 0.00% <0.00%> (ø)
managed/services/agents/state.go 0.00% <0.00%> (ø)
managed/services/supervisord/pmm_config.go 7.69% <ø> (ø)
managed/utils/envvars/parser.go 60.40% <0.00%> (-2.23%) ⬇️
...anaged/services/victoriametrics/victoriametrics.go 46.35% <37.50%> (-4.96%) ⬇️
vmproxy/proxy/proxy.go 84.93% <50.00%> (-3.13%) ⬇️
managed/models/victoriametrics_params.go 64.70% <66.66%> (ø)
managed/services/supervisord/logs.go 49.54% <66.66%> (+0.16%) ⬆️
managed/services/agents/vmagent.go 100.00% <100.00%> (ø)
... and 1 more

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -23,11 +23,11 @@ import (

func TestVictoriaMetricsParams(t *testing.T) {
t.Run("read non exist baseConfigFile", func(t *testing.T) {
_, err := NewVictoriaMetricsParams("nonExistConfigFile.yml")
_, err := NewVictoriaMetricsParams("nonExistConfigFile.yml", "", "", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
too many arguments in call to NewVictoriaMetricsParams

require.NoError(t, err)
})
t.Run("check params for VMAlert", func(t *testing.T) {
vmp, err := NewVictoriaMetricsParams("../testdata/victoriametrics/prometheus.external.alerts.yml")
vmp, err := NewVictoriaMetricsParams("../testdata/victoriametrics/prometheus.external.alerts.yml", "", "", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
too many arguments in call to NewVictoriaMetricsParams

@@ -23,11 +23,11 @@

func TestVictoriaMetricsParams(t *testing.T) {
t.Run("read non exist baseConfigFile", func(t *testing.T) {
_, err := NewVictoriaMetricsParams("nonExistConfigFile.yml")
_, err := NewVictoriaMetricsParams("nonExistConfigFile.yml", "", "", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
too many arguments in call to NewVictoriaMetricsParams

require.NoError(t, err)
})
t.Run("check params for VMAlert", func(t *testing.T) {
vmp, err := NewVictoriaMetricsParams("../testdata/victoriametrics/prometheus.external.alerts.yml")
vmp, err := NewVictoriaMetricsParams("../testdata/victoriametrics/prometheus.external.alerts.yml", "", "", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
too many arguments in call to NewVictoriaMetricsParams

Comment on lines 66 to 70
func NewLogs(pmmVersion string, pmmUpdateChecker *PMMUpdateChecker) *Logs {
func NewLogs(pmmVersion string, pmmUpdateChecker *PMMUpdateChecker, vmParams *models.VictoriaMetricsParams) *Logs {
return &Logs{
Copy link
Contributor

@rishat-ishbulatov rishat-ishbulatov Apr 4, 2023

Choose a reason for hiding this comment

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

Maybe we could do it in a more abstract manner? For example vmParams getter? Than if in future we change mechanism that gets us a new vmParams we wont rewrite this place? )

Comment on lines 50 to 51
func NewStateUpdater(db *reform.DB, r *Registry, vmdb prometheusService) *StateUpdater {
func NewStateUpdater(db *reform.DB, r *Registry, vmdb prometheusService, vmParams *models.VictoriaMetricsParams) *StateUpdater {
return &StateUpdater{
db: db,
Copy link
Contributor

@rishat-ishbulatov rishat-ishbulatov Apr 4, 2023

Choose a reason for hiding this comment

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

Can we change concrete implementation with abstract one?

Copy link
Contributor

@rishat-ishbulatov rishat-ishbulatov left a comment

Choose a reason for hiding this comment

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

cool )

}
}

func relativePath(baseURL string, path string) (*url.URL, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
func relativePath is unused (unused)

func NewVictoriaMetricsParams(basePath string) (*VictoriaMetricsParams, error) {
func NewVictoriaMetricsParams(basePath string, vmURL string) (*VictoriaMetricsParams, error) {
if !strings.HasSuffix(vmURL, "/") {
vmURL = vmURL + "/"
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
assignOp: replace vmURL = vmURL + "/" with vmURL += "/" (gocritic)

case "PMM_VM_URL":
_, err := url.Parse(v)
if err != nil {
err = fmt.Errorf("invalid value %q for environment variable %q", v, k)
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
ineffectual assignment to err (ineffassign)

@BupycHuk BupycHuk merged commit ffc66f0 into main Sep 18, 2023
30 of 32 checks passed
@BupycHuk BupycHuk deleted the PMM-9374-external-victoria-metrics branch September 18, 2023 10:01
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.

3 participants