Documentation
¶
Index ¶
- func ExtractLogType(logType string) string
- type Client
- type ComponentQueryParams
- type ComponentTracesRequestParams
- type FieldMapping
- type GatewayQueryParams
- type Hit
- type IndexMapping
- type LogEntry
- type MappingResponse
- type QueryBuilder
- func (qb *QueryBuilder) BuildComponentLogsQuery(params ComponentQueryParams) map[string]interface{}
- func (qb *QueryBuilder) BuildComponentTracesQuery(params ComponentTracesRequestParams) map[string]interface{}
- func (qb *QueryBuilder) BuildGatewayLogsQuery(params GatewayQueryParams) map[string]interface{}
- func (qb *QueryBuilder) BuildOrganizationLogsQuery(params QueryParams, podLabels map[string]string) map[string]interface{}
- func (qb *QueryBuilder) BuildProjectLogsQuery(params QueryParams, componentIDs []string) map[string]interface{}
- func (qb *QueryBuilder) CheckQueryVersion(mapping *MappingResponse, indexName string) string
- func (qb *QueryBuilder) GenerateIndices(startTime, endTime string) ([]string, error)
- type QueryParams
- type SearchResponse
- type Span
- type TraceResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractLogType ¶
ExtractLogType determines the log type from query parameters or defaults to RUNTIME
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the OpenSearch client with logging and configuration
func (*Client) GetIndexMapping ¶
GetIndexMapping retrieves the mapping for a specific index
func (*Client) HealthCheck ¶
HealthCheck performs a basic health check on the OpenSearch cluster
type ComponentQueryParams ¶
type ComponentQueryParams struct {
QueryParams
BuildID string `json:"buildId,omitempty"`
BuildUUID string `json:"buildUuid,omitempty"`
}
ComponentQueryParams holds component-specific query parameters
type ComponentTracesRequestParams ¶ added in v0.4.0
type ComponentTracesRequestParams struct {
EndTime string `json:"endTime"`
Limit int `json:"limit,omitempty"`
ServiceName string `json:"serviceName"`
SortOrder string `json:"sortOrder,omitempty"`
StartTime string `json:"startTime"`
}
ComponentTracesRequestParams holds request body parameters for component traces
type FieldMapping ¶
type FieldMapping struct {
Type string `json:"type"`
Fields map[string]FieldMapping `json:"fields,omitempty"`
Properties map[string]FieldMapping `json:"properties,omitempty"`
}
FieldMapping represents the mapping for a single field
type GatewayQueryParams ¶
type GatewayQueryParams struct {
QueryParams
OrganizationID string `json:"organizationId"`
APIIDToVersionMap map[string]string `json:"apiIdToVersionMap"`
GatewayVHosts []string `json:"gatewayVHosts"`
}
GatewayQueryParams holds gateway-specific query parameters
type IndexMapping ¶
type IndexMapping struct {
Mappings struct {
Properties map[string]FieldMapping `json:"properties"`
} `json:"mappings"`
}
IndexMapping represents the mapping for a single index
type LogEntry ¶
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Log string `json:"log"`
LogLevel string `json:"logLevel"`
ComponentID string `json:"componentId"`
EnvironmentID string `json:"environmentId"`
ProjectID string `json:"projectId"`
Version string `json:"version"`
VersionID string `json:"versionId"`
Namespace string `json:"namespace"`
PodID string `json:"podId"`
ContainerName string `json:"containerName"`
Labels map[string]string `json:"labels"`
}
LogEntry represents a parsed log entry from OpenSearch
func ParseLogEntry ¶
ParseLogEntry converts a search hit to a LogEntry struct
type MappingResponse ¶
type MappingResponse struct {
Mappings map[string]IndexMapping `json:",inline"`
}
MappingResponse represents the response from an index mapping query
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder provides methods to build OpenSearch queries
func NewQueryBuilder ¶
func NewQueryBuilder(indexPrefix string) *QueryBuilder
NewQueryBuilder creates a new query builder with the given index prefix
func (*QueryBuilder) BuildComponentLogsQuery ¶
func (qb *QueryBuilder) BuildComponentLogsQuery(params ComponentQueryParams) map[string]interface{}
BuildComponentLogsQuery builds a query for component logs with wildcard search
func (*QueryBuilder) BuildComponentTracesQuery ¶ added in v0.4.0
func (qb *QueryBuilder) BuildComponentTracesQuery(params ComponentTracesRequestParams) map[string]interface{}
func (*QueryBuilder) BuildGatewayLogsQuery ¶
func (qb *QueryBuilder) BuildGatewayLogsQuery(params GatewayQueryParams) map[string]interface{}
BuildGatewayLogsQuery builds a query for gateway logs with wildcard search
func (*QueryBuilder) BuildOrganizationLogsQuery ¶
func (qb *QueryBuilder) BuildOrganizationLogsQuery(params QueryParams, podLabels map[string]string) map[string]interface{}
BuildOrganizationLogsQuery builds a query for organization logs with wildcard search
func (*QueryBuilder) BuildProjectLogsQuery ¶
func (qb *QueryBuilder) BuildProjectLogsQuery(params QueryParams, componentIDs []string) map[string]interface{}
BuildProjectLogsQuery builds a query for project logs with wildcard search
func (*QueryBuilder) CheckQueryVersion ¶
func (qb *QueryBuilder) CheckQueryVersion(mapping *MappingResponse, indexName string) string
CheckQueryVersion determines if the index supports V2 wildcard queries
func (*QueryBuilder) GenerateIndices ¶
func (qb *QueryBuilder) GenerateIndices(startTime, endTime string) ([]string, error)
GenerateIndices generates the list of indices to search based on time range
type QueryParams ¶
type QueryParams struct {
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
SearchPhrase string `json:"searchPhrase"`
LogLevels []string `json:"logLevels"`
Limit int `json:"limit"`
SortOrder string `json:"sortOrder"`
ComponentID string `json:"componentId,omitempty"`
EnvironmentID string `json:"environmentId,omitempty"`
ProjectID string `json:"projectId,omitempty"`
OrganizationID string `json:"organizationId,omitempty"`
Namespace string `json:"namespace,omitempty"`
Versions []string `json:"versions,omitempty"`
VersionIDs []string `json:"versionIds,omitempty"`
LogType string `json:"logType,omitempty"`
}
QueryParams holds common query parameters
type SearchResponse ¶
type SearchResponse struct {
Hits struct {
Total struct {
Value int `json:"value"`
Relation string `json:"relation"`
} `json:"total"`
Hits []Hit `json:"hits"`
} `json:"hits"`
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
}
SearchResponse represents the response from an OpenSearch search query
type Span ¶ added in v0.4.0
type Span struct {
DurationInNanos int64 `json:"durationInNanos"`
EndTime time.Time `json:"endTime"`
Name string `json:"name"`
SpanID string `json:"spanId"`
StartTime time.Time `json:"startTime"`
TraceID string `json:"traceId"`
}
Span represents a parsed span entry from OpenSearch
func ParseSpanEntry ¶ added in v0.4.0
ParseSpanEntry converts a search hit of a span to a SpanEntry struct
type TraceResponse ¶ added in v0.4.0
type TraceResponse struct {
Spans []Span `json:"spans"`
TotalCount int `json:"totalCount"`
Took int `json:"tookMs"`
}
TraceResponse represents the response structure for trace queries