logs

package
v0.0.0-...-b4e7bf2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogsResponse

type LogsResponse struct {
	StartTimestamp int64     `json:"start_ts"`
	EndTimestamp   int64     `json:"end_ts"`
	Results        []LogsRow `json:"results"`

	// NextPageToken is the token for next page if the results are greater than page size.
	NextPageToken string `json:"next_page_token,omitempty"`
}

type LogsRow

type LogsRow struct {
	Timestamp          time.Time         `json:"timestamp"`
	TraceID            string            `json:"trace_id" ch:"TraceIdBody"`
	SpanID             string            `json:"span_id" ch:"SpanIdBody"`
	TraceFlags         uint32            `json:"trace_flags"`
	SeverityText       string            `json:"severity_text"`
	SeverityNumber     uint8             `json:"severity_number"`
	ServiceName        string            `json:"service_name"`
	Body               string            `json:"body"`
	ResourceAttributes map[string]string `json:"resource_attributes"`
	LogAttributes      map[string]string `json:"log_attributes"`
	Fingerprint        string            `json:"fingerprint"`
}

type MockQuerier

type MockQuerier struct{}

func (*MockQuerier) GetLogs

type Querier

type Querier interface {
	GetLogs(context.Context, *QueryContext) (*LogsResponse, error)
}

func NewQuerier

func NewQuerier(
	clickHouseDSN string,
	clickHouseCloudDSN string,
	opts *clickhouse.Options,
	logger *zap.Logger,
) (Querier, error)

type Query

type Query struct {
	ServiceNames       []string
	NotServiceNames    []string
	SeverityNumbers    []int32
	NotSeverityNumbers []int32
	TraceIDs           []string
	SpanIDs            []string
	Fingerprints       []string
	TraceFlags         []uint32
	NotTraceFlags      []uint32
	Body               []string

	LogAttributeNames  []string
	LogAttributeValues []string

	ResourceAttributeNames  []string
	ResourceAttributeValues []string
}

type QueryContext

type QueryContext struct {
	ProjectID int64

	Queries    map[string]*Query
	Expression string

	StartTimestamp time.Time
	EndTimestamp   time.Time
	Time           time.Time

	PageSize  int
	PageToken string
	// NOTE(prozlach): Simple sorting by timestamp, ascending or descending.
	//
	// In order to implement anything more useful than this, we would also
	// need multi-level sorting - e.g. sort by level and then serviceID and
	// then timestamp. Plain sorting by service ID or loglevel is not very
	// useful.
	//
	// We can do it iteratively in next iterations.
	SortByTimeAsc bool
}

Jump to

Keyboard shortcuts

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