Skip to main content

daemonsets.go

daemonsets.go - Overview

  1. Overview This file defines the DaemonSetsRepo struct and its associated methods for retrieving and processing DaemonSet-related metrics and metadata. It interacts with interfaces.Reader and interfaces.Querier to fetch data and provides methods to retrieve attribute keys, values, and a list of DaemonSets with their metrics.

  2. 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: An interfaces.Reader for reading data.
    • querierV2: An interfaces.Querier for querying data.

NewDaemonSetsRepo

func NewDaemonSetsRepo(reader interfaces.Reader, querierV2 interfaces.Querier) *DaemonSetsRepo
  • Purpose: Creates a new DaemonSetsRepo instance.
  • Parameters:
    • reader: An interfaces.Reader instance.
    • querierV2: An interfaces.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: A context.Context for managing the request's lifecycle.
    • req: A v3.FilterAttributeKeyRequest containing the filter criteria.
  • Returns:
    • A pointer to a v3.FilterAttributeKeyResponse containing the attribute keys.
    • An error, if any occurred.

(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: A context.Context for managing the request's lifecycle.
    • req: A v3.FilterAttributeValueRequest containing the filter criteria.
  • Returns:
    • A pointer to a v3.FilterAttributeValueResponse containing the attribute values.
    • An error, if any occurred.

(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: A context.Context for managing the request's lifecycle.
    • req: A model.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: A context.Context for managing the request's lifecycle.
    • req: A model.DaemonSetListRequest containing the request parameters.
    • q: A pointer to a v3.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: A context.Context for managing the request's lifecycle.
    • req: A model.DaemonSetListRequest containing the request parameters.
  • Returns:
    • A model.DaemonSetListResponse containing the list of DaemonSets.
    • An error, if any occurred.
  1. Code Examples None

  2. Clarity and Accuracy The documentation is derived directly from the code and aims to be precise.

  3. Markdown & MDX Perfection The markdown syntax is correct and well-formatted.

  4. Edge Cases To Avoid Breaking MDX All potential MDX breaking characters are escaped properly.

  5. Getting Started Relevance Include in Getting Started: NO