loki

package
v1.9.4-beta Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToLogItem

func ToLogItem(detail *LogDetail, msec int64) *log_driver.LogItem

Types

type Data

type Data[T any] struct {
	ResultType string `json:"resultType"`
	Result     []*T   `json:"result"`
}

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func NewDriver

func NewDriver(config string) (*Driver, map[string]interface{}, error)

func (*Driver) LogCount

func (d *Driver) LogCount(clusterId string, conditions map[string]string, spendHour int64, group string) (map[string]int64, error)

func (*Driver) LogInfo

func (d *Driver) LogInfo(clusterId string, id string) (*log_driver.LogInfo, error)

func (*Driver) LogRecords

func (d *Driver) LogRecords(clusterId string, start time.Time, end time.Time) ([]*log_driver.LogItem, error)

func (*Driver) Logs

func (d *Driver) Logs(clusterId string, conditions map[string]string, start time.Time, end time.Time, limit int64, offset int64) ([]*log_driver.LogItem, int64, error)

type DriverConfig

type DriverConfig struct {
	URL    string   `json:"url"`
	Header []*Param `json:"headers"`
}

func (*DriverConfig) Check

func (d *DriverConfig) Check() error

type LogBodyDetail

type LogBodyDetail struct {
	RequestBody       string `json:"request_body"`
	ProxyBody         string `json:"proxy_body"`
	ResponseBody      string `json:"response_body"`
	ProxyResponseBody string `json:"proxy_response_body"`
}

type LogCount

type LogCount struct {
	Metric map[string]string `json:"metric"`
	Value  []interface{}     `json:"value"`
}

type LogDetail

type LogDetail struct {
	Api                string      `json:"api"`
	Application        string      `json:"application"`
	Strategy           string      `json:"strategy"`
	ContentType        string      `json:"content_type"`
	Cluster            string      `json:"cluster"`
	Msec               string      `json:"msec"`
	Node               string      `json:"node"`
	RequestId          string      `json:"request_id"`
	RequestMethod      string      `json:"request_method"`
	RequestScheme      string      `json:"request_scheme"`
	RequestHeader      string      `json:"request_header"`
	RequestTime        string      `json:"request_time"`
	RequestUri         string      `json:"request_uri"`
	RequestBody        string      `json:"request_body"`
	ProxyBody          string      `json:"proxy_body"`
	ResponseBody       string      `json:"response_body"`
	ResponseHeader     string      `json:"response_header"`
	ProxyResponseBody  string      `json:"proxy_response_body"`
	Service            string      `json:"service"`
	Provider           string      `json:"provider"`
	Authorization      string      `json:"authorization"`
	SrcIp              string      `json:"src_ip"`
	Status             string      `json:"status"`
	AIProvider         string      `json:"ai_provider"`
	AIModel            string      `json:"ai_model"`
	AIModelInputToken  interface{} `json:"ai_model_input_token"`
	AIModelOutputToken interface{} `json:"ai_model_output_token"`
	AIModelTotalToken  interface{} `json:"ai_model_total_token"`
}

type LogInfo

type LogInfo struct {
	Stream *LogDetail    `json:"stream"`
	Values []interface{} `json:"values"`
}

type Param

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

type Response

type Response[T any] struct {
	Data   *Data[T] `json:"data"`
	Status string   `json:"status"`
}

Jump to

Keyboard shortcuts

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