query

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2021 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Example (MergeLogSearch)
limit := 10
results := []*LogQueryResponse{
	{
		Total: 11,
		Data: []*logs.Log{
			{
				Content:   "1",
				Timestamp: 1,
			},
			{
				Content:   "3",
				Timestamp: 3,
				Offset:    1,
			},
			{
				Content:   "3",
				Timestamp: 3,
				Offset:    2,
			},
			{
				Content:   "5",
				Timestamp: 5,
				Offset:    1,
			},
			{
				Content:   "5",
				Timestamp: 5,
				Offset:    2,
			},
			{
				Content:   "6",
				Timestamp: 6,
			},
			{
				Content:   "7",
				Timestamp: 7,
			},
			{
				Content:   "8",
				Timestamp: 8,
			},
			{
				Content:   "9",
				Timestamp: 9,
			},
			{
				Content:   "10",
				Timestamp: 10,
			},
			{
				Content:   "11",
				Timestamp: 11,
			},
		},
	},
	{
		Total: 10,
		Data: []*logs.Log{
			{
				Content:   "2",
				Timestamp: 2,
			},
			{
				Content:   "3",
				Timestamp: 3,
				Offset:    3,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    1,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    2,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    3,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    4,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    5,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    6,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    7,
			},
			{
				Content:   "4",
				Timestamp: 4,
				Offset:    7,
			},
		},
	},
}
result := mergeLogSearch(limit, results)
fmt.Println(jsonx.MarshalAndIndent(result), len(result.Data))
Output:

Index

Examples

Constants

View Source
const (
	LogVersion1 = "1.0.0"
	LogVersion2 = "2.0.0"
)

log versions

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayAgg

type ArrayAgg struct {
	UnitType  string    `json:"unitType"`
	Unit      string    `json:"unit"`
	ChartType string    `json:"chartType"`
	AxisIndex int64     `json:"axisIndex"`
	Name      string    `json:"name"`
	Tag       string    `json:"tag"`
	Data      []float64 `json:"data"`
}

ArrayAgg .

type CountHistogram

type CountHistogram struct {
	Count ArrayAgg `json:"count"`
}

CountHistogram .

type ESClient

type ESClient struct {
	*elastic.Client
	URLs       string
	LogVersion string
	Indices    []string
}

ESClient .

type LogQueryResponse

type LogQueryResponse struct {
	Expends map[string]interface{} `json:"expends"`
	Total   int64                  `json:"total"`
	Data    []*logs.Log            `json:"data"`
}

LogQueryResponse .

type LogRequest

type LogRequest struct {
	OrgID       int64
	ClusterName string
	Addon       string
	Start       int64
	End         int64
	Filters     []*Tag
	Query       string
	Debug       bool
	Lang        i18n.LanguageCodes
}

LogRequest .

type LogSearchRequest

type LogSearchRequest struct {
	LogRequest
	Size int64
	Sort string
}

LogSearchRequest .

type LogStatisticRequest

type LogStatisticRequest struct {
	LogRequest
	Interval int64
	Points   int64
}

LogStatisticRequest .

type LogStatisticResponse

type LogStatisticResponse struct {
	Expends  map[string]interface{} `json:"expends"`
	Title    string                 `json:"title"`
	Total    int64                  `json:"total"`
	Interval int64                  `json:"interval"`
	Time     []int64                `json:"time"`
	Results  []*LogStatisticResult  `json:"results"`
}

LogStatisticResponse .

type LogStatisticResult

type LogStatisticResult struct {
	Name string            `json:"name"`
	Data []*CountHistogram `json:"data"`
}

LogStatisticResult .

type LogV1

type LogV1 struct {
	Message   string            `json:"message"`
	Offset    int64             `json:"offset"`
	Timestamp string            `json:"@timestamp"`
	Tags      map[string]string `json:"tags"`
}

LogV1 .

func (*LogV1) ToLog

func (l *LogV1) ToLog() *logs.Log

ToLog .

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Tag .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL