jobtype

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 1 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

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