logclient

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package logclient reads container logs from the platform's central log service.

A sandbox's Pod holds its logs only while it exists. Once the sandbox is released the Pod is recycled and the Kubernetes log API has nothing left to return — but the lines were shipped to the central service, which is where anyone asking "what did that run print" has to be sent. The dashboard has queried it since the log integration landed; this is the same query from the worker, so the API can answer for a sandbox that has already ended.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneFilters

func CloneFilters(in map[string]string) map[string]string

CloneFilters returns a copy safe to hand to a query.

Types

type Client

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

Client queries the central log service.

func New

func New(cfg Config) *Client

New returns a Client. An empty URL or Token leaves it unconfigured; callers must check Ready.

func (*Client) Query

func (c *Client) Query(
	ctx context.Context,
	podName string,
	filters map[string]string,
	start, end time.Time,
	limit int,
) ([]Entry, error)

Query returns the lines the named Pod produced within [start, end].

filters scope the query to one cluster (region / cluster labels). They are not optional in practice: pod names are unique per cluster, not globally, so an unscoped query can return another cluster's output for the same name.

func (*Client) Ready

func (c *Client) Ready() bool

Ready reports whether the service is configured.

func (*Client) SetConfig

func (c *Client) SetConfig(cfg Config)

SetConfig replaces the endpoint and credentials.

type Config

type Config struct {
	// URL is the download endpoint, e.g.
	// https://op.example.com/api/v1/rms/logging/download
	URL string
	// AppID selects the authentication scheme: set it for the signed scheme
	// (Signature/AppID/Timestamp/Randstr), leave it empty for Bearer.
	AppID string
	// Token is the signing token, or the bearer token when AppID is empty.
	Token string
	// Project scopes the query on gateways that require it; empty omits it.
	Project string
	// Timeout bounds one query.
	Timeout time.Duration
}

Config addresses the central log service.

type Entry

type Entry struct {
	Timestamp     time.Time
	Log           string
	ContainerName string
	PodName       string
}

Entry is one log line as the service returns it.

Jump to

Keyboard shortcuts

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