monitoring

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package monitoring exposes dependency-free per-tenant request counters for CMS host observability adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counters

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

Counters tracks per-tenant request counts + a global aggregate.

func New

func New() *Counters

New returns a fresh Counters.

func (*Counters) Inc

func (c *Counters) Inc(tenant string, statusCode int)

Inc records one request for tenant (empty = unresolved). statusCode >= 500 also increments the error counter.

func (*Counters) Snapshot

func (c *Counters) Snapshot() map[string]int64

Snapshot returns a copy of the current totals (for tests).

type StatusRecorder

type StatusRecorder struct {
	http.ResponseWriter
	Status int
}

StatusRecorder wraps http.ResponseWriter to capture the status code for the Counters.Inc call.

func (*StatusRecorder) WriteHeader

func (r *StatusRecorder) WriteHeader(code int)

Jump to

Keyboard shortcuts

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