objectobs

package
v1.141.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package objectobs observes the object operations the platform makes on the buckets it owns (#1896): portal assets, managed resources, thumbnails, a script's outputs, exports and webhook segments. Every put, get, list and delete is a client span named storage.<operation> and one storage_operations_total observation labeled by what the bucket is used for (its purpose), with a failure read into a reason class, so a credential or bucket-policy mistake reads differently from an outage.

The adapters that hold an S3 client (pkg/portal/s3adapter and the webhook objects) call Do around each operation with the purpose they were built for. A caller that writes for another purpose through a shared client -- the thumbnail worker through the portal's client, an export through it -- names that purpose on the context with WithPurpose, and the operation is reported under it.

Index

Constants

View Source
const (
	OpPut      = "put"
	OpGet      = "get"
	OpGetRange = "get_range"
	OpList     = "list"
	OpDelete   = "delete"
)

The operations an object adapter reports.

Variables

This section is empty.

Functions

func Do

func Do(ctx context.Context, fallback, op, bucket string, fn func(context.Context) (int64, error)) (int64, error)

Do runs one object operation under a client span and records it. fn returns the bytes it stored (zero for anything but a put) and its error, which Do returns unchanged.

func Reason

func Reason(err error) string

Reason classifies a failed object operation: access_denied for a refused credential or policy, bucket_missing, quota_exceeded for a store that is full, not_found for an absent object, and other for everything else (a timeout, a refused connection, a server error). Empty for nil.

The S3 error code is read when the error chain carries one; the mcp-s3 client does not always wrap with %w, so the code is also looked for in the error text, where the SDK writes it.

func WithPurpose

func WithPurpose(ctx context.Context, purpose string) context.Context

WithPurpose names the purpose every object operation under ctx is reported under, whatever the client it runs through was built for.

Types

This section is empty.

Jump to

Keyboard shortcuts

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