telemetry

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 15 Imported by: 1 module, 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 telemetry provides OpenTelemetry metric helpers for the Apito engine. Open-core stays Prometheus-client-free; register a MeterProvider at process startup to export metrics (exporter choice is deployment-specific).

Index

Constants

View Source
const ObservePoolCallbackInterval = 10 * time.Second

ObservePoolCallbackInterval documents expected callback frequency from the metric reader.

Variables

This section is empty.

Functions

func EchoMiddleware

func EchoMiddleware(cfg *models.Config) echo.MiddlewareFunc

EchoMiddleware returns Echo middleware that records apito_http_* metrics. Labels use Echo's route Path() to keep cardinality bounded.

func EchoRoutePattern

func EchoRoutePattern(c interface{ Path() string }) string

EchoRoutePattern returns a bounded route label for metrics (Echo route path or fallback).

func HTTPInFlightDelta

func HTTPInFlightDelta(ctx context.Context, cfg *models.Config, endpoint string, delta int64)

HTTPInFlightDelta adjusts the in-flight gauge (typically +1 before next, -1 in defer).

func LatencyBuckets

func LatencyBuckets() []float64

LatencyBuckets returns standard histogram boundaries for request/operation latency (seconds).

func MetricsEnabled

func MetricsEnabled(cfg *models.Config) bool

MetricsEnabled reports whether apito_* instruments should record (nil-safe).

func RecordCacheRequest

func RecordCacheRequest(ctx context.Context, cfg *models.Config, layer, result string)

RecordCacheRequest records cache hit/miss/err.

func RecordDBOperation

func RecordDBOperation(ctx context.Context, cfg *models.Config, engine, op string, err error, d time.Duration)

RecordDBOperation records a non-DDL project DB call.

func RecordDDLApply

func RecordDDLApply(ctx context.Context, cfg *models.Config, engine, kind string, err error, d time.Duration)

RecordDDLApply records DDL-style operations (schema/collection lifecycle).

func RecordFunctionExecute

func RecordFunctionExecute(ctx context.Context, cfg *models.Config, plugin string, err error, d time.Duration)

RecordFunctionExecute records /function execution metrics.

func RecordGraphQLOperation

func RecordGraphQLOperation(ctx context.Context, cfg *models.Config, surface, operation, opName string, err error, d time.Duration)

RecordGraphQLOperation records GraphQL execution metrics.

func RecordHTTPRequest

func RecordHTTPRequest(ctx context.Context, cfg *models.Config, endpoint, method string, status int, d time.Duration)

RecordHTTPRequest records HTTP metrics after a request completes.

func RecordKVRequest

func RecordKVRequest(ctx context.Context, cfg *models.Config, op string, err error, d time.Duration)

RecordKVRequest records a KV operation.

func RecordPoolAcquire

func RecordPoolAcquire(ctx context.Context, cfg *models.Config, projectID, engine string, err error, d time.Duration)

RecordPoolAcquire records connection pool acquire latency.

func RecordQueueConsume

func RecordQueueConsume(ctx context.Context, cfg *models.Config, queue string, err error, d time.Duration)

RecordQueueConsume records a consume/handling step.

func RecordQueueEnqueue

func RecordQueueEnqueue(ctx context.Context, cfg *models.Config, queue string, err error)

RecordQueueEnqueue records a publish to the queue abstraction.

func RecordRESTToGraphQL

func RecordRESTToGraphQL(ctx context.Context, cfg *models.Config, model, method string, status int, d time.Duration)

RecordRESTToGraphQL records REST bridge metrics.

func RecordSessionValidate

func RecordSessionValidate(ctx context.Context, cfg *models.Config, result string, d time.Duration)

RecordSessionValidate records token validation in middleware.

func RegisterConnectionManagerObservers

func RegisterConnectionManagerObservers(cfg *models.Config, cm ConnectionPoolStats)

RegisterConnectionManagerObservers wires pool stats to OTel observable instruments (no import of database package).

func StatusString

func StatusString(code int) string

StatusString returns a three-digit status string for REST metrics.

func WrapProjectDBWithMetrics

func WrapProjectDBWithMetrics(cfg *models.Config, engine string, inner interfaces.ProjectDBInterface) interfaces.ProjectDBInterface

WrapProjectDBWithMetrics returns inner wrapped with apito_db_* OTel recording when enabled.

Types

type ConnectionPoolStats

type ConnectionPoolStats interface {
	GetDetailedStats() map[string]interface{}
}

ConnectionPoolStats is implemented by *database.ConnectionManager for observable pool metrics.

Jump to

Keyboard shortcuts

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