Skip to main content

links.go

links.go - Overview

  1. Overview This file provides functions to prepare links to traces and logs views in the SigNoz UI, based on specified time ranges, filter items, and labels. It also includes a function to prepare filter items based on labels, where clauses, and group by items.

  2. Detailed Documentation

Function: PrepareLinksToTraces

  • Purpose: Creates a URL string with encoded parameters to link to a traces list view with specified filters and time range.
  • Parameters:
    • start (time.Time): The start time for the traces.
    • end (time.Time): The end time for the traces.
    • filterItems ([]v3.FilterItem): A slice of filter items to apply to the traces query.
  • Returns:
    • (string): A URL string containing the encoded query parameters for the traces view.

Function: PrepareLinksToLogs

  • Purpose: Creates a URL string with encoded parameters to link to a logs list view with specified filters and time range.
  • Parameters:
    • start (time.Time): The start time for the logs.
    • end (time.Time): The end time for the logs.
    • filterItems ([]v3.FilterItem): A slice of filter items to apply to the logs query.
  • Returns:
    • (string): A URL string containing the encoded query parameters for the logs view.

Function: PrepareFilters

  • Purpose: Prepares a slice of filter items based on provided labels, where clause items, and group by items. It merges and updates filter items, prioritizing labels from the query results and handling cases where labels are present or absent in the original where clause.
  • Parameters:
    • labels (map[string]string): A map of labels (key-value pairs) extracted from the query result.
    • whereClauseItems ([]v3.FilterItem): A slice of filter items representing the original WHERE clause.
    • groupByItems ([]v3.AttributeKey): A slice of attribute keys representing the GROUP BY clause.
    • keys (map[string]v3.AttributeKey): A map of attribute keys used for enrichment.
  • Returns:
    • ([]v3.FilterItem): A slice of prepared filter items.

Include in Getting Started: NO