InternalCreate an ObservableBackend instance
Debug mode setting
Application ID
Plugin name
Observable bus for emitting events
Logs a debug message
The trace to associate with the log
The message to log
Additional information to log with the message
nothing
Logs an info message
The trace to associate with the log
The message to log
Additional information to log with the message
nothing
Logs a warn message
The trace to associate with the log
The message to log
Additional information to log with the message
nothing
Logs an error message
The trace to associate with the log
The message to log
Additional information to log with the message
nothing
Logs an error message
nothing
Create a counter metric
Counters are monotonically increasing values used to track cumulative totals. Common uses: request counts, error counts, bytes processed.
Metric name (e.g., "requests_total")
Short description
Detailed help text
Optionallabels: LABELS[]Optional label names for dimensional metrics
Counter instance with increment method
Create a gauge metric
Gauges represent point-in-time values that can go up or down. Common uses: memory usage, active connections, queue depth, temperature.
Metric name (e.g., "active_connections")
Short description
Detailed help text
Optionallabels: LABELS[]Optional label names for dimensional metrics
Gauge instance with set, increment, and decrement methods
Create a histogram metric
Histograms track the distribution of values over time. Common uses: request duration, response size, batch size.
Metric name (e.g., "request_duration_ms")
Short description
Detailed help text
Optionalboundaries: number[]Optional bucket boundaries (default: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10])
Optionallabels: LABELS[]Optional label names for dimensional metrics
Histogram instance with record method
Create a new distributed trace
Creates a root trace with no parent. Use this when starting a new request or operation that should be tracked independently.
Name of the trace/span (e.g., "http-request")
Optionalattributes: Record<string, string | number | boolean>Optional attributes to attach to the trace
Trace instance
Create a child span within an existing trace
Creates a child span that inherits the trace ID from the parent. This is used internally by Observable.startSpan().
Parent DTrace object
Name of the span (e.g., "database-query")
Optionalattributes: Record<string, string | number | boolean>Optional attributes to attach to the span
Trace instance representing the child span
Create a high-resolution timer
Returns a timer that can measure elapsed time in milliseconds with sub-millisecond precision using Node.js hrtime.
Timer instance with stop method
Observable Backend - Unified backend for logging and metrics
This is the internal backend that handles both logging and metrics operations. It replaces the separate PluginLogging and PluginMetrics classes with a single unified implementation.
Example