Skip to main content

pods.go

pods.go - Overview

  1. Overview The pods.go file defines a PodsRepo struct and its associated methods for querying and retrieving Kubernetes pod-related metrics and metadata. It interacts with a reader and querier to fetch data and format it for use in the SigNoz query service. The file also includes functions to determine the status of pod metrics and metadata being sent to SigNoz.

  2. Detailed Documentation

PodsRepo

  • Purpose: Represents a repository for retrieving pod-related information.
  • Parameters: None
  • Returns: None

NewPodsRepo

  • Purpose: Creates a new PodsRepo instance.
  • Parameters:
    • reader (interfaces.Reader): An interface for reading data, likely from a database.
    • querierV2 (interfaces.Querier): An interface for querying data.
  • Returns: *PodsRepo: A pointer to the newly created PodsRepo instance.

(*PodsRepo) GetPodAttributeKeys

  • Purpose: Retrieves attribute keys associated with pods.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
    • req (v3.FilterAttributeKeyRequest): Request object specifying filters and limits for attribute keys.
  • Returns:
    • *v3.FilterAttributeKeyResponse: Response containing the filtered attribute keys.
    • error: An error if any occurred during the retrieval process.

(*PodsRepo) GetPodAttributeValues

  • Purpose: Retrieves attribute values for a given pod attribute key.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
    • req (v3.FilterAttributeValueRequest): Request object specifying the attribute key and filters for values.
  • Returns:
    • *v3.FilterAttributeValueResponse: Response containing the attribute values.
    • error: An error if any occurred during the retrieval process.

(*PodsRepo) DidSendPodMetrics

  • Purpose: Checks if pod metrics have been sent to SigNoz.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
  • Returns:
    • bool: True if pod metrics have been sent, false otherwise.
    • error: An error if any occurred during the check.

(*PodsRepo) DidSendClusterMetrics

  • Purpose: Checks if cluster metrics have been sent to SigNoz.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
  • Returns:
    • bool: True if cluster metrics have been sent, false otherwise.
    • error: An error if any occurred during the check.

(*PodsRepo) IsSendingOptionalPodMetrics

  • Purpose: Checks if optional pod metrics are being sent to SigNoz.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
  • Returns:
    • bool: True if optional pod metrics are being sent, false otherwise.
    • error: An error if any occurred during the check.

(*PodsRepo) SendingRequiredMetadata

  • Purpose: Checks if the required metadata for pods is being sent to SigNoz.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
  • Returns:
    • []model.PodOnboardingStatus: A slice of PodOnboardingStatus structs, each indicating the status of required metadata for a pod.
    • error: An error if any occurred during the check.

(*PodsRepo) getMetadataAttributes

  • Purpose: Retrieves metadata attributes for pods based on the provided request.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
    • req (model.PodListRequest): Request object specifying the pod list and group by attributes.
  • Returns:
    • map[string]map[string]string: A map where the key is the pod UID and the value is a map of attribute keys to their corresponding values.
    • error: An error if any occurred during the retrieval process.

(*PodsRepo) getTopPodGroups

  • Purpose: Retrieves the top pod groups based on the provided request and query parameters.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
    • req (model.PodListRequest): Request object specifying the pod list and ordering.
    • q (*v3.QueryRangeParamsV3): Query range parameters for the request.
  • Returns:
    • []map[string]string: A slice of maps representing the top pod groups, where each map contains the labels for a pod group.
    • []map[string]string: A slice of maps representing all pod groups.
    • error: An error if any occurred during the retrieval process.

(*PodsRepo) GetPodList

  • Purpose: Retrieves a list of pods based on the provided request.
  • Parameters:
    • ctx (context.Context): Context for managing the lifecycle of the request.
    • req (model.PodListRequest): Request object specifying filters, limits, and ordering for the pod list.
  • Returns:
    • model.PodListResponse: Response containing the list of pods and related information.
    • error: An error if any occurred during the retrieval process.
  1. Code Examples None

  2. Clarity and Accuracy The documentation accurately reflects the code's functionality based on the provided information.

// Example usage is not applicable as the code defines data structures and methods
// and relies on external interfaces and configurations.

Include in Getting Started: NO