telltale

package module
v1.21.103 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 21 Imported by: ? 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.

README

clicky/telltale

Makes a clicky process observable by telltale and gops from one call. It embeds the telltale agent with probes for clicky exec, entity operations and tasks, commons logs and HTTP traffic, plus a gops agent so gops <pid> and telltale gops <pid> keep working.

go get github.com/flanksource/clicky/telltale

Start

Call Start first thing in main, so commons HTTP clients configured afterwards pick up the instrumented http.DefaultTransport:

agent, err := telltale.Start(telltale.Options{Service: "my-cli", Version: version})
if err != nil {
	return err
}
defer agent.Close() // also registered as a clicky shutdown hook

Or start it from the environment with a blank import:

import _ "github.com/flanksource/clicky/telltale/auto"
Variable Effect
TELLTALE_AGENT=1 Start the telltale agent on a local socket, advertised in <UserConfigDir>/telltale/agents/<pid>.json, plus gops
TELLTALE_URL, TELLTALE_TOKEN Also dial a telltale hub (telltale agents token create <name>)
GOPS=1 Start only the gops agent
GOPS=0 Leave gops off when telltale is started
TELLTALE_ALLOW_MUTATION=1 Allow mutating probes and ops (goprof mutex/block, gc, setgc)

Probes

Telltale arms a probe per trace session, and nothing is captured while no session is armed.

Probe Params Record
exec name glob on the binary, tailBytes (0 to 65536, default 0), phases (start, exit; default both) ExecRecord: masked args, env keys, pid, ppid, pgid, processKey, createdAt, and on exit the exit code, duration, error and output tails
entity entity and verb globs, errorsOnly EntityRecord: entity, verb, surface (cli/http/mcp), target id, masked parameters and args, duration, error. Results are never captured
task name and group globs, progressIntervalMs (default 1000) TaskRecord: a baseline record per existing task on arm, then one per status transition plus throttled progress. Logs and output are dropped
http telltale's http params commons har.Entry for every request through http.DefaultTransport, including commons clients configured with TLS or proxy options
logs minLevel, match commons logger lines (telltale/sdk/commonslog)

The SDK's own goprof and stacks probes are also available.

processKey is <pid>@<create unix second>, the key telltale's process sampler uses. An exec start record can therefore be joined to the child's process_tree/process_samples rows. If the child exited before its create time could be read, the key is the bare pid.

Ops

These are gops diagnostics as telltale ops, for agents only reachable through a hub: memstats, version (build info), stack (all goroutines), gc and setgc {"percent": N}. The last two mutate the process.

Try it

To arm all of them at once, run telltale's clicky preset. It is the built-in trace definition that fills the collect.clicky group (exec, entity, task, http, logs, plus a pprof heap profile read through the agent every 30s, or every --every). In telltale's web viewer, a run with a task capture gets a Tasks tab that renders the recorded tasks in clicky-ui's task viewer:

telltale clicky <pid> --duration 1m

In your own trace definition, the same group is spec.collect.clicky.

TELLTALE_AGENT=1 go run ./examples/demo          # prints its pid
telltale clicky <pid> --duration 10s             # records every clicky probe
telltale agents get <pid>                        # lists the probes and ops
gops stack <pid>

Documentation

Overview

Package telltale makes a clicky process observable: it embeds the telltale agent with probes for clicky exec, entity operations and tasks, commons logs and HTTP traffic through http.DefaultTransport, and a gops agent so the gops CLI and `telltale gops` keep working against the same process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartGops

func StartGops(options gops.Options) error

StartGops starts only the gops agent, for processes not traced by telltale. Signal cleanup is clicky's shutdown hooks' job, never gops's own handler.

Types

type Agent

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

Agent is a running telltale agent and, unless disabled, a gops agent.

func Start

func Start(options Options) (*Agent, error)

Start instruments http.DefaultTransport, starts the telltale agent and the gops agent, and stops both on clicky shutdown. Call it first thing in main: a commons client that cloned its transport before instrumentation is not captured.

func (*Agent) Close

func (a *Agent) Close() error

