-
Notifications
You must be signed in to change notification settings - Fork 606
Cloudwatch metrics #322
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
Merged
Merged
Cloudwatch metrics #322
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
f4503b0
Round 1
vishalbollu a0d82be
Update #2
vishalbollu 2e42615
Merge branch 'master' into cloudwatch-metrics
vishalbollu d604414
Refactor common code
vishalbollu a0a8598
Cleanup metrics.go
vishalbollu 4257d7d
Remove unnecessary cloudwatch files
vishalbollu 22d6a47
Refactor code and fix bug in classes
vishalbollu 46c5bf4
Cleanup examples
vishalbollu 1525630
More cleanup
vishalbollu ca80585
Merge branch 'master' into cloudwatch-metrics
vishalbollu d65225e
Remove logger.info lines
vishalbollu 8ed9d49
Reset cortex.yaml
vishalbollu 9119ade
Reset cortex.yaml again
vishalbollu bf74184
Linting
vishalbollu 9b24a4f
Respond to PR comments
vishalbollu cb05031
Merge branch 'master' into cloudwatch-metrics
vishalbollu 65f75ec
Merge branch 'master' into cloudwatch-metrics
vishalbollu 862b5dc
Add realtime
vishalbollu 6ceca20
Merge branch 'master' into cloudwatch-metrics
vishalbollu 3cca1ff
Cleanup round 1
vishalbollu 7d72882
Add realtime metrics querying
vishalbollu 268e290
Cleanup 2
vishalbollu 0de825c
Merge branch 'master' into cloudwatch-metrics
vishalbollu 02b2760
Fix linting
vishalbollu 5a8b1ce
Address PR comments
vishalbollu 7e8d424
Merge branch 'master' into cloudwatch-metrics
vishalbollu b4c701c
Fix linting
vishalbollu e6baa02
Add custom error
vishalbollu 1bfadb1
Fix typo in errors.go
vishalbollu 147f155
Adjust error messages
vishalbollu 8243dab
Updated error message when key is missing
vishalbollu 0a2efa9
Merge branch 'master' into cloudwatch-metrics
vishalbollu fe3abf4
Merge branch 'master' into cloudwatch-metrics
vishalbollu 64d4f0e
Merge branch 'master' into cloudwatch-metrics
vishalbollu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
Copyright 2019 Cortex Labs, Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package slices | ||
|
||
import ( | ||
"github.com/cortexlabs/cortex/pkg/lib/errors" | ||
) | ||
|
||
// For adding integers stored in floats | ||
func Float64PtrSumInt(floats ...*float64) int { | ||
sum := 0 | ||
for _, num := range floats { | ||
if num != nil { | ||
sum += int(*num) | ||
} | ||
} | ||
return sum | ||
} | ||
|
||
func Float64PtrMin(floats ...*float64) *float64 { | ||
var min *float64 | ||
|
||
for _, num := range floats { | ||
switch { | ||
case num != nil && min != nil && *num < *min: | ||
min = num | ||
case num != nil && min == nil: | ||
min = num | ||
} | ||
} | ||
return min | ||
} | ||
|
||
func Float64PtrMax(floats ...*float64) *float64 { | ||
var max *float64 | ||
|
||
for _, num := range floats { | ||
switch { | ||
case num != nil && max != nil && *num > *max: | ||
max = num | ||
case num != nil && max == nil: | ||
max = num | ||
} | ||
} | ||
return max | ||
} | ||
|
||
func Float64PtrAvg(values []*float64, weights []*float64) (*float64, error) { | ||
if len(values) != len(weights) { | ||
return nil, errors.New("length of values is not equal to length of weights") | ||
} | ||
|
||
totalWeight := 0.0 | ||
for i, valPtr := range values { | ||
if valPtr != nil && weights[i] != nil && *weights[i] > 0 { | ||
totalWeight += *weights[i] | ||
} | ||
} | ||
|
||
if totalWeight == 0.0 { | ||
return nil, nil | ||
} | ||
|
||
avg := 0.0 | ||
for i, valPtr := range values { | ||
if valPtr != nil && weights[i] != nil && *weights[i] > 0 { | ||
avg += (*valPtr) * (*weights[i]) / float64(totalWeight) | ||
} | ||
} | ||
|
||
return &avg, nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.