jobtype

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package jobtype provides job type classification for observability.

Job types allow distinguishing between interactive user requests and background maintenance tasks in metrics and logs.

Usage:

// In background jobs (archiver, enrichment):
ctx = jobtype.WithJobType(ctx, jobtype.Background)

// In metrics/logging code:
jt := jobtype.FromContext(ctx) // Returns Interactive if not set

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithJobType

func WithJobType(ctx context.Context, jt JobType) context.Context

WithJobType returns a new context with the specified job type.

Types

type JobType

type JobType string

JobType classifies the type of operation for observability purposes.

const (
	// Interactive represents user-facing operations: chat, tool calls, etc.
	// This is the default when no job type is explicitly set.
	Interactive JobType = "interactive"

	// Background represents maintenance tasks: archiver, enrichment, consolidation.
	// These operations are expected to be slower and more expensive.
	Background JobType = "background"
)

func FromContext

func FromContext(ctx context.Context) JobType

FromContext extracts the job type from context. Returns Interactive as a safe default if no job type is set.

func (JobType) String

func (jt JobType) String() string

String returns the string representation of the job type.

Jump to

Keyboard shortcuts

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