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

feat: Adding SigV4 Option for Prometheus Metric Analysis #2489

Merged
merged 6 commits into from
Jan 24, 2023

Conversation

lewinkedrs
Copy link
Contributor

@lewinkedrs lewinkedrs commented Dec 16, 2022

Fixes #2458

Checklist:

  • [ a ] Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • [ b ] The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • [ X ] I've signed my commits with DCO
  • [ N/A] I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • [ X ] My builds are green. Try syncing with master if they are not.
  • [ Not a User, building for AMP Community ] My organization is added to USERS.md.

@sonarcloud
Copy link

sonarcloud bot commented Dec 16, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@lewinkedrs lewinkedrs changed the title Adding SigV4 Option for Prometheus Metric Analysis feat: Adding SigV4 Option for Prometheus Metric Analysis Dec 16, 2022
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Base: 81.69% // Head: 81.66% // Decreases project coverage by -0.04% ⚠️

Coverage data is based on head (ad9935c) compared to base (3c2cef9).
Patch coverage: 30.76% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2489      +/-   ##
==========================================
- Coverage   81.69%   81.66%   -0.04%     
==========================================
  Files         126      126              
  Lines       19136    19147      +11     
==========================================
+ Hits        15634    15636       +2     
- Misses       2709     2717       +8     
- Partials      793      794       +1     
Impacted Files Coverage Δ
metricproviders/prometheus/prometheus.go 89.43% <30.76%> (-7.00%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2022

Go Published Test Results

1 834 tests   1 834 ✔️  2m 30s ⏱️
   105 suites         0 💤
       1 files           0

Results for commit ad9935c.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2022

E2E Tests Published Test Results

    2 files      2 suites   1h 34m 9s ⏱️
  95 tests   92 ✔️ 3 💤 0
190 runs  184 ✔️ 6 💤 0

Results for commit ad9935c.

♻️ This comment has been updated with latest results.

@zachaller zachaller added this to the v1.5 milestone Jan 4, 2023
metricproviders/prometheus/prometheus.go Outdated Show resolved Hide resolved
metricproviders/prometheus/prometheus.go Outdated Show resolved Hide resolved
metricproviders/prometheus/prometheus.go Outdated Show resolved Hide resolved
@zachaller
Copy link
Collaborator

Can I have you update from master and fix conflicts?

Signed-off-by: Kevin Lewin <[email protected]>
@lewinkedrs lewinkedrs reopened this Jan 23, 2023
@lewinkedrs
Copy link
Contributor Author

Merged updates from master and fixed merged conflicts. Set AMP substring match back to 'aps-workspaces'. Not sure why the codecov/patch CI check is failing, do we need to do anything more with that?

@zachaller
Copy link
Collaborator

zachaller commented Jan 23, 2023

Merged updates from master and fixed merged conflicts. Set AMP substring match back to 'aps-workspaces'. Not sure why the codecov/patch CI check is failing, do we need to do anything more with that?

Yes it because you added a bunch of code that has no unit tests to cover the newly added code. Looking at your changes a bit more you could improve the coverage a bit more by refactoring your if logic so that you do not duplicate so much code. Bad sudo code below but gets the idea across, would you mind trying to update the logic to follow that pattern?

client, err := api.NewClient(api.Config{
	Address: metric.Provider.Prometheus.Address,
})
if err != nil {
	log.Errorf("Error in getting prometheus client: %v", err)
	return nil, err
}

if strings.Contains(promUrl, amznUrlSubstring) {
                var cfg *sigv4.SigV4Config
	        var next http.RoundTripper
	        sigv4RoundTripper, err := sigv4.NewSigV4RoundTripper(cfg, next)
                client.RoundTripper = sigv4RoundTripper
}
return v1.NewAPI(client), nil

Signed-off-by: Kevin Lewin <[email protected]>
@lewinkedrs
Copy link
Contributor Author

Refactored the code to improve test coverage. It looks like tests are now failing but the failure is in:

/home/runner/work/argo-rollouts/argo-rollouts/rollout/controller_test.go:1952

This is a completely different section of the code. Looking through the error I can't seem to trace it back to anything that was done by creating our prometheus sigv4 client. Any ideas?

@sonarcloud
Copy link

sonarcloud bot commented Jan 24, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@zachaller zachaller merged commit 07694ef into argoproj:master Jan 24, 2023
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.

Prometheus Analysis SigV4 Support
3 participants