daemonsets.go
daemonsets.go - Overview
-
Overview This file defines the
DaemonSetsRepo
struct and its associated methods for retrieving and processing DaemonSet-related metrics and metadata. It interacts withinterfaces.Reader
andinterfaces.Querier
to fetch data and provides methods to retrieve attribute keys, values, and a list of DaemonSets with their metrics. -
Detailed Documentation
metricToUseForDaemonSets
- Purpose: Defines the metric to use for DaemonSets.
- Type: string
- Value:
"k8s_pod_cpu_utilization"
k8sDaemonSetNameAttrKey
- Purpose: Defines the attribute key for the DaemonSet name.
- Type: string
- Value:
"k8s_daemonset_name"
metricNamesForDaemonSets
- Purpose: Defines a map of metric names for DaemonSets.
- Type:
map[string]string
- Keys:
"desired_nodes"
,"available_nodes"
- Values:
"k8s_daemonset_desired_scheduled_nodes"
,"k8s_daemonset_current_scheduled_nodes"
daemonSetAttrsToEnrich
- Purpose: Defines a list of DaemonSet attributes to enrich.
- Type:
[]string
- Values:
"k8s_daemonset_name"
,"k8s_namespace_name"
,"k8s_cluster_name"
queryNamesForDaemonSets
- Purpose: Defines a map of query names for different metrics related to DaemonSets.
- Type:
map[string][]string
- Keys:
"cpu"
,"cpu_request"
,"cpu_limit"
,"memory"
,"memory_request"
,"memory_limit"
,"restarts"
,"desired_nodes"
,"available_nodes"
- Values: Corresponding query names (e.g.,
{"A"}
for"cpu"
)
builderQueriesForDaemonSets
- Purpose: Defines a map of builder queries for DaemonSets.
- Type:
map[string]*v3.BuilderQuery
- Keys:
"H"
,"I"
- Values: Pointers to
v3.BuilderQuery
structs representing the queries.
daemonSetQueryNames
- Purpose: Defines a list of query names related to DaemonSets.
- Type:
[]string
- Values:
"A"
,"B"
,"C"
,"D"
,"E"
,"F"
,"G"
,"H"
,"I"
DaemonSetsRepo
- Purpose: Represents a repository for retrieving and processing DaemonSet-related data.
- Fields:
reader
: Aninterfaces.Reader
for reading data.querierV2
: Aninterfaces.Querier
for querying data.
NewDaemonSetsRepo
func NewDaemonSetsRepo(reader interfaces.Reader, querierV2 interfaces.Querier) *DaemonSetsRepo
- Purpose: Creates a new
DaemonSetsRepo
instance. - Parameters:
reader
: Aninterfaces.Reader
instance.querierV2
: Aninterfaces.Querier
instance.
- Returns: A pointer to a new
DaemonSetsRepo
instance.
(d *DaemonSetsRepo) GetDaemonSetAttributeKeys
func (d *DaemonSetsRepo) GetDaemonSetAttributeKeys(ctx context.Context, req v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error)
- Purpose: Retrieves attribute keys for DaemonSets based on the provided request.
- Parameters:
ctx
: Acontext.Context
for managing the request's lifecycle.req
: Av3.FilterAttributeKeyRequest
containing the filter criteria.
- Returns:
- A pointer to a
v3.FilterAttributeKeyResponse
containing the attribute keys. - An error, if any occurred.
- A pointer to a
(d *DaemonSetsRepo) GetDaemonSetAttributeValues
func (d *DaemonSetsRepo) GetDaemonSetAttributeValues(ctx context.Context, req v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error)
- Purpose: Retrieves attribute values for DaemonSets based on the provided request.
- Parameters:
ctx
: Acontext.Context
for managing the request's lifecycle.req
: Av3.FilterAttributeValueRequest
containing the filter criteria.
- Returns:
- A pointer to a
v3.FilterAttributeValueResponse
containing the attribute values. - An error, if any occurred.
- A pointer to a
(d *DaemonSetsRepo) getMetadataAttributes
func (d *DaemonSetsRepo) getMetadataAttributes(ctx context.Context, req model.DaemonSetListRequest) (map[string]map[string]string, error)
- Purpose: Retrieves metadata attributes for DaemonSets.
- Parameters:
ctx
: Acontext.Context
for managing the request's lifecycle.req
: Amodel.DaemonSetListRequest
containing the request parameters.
- Returns:
- A map of DaemonSet names to a map of attribute keys and values.
- An error, if any occurred.
(d *DaemonSetsRepo) getTopDaemonSetGroups
func (d *DaemonSetsRepo) getTopDaemonSetGroups(ctx context.Context, req model.DaemonSetListRequest, q *v3.QueryRangeParamsV3) ([]map[string]string, []map[string]string, error)
- Purpose: Retrieves the top DaemonSet groups based on the provided request and query parameters.
- Parameters:
ctx
: Acontext.Context
for managing the request's lifecycle.req
: Amodel.DaemonSetListRequest
containing the request parameters.q
: A pointer to av3.QueryRangeParamsV3
containing the query parameters.
- Returns:
- A slice of maps representing the top DaemonSet groups.
- A slice of maps representing all DaemonSet groups.
- An error, if any occurred.
(d *DaemonSetsRepo) GetDaemonSetList
func (d *DaemonSetsRepo) GetDaemonSetList(ctx context.Context, req model.DaemonSetListRequest) (model.DaemonSetListResponse, error)
- Purpose: Retrieves a list of DaemonSets based on the provided request.
- Parameters:
ctx
: Acontext.Context
for managing the request's lifecycle.req
: Amodel.DaemonSetListRequest
containing the request parameters.
- Returns:
- A
model.DaemonSetListResponse
containing the list of DaemonSets. - An error, if any occurred.
- A
-
Code Examples None
-
Clarity and Accuracy The documentation is derived directly from the code and aims to be precise.
-
Markdown & MDX Perfection The markdown syntax is correct and well-formatted.
-
Edge Cases To Avoid Breaking MDX All potential MDX breaking characters are escaped properly.
-
Getting Started Relevance Include in Getting Started: NO