usagereport

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UsageCollectorClient

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

UsageCollectorClient is a client for sending LLM usage events to the usage collector service It implements llm.UsageTracker interface

func NewUsageCollectorClient

func NewUsageCollectorClient(host, projectID string, useTLS bool, token string) (*UsageCollectorClient, error)

NewUsageCollectorClient creates a new usage collector client If host is empty, returns nil (usage collection disabled) projectID is the default project events are attributed to; a non-empty token is sent as a bearer token on every call.

func (*UsageCollectorClient) Close

func (c *UsageCollectorClient) Close() error

Close flushes held and queued events (up to a few seconds), then closes the connection.

func (*UsageCollectorClient) RecordUsage

func (c *UsageCollectorClient) RecordUsage(
	userID string,
	actionID string,
	vendor string,
	model string,
	usage llm.TokensUsage,
	durationMs int64,
	costNanoUSD int64,
	status usagev1.Status,
	meta map[string]string,
) error

RecordUsage queues a usage event for the collector. It returns an error only when validation fails; delivery is asynchronous and retried.

func (*UsageCollectorClient) SetProjectID

func (c *UsageCollectorClient) SetProjectID(projectID string)

SetProjectID sets the project ID (App UUID) for usage tracking

func (*UsageCollectorClient) SetProjectResolver

func (c *UsageCollectorClient) SetProjectResolver(fn func(meta map[string]string) string)

SetProjectResolver installs a per-event project resolver.

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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