observability

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package observability owns application-scoped native Datly counters and logs. SQL/view capture remains in sql/reader; export consumes completed native records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadingData

type ReadingData func(view string, duration time.Duration, sql string, read int, params []any, err error)

ReadingData is the explicitly configured synchronous query callback from original Datly. View identifies the view for application filtering. Arguments are borrowed and read-only during the call; callbacks must be concurrency safe. This trusted local callback can see SQL arguments. It is not an OTel exporter; it must not perform exporter/network work on the request path.

type Recorder

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

Recorder retains original gmetric operation/window semantics. One recorder owns its service and serializes registration/update, as original gmetricx did.

func NewRecorder

func NewRecorder(logger xlogger.Logger, options ...RecorderOption) *Recorder

func (*Recorder) Begin

func (r *Recorder) Begin(name string, start time.Time) counter.OnDone

func (*Recorder) Cache

func (r *Recorder) Cache(name string, s *response.CacheStats)

func (*Recorder) Cumulative

func (r *Recorder) Cumulative(name, metric string) int64

func (*Recorder) Pending

func (r *Recorder) Pending(name string, delta int64)

Pending uses the original root-session aggregation, separately from each view's timed operation and status counters.

func (*Recorder) QueryRead

func (r *Recorder) QueryRead(view string, execution *response.SQLExecution, read int, err error)

QueryRead invokes the callback only after QueryAll returned. Preparation, planning, and panic paths do not emit ReadingData, matching the original owner.

func (*Recorder) Read

func (r *Recorder) Read(traceID string, m *response.Metric)

Read emits a summary only through an explicitly configured logger. Native metrics and counters are captured independently of logging configuration.

func (*Recorder) Recent

func (r *Recorder) Recent(name, metric string) int64

func (*Recorder) SQL

func (r *Recorder) SQL(traceID, view string, e *response.SQLExecution)

func (*Recorder) Values

func (r *Recorder) Values(name string) map[string]int64

Values returns detached native cumulative counter values, never row payloads.

type RecorderOption

type RecorderOption func(*Recorder)

func WithReadingData

func WithReadingData(callback ReadingData) RecorderOption

WithReadingData configures a recorder at construction; nil disables callbacks.

Directories

Path Synopsis
Package otel exports completed native Datly records in one application-owned worker.
Package otel exports completed native Datly records in one application-owned worker.

Jump to

Keyboard shortcuts

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