forked from hashicorp/nomad-autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update APM query interface to support time range
- Loading branch information
Showing
7 changed files
with
118 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,29 @@ | ||
package sdk | ||
|
||
import "time" | ||
|
||
// TimestampedMetric contains a single metric Value along with its associated | ||
// Timestamp. | ||
type TimestampedMetric struct { | ||
Timestamp time.Time | ||
Value float64 | ||
} | ||
|
||
// TimestampedMetrics is an array of timestamped metric values. This type is | ||
// used so we can sort metrics based on the timestamp. | ||
type TimestampedMetrics []TimestampedMetric | ||
|
||
// Len satisfies the Len function of the sort.Interface interface. | ||
func (t TimestampedMetrics) Len() int { return len(t) } | ||
|
||
// Less satisfies the Less function of the sort.Interface interface. | ||
func (t TimestampedMetrics) Less(i, j int) bool { return t[i].Timestamp.Before(t[j].Timestamp) } | ||
|
||
// Swap satisfies the Swap function of the sort.Interface interface. | ||
func (t TimestampedMetrics) Swap(i, j int) { t[i], t[j] = t[j], t[i] } | ||
|
||
// TimeRange defines a range of time. | ||
type TimeRange struct { | ||
From time.Time | ||
To time.Time | ||
} |
This file contains 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 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