Skip to content
This repository was archived by the owner on Jan 27, 2021. It is now read-only.

Conversation

@vbehar
Copy link
Contributor

@vbehar vbehar commented Oct 4, 2019

Add support for a new annotation osiris.deislabs.io/metricsCheckInterval on deployments,
to override the default metricsCheckInterval on a per-deployment basis.

I kept the same name and unit (seconds) to be consistent.

@codecov-io
Copy link

codecov-io commented Oct 4, 2019

Codecov Report

Merging #39 into master will increase coverage by 1.78%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage    57.3%   59.09%   +1.78%     
==========================================
  Files          11       11              
  Lines         623      638      +15     
==========================================
+ Hits          357      377      +20     
+ Misses        237      232       -5     
  Partials       29       29
Impacted Files Coverage Δ
pkg/kubernetes/osiris.go 100% <100%> (ø) ⬆️
pkg/net/http/httputil/reverseproxy.go 73.01% <0%> (+1.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 113a458...1ddfe31. Read the comment docs.

Add support for a new annotation `osiris.deislabs.io/metricsCheckInterval` on deployments,
to override the default metricsCheckInterval on a per-deployment basis.

I kept the same name and unit (seconds) to be consistent.
@vbehar vbehar force-pushed the per-deployment-metrics-check-interval branch from a646257 to 3eca5e4 Compare October 7, 2019 07:25
metricsCheckInterval = z.cfg.MetricsCheckInterval
}
if metricsCheckInterval <= 0 {
metricsCheckInterval = z.cfg.MetricsCheckInterval
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably worthy of a warning.

deployment.Name,
z.cfg.MetricsCheckInterval,
err,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

The error you return from GetMetricsCheckInterval() already indicates it was an issue with paring the value. Since you're including the text of the error at the end of the warning message, this information basically appears twice.

I would refrain from mentioning the value as "invalid" here and just note "there was an error getting.... falling back to." This way, also, if GetMetricsCheckInterval() ever changes and produces other possible errors as well, there won't be text elsewhere in the code (e.g. right here) that needs to be adjusted to account for the different sorts of errors that function can produce.

t.Run(test.name, func(t *testing.T) {
actual, err := GetMetricsCheckInterval(test.annotations)
if err != nil {
if !test.expectedError {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind using testify for assertions? I believe that is used fairly consistently across the other unit tests (few though they may admittedly be).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@vbehar vbehar force-pushed the per-deployment-metrics-check-interval branch from 2acf827 to 1ddfe31 Compare October 17, 2019 13:40
@krancour krancour self-assigned this Oct 18, 2019
@krancour
Copy link
Contributor

LGTM. Thanks @vbehar!

@krancour krancour merged commit f4df375 into deislabs:master Oct 18, 2019
vbehar added a commit to vbehar/osiris that referenced this pull request Oct 21, 2019
* Allow per-deployment metrics check interval

Add support for a new annotation `osiris.deislabs.io/metricsCheckInterval` on deployments,
to override the default metricsCheckInterval on a per-deployment basis.

I kept the same name and unit (seconds) to be consistent.

* expose error from parsing annotation value

* add documentation

* add a warning if metricsCheckInterval is invalid

* improve warning message

* switch to testify for tests
vbehar added a commit to dailymotion-oss/osiris that referenced this pull request Sep 14, 2020
backport deislabs#39

Add support for a new annotation `osiris.deislabs.io/metricsCheckInterval` on deployments,
to override the default metricsCheckInterval on a per-deployment basis.

I kept the same name and unit (seconds) to be consistent.
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.

3 participants