allocationnode.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //go:build !incubating
  2. package costmodel
  3. import (
  4. "time"
  5. "github.com/opencost/opencost/core/pkg/source"
  6. )
  7. // These implementations are placeholders to allow conditional compilation of
  8. // incubating features to be enabled specifically without introducing conflicts
  9. // with the existing codebase. Since go only supports file scoped conditional
  10. // compilation, we need to define these no-op functions in a separate file.
  11. // Once a change is approved to move from incubation to a feature, the methods
  12. // defined here can be moved to the calling file and the build tag removed.
  13. // ExtendedNodeQueryResults is a place holder data type for the incubating
  14. // feature for extending the node details that can be returned with allocation
  15. // data
  16. type extendedNodeQueryResults struct{}
  17. // queryExtendedNodeData is a place holder function for the incubating feature
  18. func queryExtendedNodeData(_ *source.QueryGroup, _ source.MetricsQuerier, _, _ time.Time) (*extendedNodeQueryResults, error) {
  19. return &extendedNodeQueryResults{}, nil
  20. }
  21. // applyExtendedNodeData is a place holder function for the incubating feature
  22. // which appends additional node data to the given node map
  23. func applyExtendedNodeData(nodeMap map[nodeKey]*nodePricing, results *extendedNodeQueryResults) {
  24. }
  25. // nodePricing describes the resource costs associated with a given node,
  26. // as well as the source of the information (e.g. prometheus, custom)
  27. type nodePricing struct {
  28. Name string
  29. NodeType string
  30. ProviderID string
  31. Preemptible bool
  32. CostPerCPUHr float64
  33. CostPerRAMGiBHr float64
  34. CostPerGPUHr float64
  35. Discount float64
  36. Source string
  37. }