telemetry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package telemetry defines a minimal, dependency-free observability hook that every HTTP request in this module reports through. Consumers wire their own metrics/logging backend by implementing Hook; the zero value (NoopHook) does nothing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API string

API identifies which Tipalti API family a request targeted.

const (
	APIRest        API = "rest"
	APISoap        API = "soap"
	APIProcurement API = "procurement"
)

type Func

type Func func(RequestEvent)

Func adapts a plain function to the Hook interface.

func (Func) OnRequest

func (f Func) OnRequest(e RequestEvent)

type Hook

type Hook interface {
	OnRequest(RequestEvent)
}

Hook receives a callback for every request attempt. Implementations must be safe for concurrent use, since requests may be issued concurrently by callers.

type NoopHook

type NoopHook struct{}

NoopHook implements Hook by doing nothing. It is the default when no hook is configured.

func (NoopHook) OnRequest

func (NoopHook) OnRequest(RequestEvent)

type RequestEvent

type RequestEvent struct {
	API       API
	Operation string
	Method    string
	URL       string
	Status    int   // zero if the request never got an HTTP response
	Err       error // non-nil on transport-level failure
	Duration  time.Duration
	Attempt   int // 0 for the first attempt, incremented per retry
}

RequestEvent describes one completed (or failed) HTTP request.

Jump to

Keyboard shortcuts

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