translator.go
translator.go - Overview
This file defines functions to process and transform data related to third-party API integrations, specifically for querying and filtering domain-related information. It includes functions for filtering responses, building query parameters for domain lists and domain information, and handling filter and group by operations.
Detailed Documentation
FilterResponse
- Purpose: Filters the response data by removing rows where the
net.peer.name
field contains a valid IP address. - Parameters:
results
([]*v3.Result): A slice ofv3.Result
pointers containing the query results.
- Returns:
[]*v3.Result
: A slice ofv3.Result
pointers with rows containing IP addresses in thenet.peer.name
field filtered out.
getFilterSet
- Purpose: Appends filter items from
apiFilters
toexistingFilters
ifapiFilters
contains any items. - Parameters:
existingFilters
([]v3.FilterItem): A slice of existingv3.FilterItem
to which new filters will be appended.apiFilters
(v3.FilterSet): Av3.FilterSet
containing filter items to be added.
- Returns:
[]v3.FilterItem
: A new slice ofv3.FilterItem
containing all filter items from both input slices.
getGroupBy
- Purpose: Appends group by attributes from
apiGroupBy
toexistingGroupBy
ifapiGroupBy
contains any attributes. - Parameters:
existingGroupBy
([]v3.AttributeKey): A slice of existingv3.AttributeKey
attributes to which new attributes will be appended.apiGroupBy
([]v3.AttributeKey): A slice ofv3.AttributeKey
attributes to be added.
- Returns:
[]v3.AttributeKey
: A new slice ofv3.AttributeKey
containing all group by attributes from both input slices.
BuildDomainList
- Purpose: Constructs a
v3.QueryRangeParamsV3
object configured to fetch and aggregate data for a list of domains, including metrics like endpoints, last seen time, requests per second (RPS), error rate, and P99 latency. - Parameters:
thirdPartyApis
(*ThirdPartyApis): A pointer to aThirdPartyApis
struct containing configuration parameters such as start and end times, filters, and group by attributes.
- Returns:
*v3.QueryRangeParamsV3
: A pointer to the constructedv3.QueryRangeParamsV3
object.error
: An error object, which is nil if the function executes successfully.
BuildDomainInfo
- Purpose: Constructs a
v3.QueryRangeParamsV3
object configured to fetch detailed information for domains, including metrics like the number of endpoints, P99 latency, error rate, and last seen time. - Parameters:
thirdPartyApis
(*ThirdPartyApis): A pointer to aThirdPartyApis
struct containing configuration parameters such as start and end times, filters, and group by attributes.
- Returns:
*v3.QueryRangeParamsV3
: A pointer to the constructedv3.QueryRangeParamsV3
object.error
: An error object, which is nil if the function executes successfully.
Code Examples
None.
Include in Getting Started: NO