Documentation ¶
Index ¶
- Constants
- type Direction
- type Entry
- type LabelSet
- type LokiClient
- type LokiHttpClient
- type MockLokiHttpClient
- type MockLokiHttpClient_Do_Call
- func (_c *MockLokiHttpClient_Do_Call) Return(_a0 *http.Response, _a1 error) *MockLokiHttpClient_Do_Call
- func (_c *MockLokiHttpClient_Do_Call) Run(run func(req *http.Request)) *MockLokiHttpClient_Do_Call
- func (_c *MockLokiHttpClient_Do_Call) RunAndReturn(run func(*http.Request) (*http.Response, error)) *MockLokiHttpClient_Do_Call
- type MockLokiHttpClient_Expecter
- type QueryRangeRequest
- type QueryResponse
- type QueryResponseData
- type ResultType
- type ResultValue
- type Stream
- type Streams
Constants ¶
const ( ResultTypeStream = "streams" ResultTypeScalar = "scalar" ResultTypeVector = "vector" ResultTypeMatrix = "matrix" )
ResultType values
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
Entry represents a log entry. It includes a log message and the time it occurred at.
func GetEntriesFromStreams ¶
func (*Entry) MarshalJSON ¶
func (*Entry) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type LabelSet ¶
LabelSet is a key/value pair mapping of labels
type LokiClient ¶
type LokiClient struct {
// contains filtered or unexported fields
}
func New ¶
func New(baseUrl string, client LokiHttpClient) *LokiClient
func (*LokiClient) QueryRange ¶
func (c *LokiClient) QueryRange( ctx context.Context, request *QueryRangeRequest, logger *slog.Logger, ) (*QueryResponse, error)
type LokiHttpClient ¶
type MockLokiHttpClient ¶
MockLokiHttpClient is an autogenerated mock type for the LokiHttpClient type
func NewMockLokiHttpClient ¶
func NewMockLokiHttpClient(t interface { mock.TestingT Cleanup(func()) }) *MockLokiHttpClient
NewMockLokiHttpClient creates a new instance of MockLokiHttpClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockLokiHttpClient) EXPECT ¶
func (_m *MockLokiHttpClient) EXPECT() *MockLokiHttpClient_Expecter
type MockLokiHttpClient_Do_Call ¶
MockLokiHttpClient_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do'
func (*MockLokiHttpClient_Do_Call) Return ¶
func (_c *MockLokiHttpClient_Do_Call) Return(_a0 *http.Response, _a1 error) *MockLokiHttpClient_Do_Call
func (*MockLokiHttpClient_Do_Call) Run ¶
func (_c *MockLokiHttpClient_Do_Call) Run(run func(req *http.Request)) *MockLokiHttpClient_Do_Call
func (*MockLokiHttpClient_Do_Call) RunAndReturn ¶
func (_c *MockLokiHttpClient_Do_Call) RunAndReturn(run func(*http.Request) (*http.Response, error)) *MockLokiHttpClient_Do_Call
type MockLokiHttpClient_Expecter ¶
type MockLokiHttpClient_Expecter struct {
// contains filtered or unexported fields
}
func (*MockLokiHttpClient_Expecter) Do ¶
func (_e *MockLokiHttpClient_Expecter) Do(req interface{}) *MockLokiHttpClient_Do_Call
Do is a helper method to define mock.On call
- req *http.Request
type QueryRangeRequest ¶
type QueryResponse ¶
type QueryResponse struct { Status string `json:"status"` Data QueryResponseData `json:"data"` }
Define a struct that matches the structure of the JSON response you expect from Loki. This is a simplified example; adjust according to the actual response structure you need. QueryResponse represents the http json response to a label query
type QueryResponseData ¶
type QueryResponseData struct { ResultType ResultType `json:"resultType"` Result ResultValue `json:"result"` }
QueryResponseData represents the http json response to a label query
func (*QueryResponseData) UnmarshalJSON ¶
func (q *QueryResponseData) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type ResultValue ¶
type ResultValue interface {
Type() ResultType
}
ResultValue interface mimics the promql.Value interface