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 ¶
- type ReadingData
- type Recorder
- func (r *Recorder) Begin(name string, start time.Time) counter.OnDone
- func (r *Recorder) Cache(name string, s *response.CacheStats)
- func (r *Recorder) Cumulative(name, metric string) int64
- func (r *Recorder) Pending(name string, delta int64)
- func (r *Recorder) QueryRead(view string, execution *response.SQLExecution, read int, err error)
- func (r *Recorder) Read(traceID string, m *response.Metric)
- func (r *Recorder) Recent(name, metric string) int64
- func (r *Recorder) SQL(traceID, view string, e *response.SQLExecution)
- func (r *Recorder) Values(name string) map[string]int64
- type RecorderOption
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) Cumulative ¶
func (*Recorder) Pending ¶
Pending uses the original root-session aggregation, separately from each view's timed operation and status counters.
func (*Recorder) QueryRead ¶
QueryRead invokes the callback only after QueryAll returned. Preparation, planning, and panic paths do not emit ReadingData, matching the original owner.
type RecorderOption ¶
type RecorderOption func(*Recorder)
func WithReadingData ¶
func WithReadingData(callback ReadingData) RecorderOption
WithReadingData configures a recorder at construction; nil disables callbacks.