collectorenv.go 1019 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package env
  2. import (
  3. "github.com/opencost/opencost/core/pkg/env"
  4. )
  5. const (
  6. ClusterIDEnvVar = "CLUSTER_ID"
  7. NetworkPortEnvVar = "NETWORK_PORT"
  8. Collector10mResolutionRetention = "COLLECTOR_10M_RESOLUTION_RETENTION"
  9. Collector1hResolutionRetention = "COLLECTOR_1H_RESOLUTION_RETENTION"
  10. Collection1dResolutionRetention = "COLLECTOR_1D_RESOLUTION_RETENTION"
  11. CollectorScrapeInterval = "COLLECTOR_SCRAPE_INTERVAL"
  12. )
  13. func GetClusterID() string {
  14. return env.Get(ClusterIDEnvVar, "")
  15. }
  16. func GetNetworkPort() int {
  17. return env.GetInt(NetworkPortEnvVar, 3001)
  18. }
  19. func GetCollector10mResolutionRetention() int {
  20. return env.GetInt(Collector10mResolutionRetention, 36)
  21. }
  22. func GetCollector1hResolutionRetention() int {
  23. return env.GetInt(Collector1hResolutionRetention, 49)
  24. }
  25. func GetCollection1dResolutionRetention() int {
  26. return env.GetInt(Collection1dResolutionRetention, 15)
  27. }
  28. func GetCollectorScrapeIntervalSeconds() string {
  29. return env.Get(CollectorScrapeInterval, "30s")
  30. }