harpoon

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"harpoon",
	fx.Provide(
		newRuntimeConfig,
		newHarpoonService,
		newRuntimeRegistryCounter,
		newHarpoonGuardedMux,
		runtimeharpoon.NewHostBusSubscriber,
		runtimeharpoon.NewHostBus,
	),
	fx.Invoke(registerAdditionalTransport, runtimeharpoon.StartHostRegistration),
)

Module keeps only the full-client Harpoon extensions while the registry, transport, lifecycle, and host-registration wiring live in runtimeharpoon.

Functions

This section is empty.

Types

type CallBuffer

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

CallBuffer keeps a fixed-size ring buffer of recent calls.

func NewCallBuffer

func NewCallBuffer() *CallBuffer

NewCallBuffer constructs a ring buffer for recent calls.

func (*CallBuffer) RecordCall

func (b *CallBuffer) RecordCall(entry CallEntry)

RecordCall records a call entry into the ring buffer.

func (*CallBuffer) Snapshot

func (b *CallBuffer) Snapshot(limit int, label string) []CallEntry

Snapshot returns up to limit entries, newest first, optionally filtered by label.

type CallEntry

type CallEntry struct {
	Timestamp               time.Time `json:"timestamp"`
	Label                   string    `json:"label"`
	URL                     string    `json:"url"`
	Method                  string    `json:"method"`
	Status                  int       `json:"status"`
	LatencyMS               int       `json:"latency_ms"`
	ResponseContentType     string    `json:"response_content_type,omitempty"`
	ReqBytes                int       `json:"req_bytes"`
	RespBytes               int       `json:"resp_bytes"`
	Error                   string    `json:"error,omitempty"`
	RequestBody             string    `json:"request_body,omitempty"`
	ResponseBody            string    `json:"response_body,omitempty"`
	ResponseBodyTransformed string    `json:"response_body_transformed,omitempty"`
	BodyIsBase64            bool      `json:"body_is_base64,omitempty"`
}

CallEntry captures a recent harpoon call for the admin UI.

type Registry

type Registry = runtimeharpoon.Registry

func NewRegistry

func NewRegistry(logger *slog.Logger, allowPlaintext bool, targets []Target) (*Registry, error)

NewRegistry constructs a registry backed by the shared runtime core.

func NewRegistryWithLimit

func NewRegistryWithLimit(logger *slog.Logger, allowPlaintext bool, targets []Target, limit int) (*Registry, error)

NewRegistryWithLimit constructs a registry with a maximum number of targets.

type Server

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

Server is the full-client adapter over the dependency-clean runtime core. It adds only the admin call receipt and OAuth audience capabilities that are intentionally absent from the customer runtime binaries.

func NewServer

func NewServer(cfg *config.HarpoonConfig, registry *Registry, buffer *CallBuffer, logger *slog.Logger, opts ...ServerOption) (*Server, error)

NewServer constructs the full-client adapter over the shared runtime core.

func (*Server) MCPServer

func (s *Server) MCPServer() *mcp.Server

MCPServer builds the full-client MCP server.

type ServerOption

type ServerOption = runtimeharpoon.ServerOption

ServerOption is the shared runtime-core option type.

func WithHTTPTransport

func WithHTTPTransport(rt http.RoundTripper) ServerOption

WithHTTPTransport sets the HTTP transport used for Harpoon outbound calls.

func WithMeter

func WithMeter(meter metric.Meter) ServerOption

WithMeter configures the meter used for Harpoon metrics.

type Target

type Target = runtimeharpoon.Target

The runtime package owns routing and allowlist behavior. Keep full-client names as aliases so existing callers remain source-compatible.

type TargetRegistrar

type TargetRegistrar = runtimeharpoon.TargetRegistrar

TargetRegistrar is the shared runtime-core registration contract.

func WithTarget

func WithTarget(target Target) TargetRegistrar

WithTarget returns a registrar that registers the provided target.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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