Close stops both agents; later calls return the first call's result.

type EntityRecord

type EntityRecord struct {
	Entity     string            `json:"entity"`
	Verb       string            `json:"verb"`
	Surface    string            `json:"surface,omitempty"`
	TargetID   string            `json:"targetId,omitempty"`
	Admin      bool              `json:"admin,omitempty"`
	ReadOnly   *bool             `json:"readOnly,omitempty"`
	Parameters map[string]string `json:"parameters,omitempty"`
	Args       []string          `json:"args,omitempty"`
	StartedAt  time.Time         `json:"startedAt"`
	DurationMs float64           `json:"durationMs"`
	Error      string            `json:"error,omitempty"`
}

EntityRecord is one completed clicky entity operation. Parameter values are masked, and the operation's result is never captured.

type ExecRecord

type ExecRecord struct {
	Phase      exec.ExecPhase `json:"phase"`
	Name       string         `json:"name"`
	Command    string         `json:"command,omitempty"`
	Args       []string       `json:"args,omitempty"`
	Dir        string         `json:"dir,omitempty"`
	EnvKeys    []string       `json:"envKeys,omitempty"`
	PID        int            `json:"pid"`
	PPID       int            `json:"ppid"`
	PGID       int            `json:"pgid,omitempty"`
	ProcessKey string         `json:"processKey,omitempty"`
	CreatedAt  *time.Time     `json:"createdAt,omitempty"`
	StartedAt  time.Time      `json:"startedAt"`
	DurationMs float64        `json:"durationMs,omitempty"`
	ExitCode   *int           `json:"exitCode,omitempty"`
	Error      string         `json:"error,omitempty"`
	StdoutTail string         `json:"stdoutTail,omitempty"`
	StderrTail string         `json:"stderrTail,omitempty"`
}

ExecRecord is one clicky exec start or exit. ProcessKey is <pid>@<create unix second>, the key telltale's process sampler gives the same child, so a start record hands the child off to the process kind; it is the bare pid when the child exited before its create time could be read.

type MemStats

type MemStats struct {
	Alloc, TotalAlloc, Sys, Lookups, Mallocs, Frees uint64
	HeapAlloc, HeapSys, HeapIdle, HeapInuse         uint64
	HeapReleased, HeapObjects, StackInuse, StackSys uint64
	NextGC, LastGC, PauseTotalNs                    uint64
	NumGC, NumForcedGC                              uint32
	GCCPUFraction                                   float64
	Goroutines, GOMAXPROCS, NumCPU                  int
}

MemStats is the subset of runtime.MemStats gops prints.

type Options

type Options struct {
	Service, Version string
	Dial, Token      string
	Labels           map[string]string
	AllowMutation    bool
	// NoGops leaves the gops agent stopped; Gops configures it otherwise.
	NoGops bool
	Gops   gops.Options
}

Options configures the embedded agents. Dial and Token default to TELLTALE_URL and TELLTALE_TOKEN; without a Dial the agent serves a local socket advertised under <UserConfigDir>/telltale/agents/<pid>.json.

type TaskRecord

type TaskRecord struct {
	Phase task.TaskPhase `json:"phase"`
	task.TaskSnapshot
}

TaskRecord is a clicky task snapshot at a status transition, a throttled progress update, or (Phase "baseline") a task already present when the probe was armed. Logs and captured output are left to the logs and exec kinds; only the latest log line survives as Message.

type Version

type Version struct {
	GoVersion string            `json:"goVersion"`
	Path      string            `json:"path,omitempty"`
	Main      string            `json:"main,omitempty"`
	Settings  map[string]string `json:"settings,omitempty"`
}

Version is the build identity gops reports, plus the module build info.

Directories

Path Synopsis
Package auto starts clicky's telltale and gops agents from the environment when imported for side effects:
Package auto starts clicky's telltale and gops agents from the environment when imported for side effects:
examples
demo command
Command demo is a clicky process observable by telltale and gops.
Command demo is a clicky process observable by telltale and gops.

Jump to

Keyboard shortcuts

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