-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#46 Defined latency measurement config
- Loading branch information
1 parent
36b1fad
commit dee8bbb
Showing
6 changed files
with
88 additions
and
10 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
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,20 @@ | ||
package latency | ||
|
||
import "time" | ||
|
||
// Config defines setting for moving average latency calculations | ||
type Config struct { | ||
Decay float32 `yaml:"decay" json:"decay"` // Weight of new latency measurements | ||
WarmupSamples int `yaml:"warmup_samples" json:"warmup_samples"` // The number of latency probes required to init moving average | ||
UpdateInterval *time.Duration `yaml:"update_interval,omitempty" json:"update_interval" swaggertype:"primitive,string"` // How often gateway should probe models with not the lowest response latency | ||
} | ||
|
||
func DefaultConfig() *Config { | ||
defaultUpdateInterval := 30 * time.Second | ||
|
||
return &Config{ | ||
Decay: 0.06, | ||
WarmupSamples: 3, | ||
UpdateInterval: &defaultUpdateInterval, | ||
} | ||
} |